http://stackoverflow.com/comment/38067653
type: QuestionComment
score: 0
has text: BTW many machines have more than 5 GB these days and can load it all into memory. You might find you don't need to split it at all. Why not process the file as it is?
comment on: http://stackoverflow.com/q/24575239
type: Comment

http://stackoverflow.com/comment/37998848
type: Comment
comment on: http://stackoverflow.com/a/24472647
type: AnswerComment
has text: You forgot to attach you project to the email
score: 0

http://stackoverflow.com/q/24484121
type: AnsweredQuestion
tagged with: cxf
upvote count: 2
tagged with: web-services
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24524754
has body: I have an OSGi service which I have exposed with CXF as a simple web service and for which I have created a client which invokes its methods. The methods of this service accept as one of their arguments a signed ticket which identifies the client performing the request. In order to inject this ticket to all requests coming from my client I have created a CXF out interceptor, which I have bound to the SETUP phase, and which is responsible for the injection of the ticket in the outgoing message. In case the ticket injected by my interceptor has expired, the service will throw an exception which I would like to be able to catch, get a fresh ticket and repeat the request with this fresh ticket in order to completely abstract the ticket-management functionality from the rest of my code. I have therefore created an in fault interceptor, which I have bound to the PRE_LOGICAL phase and in which I am able to identify whether the specific exception type I am interested in has been thrown. I am however unsure as to how I can repeat the request and return the result of the second request instead of the first one. Does CXF offer a way for me to do this?
downvote count: 0
answer count: 1
has title: Repeat CXF request in case of error
favorite count: 0
accepted answer: http://stackoverflow.com/a/24524754
score: 2

http://stackoverflow.com/a/24488332
type: AcceptedAnswer
has body: The problem here is you are trying to send Get Data command which requires authentication which means you should run initialize update and external authenticate before using Get data command. If you just want to test your code working or not you can test with selecting MF, and the APDU is A0 A4 00 00 02 3F00 which will return 9F XX.
score: 0
accepted answer of: http://stackoverflow.com/q/24485990
type: Answer
has comment: http://stackoverflow.com/comment/37939219
answers question: http://stackoverflow.com/q/24485990
has comment: http://stackoverflow.com/comment/37922664

http://stackoverflow.com/q/24535977
downvote count: 1
has body: I have two functions A and B. They do the same thing except one of them does it at a more granular level. I need to make sure that they are doing the same logic forever, that is, if the functionality of one function changes then the other function should change as well. The best solution (i think) would be to make a general function and a specific function. Then have one function call the other. However, in this case it would require too much code refactoring and for the sake of argument suppose its impossible. Is there a mechanism that allows me to say, when anything inside this code signature changes make sure you alert the user to look at the other function? Edit #1 @Charles Wood: I'm looking for a mechanism to do this detection to the source code (with annotations or something.) But alternatives that achieve the same goal are good too.
type: Question
has answer: http://stackoverflow.com/a/24535978
has answer: http://stackoverflow.com/a/24536507
tagged with: function
has comment: http://stackoverflow.com/comment/37995749
has comment: http://stackoverflow.com/comment/37995656
has title: Is there a way to keep two functions in sync?
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37995462
favorite count: 0
type: UnansweredQuestion
tagged with: coding-style
has comment: http://stackoverflow.com/comment/37994593
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38046904
has text: What results are you expecting, what are you comparing?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24563891

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

http://stackoverflow.com/q/24567284
has comment: http://stackoverflow.com/comment/38053428
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25700298
has title: Configuring eclipse.ini on Mac OS
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/41788783
has comment: http://stackoverflow.com/comment/38055143
has body: I am trying to configure the eclipse.ini file in order to execute Eclipse through a JVM 1.8 I have just installed on my Mac. I have added these lines -vm /Library/Java/JavaVirtualMachines/jdk1.8.0_05/Contents/Home/bin/ -vmargs -Dosgi.requiredJavaVersion=1.7 But I get the error "No Java Virtual Machine was found after searching the following locations: /Library/Java/JavaVirtualMachines/jdk1.8.0_05/Contents/Home/bin/
tagged with: macos
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/24444474
tagged with: android
tagged with: google-cloud-messaging
tagged with: java
tagged with: android-pendingintent
type: Question
has title: Status bar notification click event Android for background foreground app state
has answer: http://stackoverflow.com/a/32273774
has body: on click of a status bar notification. i want to check that if my app is in foreground state then only notification will cancel or if my app is in background state it will open my app. i have managed my app state using this code in my application class public static boolean isActivityVisible() { return activityVisible; } public static void activityResumed() { activityVisible = true; } public static void activityPaused() { activityVisible = false; } private static boolean activityVisible; and putting these for all my activities @Override protected void onResume() { super.onResume(); MyApplication.activityResumed(); } @Override protected void onPause() { super.onPause(); MyApplication.activityPaused(); } for notification i am using this code NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification.Builder(context) .setContentTitle(title).setContentText(message) .setSmallIcon(R.drawable.ic_on).build(); Intent notificationIntent = new Intent(context, AppStartActivty.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.defaults |= Notification.DEFAULT_SOUND; notification.defaults |= Notification.DEFAULT_VIBRATE; notificationManager.notify(0, notification); where shod i put this condition to check that app state and notification click behaviour. sorry for my bad inglish
score: 0
has comment: http://stackoverflow.com/comment/37833396
has comment: http://stackoverflow.com/comment/37826457
has comment: http://stackoverflow.com/comment/37831798
answer count: 1
has comment: http://stackoverflow.com/comment/37832742
type: UnansweredQuestion

http://stackoverflow.com/q/24488627
has comment: http://stackoverflow.com/comment/37907252
answer count: 3
has body: I am using windows 7 64, IDE netbeans 8. I have got some projects compiled in different jdk versions jdk 6, jdk 7 and jdk 8, manytimes I face the error of major.minor, to avoid it I am changing the jdk according to need, but it consumes a lot of time to install and uninstall jdks again and again. Is there any easy way to add and use all the jdks in the netbeans by switching etc.?
has answer: http://stackoverflow.com/a/24488742
accepted answer: http://stackoverflow.com/a/24488742
favorite count: 0
tagged with: netbeans
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24488875
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24488873
has title: How to add and use all the different JDK versions in netbean?
has answer: http://stackoverflow.com/a/24488873
type: Question
upvote count: 2

http://stackoverflow.com/comment/38058201
type: QuestionComment
has text: OK. I wasn't joking about C# being a rip-off of Java though. There are some significant differences but they're both part of the 'C' family of languages. Obviously your down-side is using visual tools - eclipse & ADT is quite clunky. It might be worth trying Android Studio which has a better UI design ability but is in a 'preview' stage.
comment on: http://stackoverflow.com/q/24564105
score: 0
type: Comment

vector
tags question: http://stackoverflow.com/q/24483985
type: Tag
tags question: http://stackoverflow.com/q/24499942
tag name: vector
tags question: http://stackoverflow.com/q/24576693
tags question: http://stackoverflow.com/q/24585223
tags question: http://stackoverflow.com/q/24516641

http://stackoverflow.com/q/24584603
has body: I'm interested in supporting developers using docker as part of their local workflow. Most of them are on Windows and OSX and would be using Boot2Docker to run docker. The source of the images are located on the host computers alongside the project source code. There is no way (without messing with the Boot2Docker image to add guest additions, or running a samba container) to share a host directory into the Boot2Docker VM so I want to use the remote API for the same effect. i.e. dev builds maven project on the host which results in a .war artifact being created. A Dockerfile is created on the host to build an image that can deploy that .war artifact. I want a command line tool that I can run on the host that will let me invoke the build image command against that Dockerfile and related files so that I get a runnable image inside of the Boot2Docker VM. There are a variety of libraries that can talk to the docker remote api but I'm having trouble finding tools that I can run directly from the host command line. I'm considering just writing my own command line interface to the docker-java library but wanted to know if there are existing tools that I could use?
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38087087
tagged with: boot2docker
downvote count: 0
has comment: http://stackoverflow.com/comment/38091675
tagged with: docker
has answer: http://stackoverflow.com/a/24588370
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Are there docker remote api command line client's
has comment: http://stackoverflow.com/comment/38099043
score: 1
tagged with: java

http://stackoverflow.com/q/24563660
has comment: http://stackoverflow.com/comment/38048593
possible better answer: http://stackoverflow.com/a/27319334
has comment: http://stackoverflow.com/comment/38046457
has comment: http://stackoverflow.com/comment/38046722
type: AnsweredQuestion
tagged with: java
has title: iterating lines with loop in java
has answer: http://stackoverflow.com/a/27319334
type: Question
has comment: http://stackoverflow.com/comment/38047817
has answer: http://stackoverflow.com/a/24564235
accepted answer: http://stackoverflow.com/a/24564235
has comment: http://stackoverflow.com/comment/38046755
has comment: http://stackoverflow.com/comment/38046607
has comment: http://stackoverflow.com/comment/38046480
score: 0
answer count: 2
tagged with: while-loop
has body: First of all I must say I read all the previous answers related to this topic and none of them were able to help me with the issue I am experiencing right now. I created a method which reads all the lines of a file using a loop while, then stops once it finds the first line containing a specific String. What I originally want to do is to replace a line from a specific file with another line, and I tried to create the method by myself. So here's my code so far: bw = new BufferedWriter(new FileWriter(tmpDirectory+"\\"+al.get(c),true)); br = new BufferedReader(new FileReader(tmpDirectory+"\\"+al.get(c))); String textToSearch = "00"; String textToReplace = "01"; String line = null; while((line = br.readLine()) != null) { if(line.contains(textToSearch)) { bw.write(textToReplace); bw.flush(); bw.close(); br.close(); break; } } The code is supposed to find a line containing the string textToSearch and replace it with the string textToReplaceand when it does that, the loop stops. The issue is that the loop stops, but the file does not change. What's wrong in my code?

http://stackoverflow.com/comment/38037504
has text: @jthalborn if you're going to discount the scenario you should explain why.
type: Comment
comment on: http://stackoverflow.com/a/24542089
score: 0
type: AnswerComment

http://stackoverflow.com/q/24498332
tagged with: maven
answer count: 1
has title: Javax and Jargs unresolved dependencies in Maven
tagged with: java
has body: I'm working on an old program that my lab had abandoned in 2007 and I'm supposed to make sure it can be easily compiled. The old developer is long gone and there is no documentation on how to compile it. The fact that I've never used Maven before makes things even more complicated. Here's what I've been doing so far: In the project directory, i run: mvn package and the compilation fails at the directory 'rusa' with the following error message: [INFO] Building rusa 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for de.wolfgang:jargs:jar:1.0 is missing, no dependency information available [WARNING] The POM for de.wolfgang:javax:jar:1.0 is missing, no dependency information available ... [INFO] rusa .............................................. FAILURE [0.041s] ... [ERROR] Failed to execute goal on project rusa: Could not resolve dependencies for project de.wolfgang:rusa:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: de.wolfgang:jargs:jar:1.0, de.wolfgang:javax:jar:1.0: Failure to find de.wolfgang:jargs:jar:1.0 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] where 'wolfgang' is the username of the previous dev. The groupId 'de.wolfgang' is defined in the project's pom.xml and under the parent tag in rusa's pom.xml. Here are the failing dependencies defined in rusa's pom.xml: ${project.groupId} jargs 1.0 ${project.groupId} javax 1.0 Am i supposed to replace the groupId with my username? Are these dependencies out-of-date? Do I need to specify where maven can find the dependencies? I'm new to Maven, and every tutorial is overly complicated. I'd really appreciate some help.
accepted answer: http://stackoverflow.com/a/24498571
type: AnsweredQuestion
type: Question
tagged with: dependencies
score: 0
has answer: http://stackoverflow.com/a/24498571

http://stackoverflow.com/q/24441730
linked to: http://stackoverflow.com/q/5324051
has answer: http://stackoverflow.com/a/24459669
accepted answer: http://stackoverflow.com/a/24459669
tagged with: soap
favorite count: 0
score: 2
downvote count: 0
tagged with: web-services
type: AnsweredQuestion
tagged with: java
has body: i have been trying to find a solution for this particular topic: It is possible to define a default value in a @webParam annotation for a SOAP/WSDL based Web Service? What i want is exactly the following result: I Have a @WebMethod in my web service called getCustomers with the following signature: @WebMethod(operationName = "getCustomers") @WebResult(name = "customer") public Customer[] getCustomers(@WebParam(name = "company") String company, @WebParam(name = "limitTop") int limitTop){ //Logic of getting customer be here } Particularly, the parameter limitTop is not optional in this method, this number indicates how many customer records you want the response returns, but i want that in my xml schema, this particular element has a default value, something like this: &lt;xs:complexType name="getCustomers"&gt; &lt;xs:sequence&gt; &lt;xs:element name="company" type="xs:string" minOccurs="0"/&gt; **&lt;xs:element name="limitTop" type="xs:int" default="100"/&gt;** &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; Please notice the default attribute in the element named limitTop This is in order to allow to the client application send a SOAP message without the limitTop element, but still limit the number of records returned to the default value given in the limitTop element. I am using Java, JAX-WS, and GlassFish Server Open Source Edition. Thanks for your help. Carlo Yañez
tagged with: jax-ws
tagged with: jaxb
type: Question
upvote count: 2
has title: How to define a default value for a @WebParam in a java web service?
answer count: 1

http://stackoverflow.com/q/24534675
has comment: http://stackoverflow.com/comment/38059871
has comment: http://stackoverflow.com/comment/38042047
has answer: http://stackoverflow.com/a/24673924
has title: Xstream isn't attaching an alias for the field
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I've defined my xstream like so: public static final String listToXMLTree(List<?> list, Class<?> domainClass, Converter evtConverter ) { String xml = ""; StringBuffer buff = new StringBuffer(1000); buff.append("<?xml version='1.0' encoding='iso-8859-1'?>"); XStream xstream = new XStream(new DomDriver()); if (list != null && list.size() > 0) { xstream.registerConverter(evtConverter); xstream.alias("rows", List.class); xstream.alias("row", Event.class ); xstream.aliasField("child", Event.class, "hasChildren"); xml = xstream.toXML(list); } else { buff.append(" "); } xml = buff.append(xml).toString(); System.out.println(xml); return xml; } But the xml that pops out doesn't have any alias for the "hasChildren" variable - why so? The xml looks like this: <?xml version='1.0' encoding='iso-8859-1'?> Puerto Rico 103415 EDIT This is the event class that I have - (on a seperate note I tried using the XStream aliases and removed the code above that creates them manually but it didn't work either): public class Event { // Event parameters private String region; private boolean hasChildren; public boolean isHasChildren() { return hasChildren; } public void setHasChildren(boolean hasChildren) { this.hasChildren = hasChildren; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } } The evtConverter is a converter that maps the xml that Xstream spits out onto a DHTMLx grid. Thanks
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24673924
has comment: http://stackoverflow.com/comment/38076033
type: Question
tagged with: xstream
answer count: 1

http://stackoverflow.com/comment/37997530
type: Comment
type: QuestionComment
has text: I would argue it's not a duplication, based on the types of exclusions. I want to find and replace on strings, while leaving parts of the replaced content untouched. The linked question is about a different kind of problem.
comment on: http://stackoverflow.com/q/24537356
score: 0

http://stackoverflow.com/q/24461403
tagged with: java
linked to: http://stackoverflow.com/q/10230006
type: Question
has body: As other questioners have noted, the Java AWT/Swing focus mechanism on Windows has changed starting with Java 7. While the documentation says "the mechanism is transparent for the user," it has broken some aspects of an application. I don't want to get too bogged down right now in details of what has changed, or things that can be done to work around the problem; rather, I have one specific question. Is there a way to force JRE 7 or 8 to use the pre-Java 7 native focus mechanism on Windows, either through a system property or an API? Thanks for any insight that anyone can provide.
has title: Any way to force JRE 7 or 8 to use JRE 6 AWT/Swing native focus mechanism?
tagged with: awt
score: 0
tagged with: focus
has comment: http://stackoverflow.com/comment/37870589
tagged with: windows
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37857589
linked to: http://stackoverflow.com/q/13047122
tagged with: swing
answer count: 0

http://stackoverflow.com/comment/38087219
type: AnswerComment
comment on: http://stackoverflow.com/a/24584854
score: 0
type: Comment
has text: Sorry..That was a mistake...I've edited my answer..

http://stackoverflow.com/comment/37968522
type: QuestionComment
has text: What do you mean when you say 'best code'? And what have you tried?
comment on: http://stackoverflow.com/q/24522096
score: 3
type: Comment

http://stackoverflow.com/q/24466381
has answer: http://stackoverflow.com/a/24466768
has comment: http://stackoverflow.com/comment/37865283
upvote count: 1
has comment: http://stackoverflow.com/comment/37865203
downvote count: 1
has comment: http://stackoverflow.com/comment/37865287
tagged with: java
has comment: http://stackoverflow.com/comment/37865217
has comment: http://stackoverflow.com/comment/37865945
tagged with: dijkstra
type: Question
has comment: http://stackoverflow.com/comment/37865396
has comment: http://stackoverflow.com/comment/37865115
has body: for(Node&lt;T&gt; neighbor : current.getAdjacentNodes()) { neighbor.setDistance(current.getDistance() + neighbor.getDistance()); queue.add(neighbor); } I am getting a NullPointerException from this for-loop. I dont really know how to avoid this. I already tried to ask (if neighbor == null) { break } but this doesn work either. This is my class. http://pastebin.com/hKMrG6h2 java.lang.NullPointerException at src.Node.getDistance(Node.java:69) at src.Dijkstra.populateDijkstraFrom(Dijkstra.java:35) at DijkstraTest.TestCase1(DijkstraTest.java:34) Dijkstra.java:35 is my for-loop [ORIGINIAL CODE] http://pastebin.com/k7Mu18YE [CLASS CODE] http://pastebin.com/hKMrG6h2
has comment: http://stackoverflow.com/comment/37865137
has comment: http://stackoverflow.com/comment/37865084
score: 0
tagged with: nullpointerexception
has title: Where does this NullPointerException come from?
has comment: http://stackoverflow.com/comment/37865556
has comment: http://stackoverflow.com/comment/37865143
has comment: http://stackoverflow.com/comment/37865857
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37865419

http://stackoverflow.com/comment/37931535
score: 0
comment on: http://stackoverflow.com/q/24501372
type: Comment
type: QuestionComment
has text: Is there are reason for using a `HashMap` rather than a POJO?

http://stackoverflow.com/comment/37819131
type: Comment
has text: I updated my answer with a 2d array example. I know it works as I do the same thing all the time.
score: 0
comment on: http://stackoverflow.com/q/24433704
type: QuestionComment

http://stackoverflow.com/q/24451372
type: UnansweredQuestion
tagged with: annotations
has comment: http://stackoverflow.com/comment/37837224
has title: How can we change message of inbuilt annotation provided by java at run time
answer count: 0
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37837071
has comment: http://stackoverflow.com/comment/37847751
has body: How can we change message of in built annotation provided by java at run time? There are links which talk about changing the message of custom annotation : e.g Can you change an annotation message at run time? Above link helped me to solve my one problem. But I want to know how to do this for the annotations provide by Java itself. e.g @DefaultValue @Digit @Min I can use something like @Min(value = 1, message = "Value must be 1 or more") but this is static message, is there any way to make it dynamic. -Cheers

http://stackoverflow.com/q/24562930
has title: Comparing Parameter Types
tagged with: comparison
tagged with: type-conversion
score: 0
has body: I have a method that is used to compare parameter types to the types of arguments given. private boolean typesMatch(Class&lt;?&gt;[] one, Object[] two) { if(one.length != two.length) return false; for (int i = 0; (i &lt; one.length)&amp;&amp;(i &lt; two.length); i++) if(!one[i].equals(two[i].getClass())) return false; return true; } For example, in one[], there might be String, boolean. However, in the second, there is String, Boolean. Do you see my issue? When it compares boolean and Boolean it returns false. How do I solve this so that I don't have to use 'if statements' for every primitive type to unwrap them? Edit: I mean to unwrap the wrapper class in the second array so it's comparable to the primitive type in the first array. Originally, the Boolean object in array two was added to it as primitive boolean.
linked to: http://stackoverflow.com/q/1704634
has answer: http://stackoverflow.com/a/24563547
has answer: http://stackoverflow.com/a/24563003
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24563003
type: Question
answer count: 2
tagged with: casting
accepted answer: http://stackoverflow.com/a/24563547

http://stackoverflow.com/q/24517571
tagged with: fxml
tagged with: netbeans
has answer: http://stackoverflow.com/a/24521691
upvote count: 1
has body: Okay so I'm following a bunch of tutorials online for Java FX and FXML, but I'm not understanding what is an fx:controller and why does my code always say there's an error with it? Can someone tell me why does Netbeans make three classes when I make a new JavaFX project? I don't want to use FX Builder or whatever it's called, I like coding it by hand. Why does netbeans make 3 different classes when I create a new JavaFX project? Please help I'm trying to learn this but I'm having this problem with all the tutorials I try to follow. Here's the code that I'm having problems with: It's giving me an error saying: Class does not exist: fxmltableview.FXMLTableViewController Class does not exist: Insets The three classes that my are in my project are: NotePadFX.java FXMLTableViewController.java fxml_tableview.fxml &lt;GridPane alignment="CENTER" hgap="1.0" vgap="10" xmlns:fx="http://javafx.com/fxml"fx:controller="fxmltableview.FXMLTableViewController"&gt; &lt;padding&gt; &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /&gt; &lt;/padding&gt; &lt;/GridPane&gt; This is the tutorial I'm trying to follow: http://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm
type: AnsweredQuestion
has title: What is an fx:controller and why do all the tutorials give me errors?
score: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24521691
type: Question
tagged with: javafx-8
answer count: 1
downvote count: 0
favorite count: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24454660
tags question: http://stackoverflow.com/q/24555380
tags question: http://stackoverflow.com/q/24579492
tags question: http://stackoverflow.com/q/24462146
tag name: jfreechart
tags question: http://stackoverflow.com/q/24562775
tags question: http://stackoverflow.com/q/24463785
tags question: http://stackoverflow.com/q/24585315
tags question: http://stackoverflow.com/q/24539445

http://stackoverflow.com/comment/39224575
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25141901
has text: I've read everything, EVERYTHING, including this site that pointed me now, before coming here and donate my points to anyone who could help me. Thanks for your time.

http://stackoverflow.com/comment/37907936
type: AnswerComment
has text: I dont. It Is naming the months Under the threshold that when they should be month 2,3,4,5 ?
type: Comment
comment on: http://stackoverflow.com/a/24480767
score: 0

http://stackoverflow.com/comment/37852447
score: 0
type: Comment
has text: I want to chenge the height of a specific cell sorry that is why i want to make a method and how can i overwrite this method ?
comment on: http://stackoverflow.com/a/24459514
type: AnswerComment

http://stackoverflow.com/a/24561773
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38043370
has comment: http://stackoverflow.com/comment/38043075
upvote count: 2
answers question: http://stackoverflow.com/q/24561697
has comment: http://stackoverflow.com/comment/38054750
type: Answer
has comment: http://stackoverflow.com/comment/38095119
has body: Change ResultSet rs to a member variable or save the position you're in and use it as a parameter for the method (see LIMIT). At the moment, you create a new ResultSet with every click, always starting at index 0.

http://stackoverflow.com/comment/37886947
has text: please post your Logcat..
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24451430

http://stackoverflow.com/a/24452490
has body: Just digging into Calendar source code those magic numbers are tied to the following fields private static final String[] FIELD_NAME = { "ERA", "YEAR", "MONTH", "WEEK_OF_YEAR", "WEEK_OF_MONTH", "DAY_OF_MONTH", "DAY_OF_YEAR", "DAY_OF_WEEK", "DAY_OF_WEEK_IN_MONTH", "AM_PM", "HOUR", "HOUR_OF_DAY", "MINUTE", "SECOND", "MILLISECOND", "ZONE_OFFSET", "DST_OFFSET" }; So in that case you can see that 11 is HOUR_OF_DAY and 12 is MINUTE
upvote count: 1
has comment: http://stackoverflow.com/comment/37839915
has comment: http://stackoverflow.com/comment/37839657
type: Answer
answers question: http://stackoverflow.com/q/24452348
downvote count: 0
score: 1

http://stackoverflow.com/q/24582519
answer count: 1
tagged with: .net
has body: I have created a small app to access a .Net Web Service But I get this error from Android SoapFault - faultcode: 'soap:Client' faultstring: 'System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://webservice.pollsdb.com/Msgs. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)' faultactor: 'null' detail: org.kxml2.kdom.Node@b1ebfe80 does anyone know how to call this service from android? This is my code SOAP_ACTION = namespace + MethodName; request = new SoapObject(namespace, MethodName); //Adding String value to request object request.addProperty("Lg", Lg); request.addProperty("Lt", Lt); request.addProperty("Cnt", Cnt); //request.addProperty("ToUnit", "" + toUnit); SetEnvelope(); //SOAP calling webservice androidHttpTransport.call(SOAP_ACTION, envelope); //Got Webservice response String result = envelope.getResponse().toString(); return result;
tagged with: android
has title: Android: Error while trying to access a .Net Web Service
has comment: http://stackoverflow.com/comment/38081481
has answer: http://stackoverflow.com/a/24582656
tagged with: web-services
linked to: http://stackoverflow.com/q/352174
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38081437
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24582656

http://stackoverflow.com/comment/37987903
type: Comment
has text: Your bean is a spring bean and a jsf bean. Leading to 2 instances of the bean one with the dependencies injected (the spring managed one) and one without them injected (the jsf managed one). Remove `@Component` and use `@ManagedProperty` instead of `@Inject`. Or remove `@ManagedBean` and `@SessionScope` and make it a spring managed session scoped bean instead.
type: QuestionComment
comment on: http://stackoverflow.com/q/24532088
score: 0

http://stackoverflow.com/comment/38011122
has text: @user3788811 I have made a final edit. If you need further help with basic OOP principles, I'd suggest Google'ing some Java tutorials.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24482074

http://stackoverflow.com/q/24475790
accepted answer: http://stackoverflow.com/a/24476545
favorite count: 0
tagged with: storage
downvote count: 2
tagged with: spring
tagged with: local-storage
type: Question
type: AnsweredQuestion
score: -2
tagged with: java
has body: My task description is something like this: "Application should be able to store text/binary files in some filesystem storage. Every file has an author and date of uploading. Application should store all versions of files and provide abilities to review history/versioning tree". We can't use DB solution here because we have another application that processes uploaded files and it requires original file version (build script which uses javac command). And this is not good idea to store files in the database. So I'm looking for some ready-to-use solution and I want to avoid writing my own storage implementation. I've googled some solutions and see jackrabbit library as a variant. It implements JCR specification. But also I saw some bad comments about JCR concept. Please advise me something else. Or is JCR good enough for my task?
tagged with: jcr
has answer: http://stackoverflow.com/a/24476545
has title: Java OpenSource library for versioning files
upvote count: 0
answer count: 1

http://stackoverflow.com/q/24493130
has comment: http://stackoverflow.com/comment/37915858
has answer: http://stackoverflow.com/a/24493708
has body: I am trying to pass 5 objects of 3 types into an array list. When I print the list all values are zero. I've tried amending the object types but still no result, can anyone help? //Item is a Class by itself and the 5 objects draw from this but will have 2/3 additional parameters ArrayList&lt;Item&gt; inventory = new ArrayList&lt;&gt;(); //Item 1 Dvd dvd1 = new Dvd(1234567, 2001, "Sugar were going down", "15", "Comedy DVD", 2, 180, "Japanese"); //Item 2 Dvd dvd2 = new Dvd(7654321, 2005, "The only way is up!", "12A", "Comedy DVD", 3, 220, "Greek, Spanish, Italian"); And so on.. Now my output looks like this: ID: 0 Year: 0 Title: Classification: Genre: Return Date: 25/5/2014 Available: true Any Suggestions? Code for Adding Objects: inventory.add(dvd1); inventory.add(dvd2); Print Code: for(int i = 0; i&lt;= inventory.size(); i++){ System.out.println(inventory.get(i)); }
has answer: http://stackoverflow.com/a/24493309
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37916147
type: Question
has comment: http://stackoverflow.com/comment/37916382
has comment: http://stackoverflow.com/comment/37916284
has comment: http://stackoverflow.com/comment/37915750
has comment: http://stackoverflow.com/comment/37916228
score: 0
answer count: 3
upvote count: 1
downvote count: 1
tagged with: object
has comment: http://stackoverflow.com/comment/37916865
has answer: http://stackoverflow.com/a/24506323
tagged with: java
has comment: http://stackoverflow.com/comment/37916171
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37916067
has comment: http://stackoverflow.com/comment/37915781
has comment: http://stackoverflow.com/comment/37915827
has title: Passing objects to an ArrayList Java

http://stackoverflow.com/comment/38072830
comment on: http://stackoverflow.com/q/24515275
has text: @njzk2 no worries on this query anymore friend.. i got it figured out using the answers... Thanks for your concern
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37835473
comment on: http://stackoverflow.com/a/24450269
type: AnswerComment
score: 0
has text: I edited the regex, demo and explanation, Ammar, please have a look. :)
type: Comment

http://stackoverflow.com/comment/37836969
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/24451296
type: Comment
has text: How does `[-2, 0, -5]` represent `-502`? What is the meaning of `-`?

http://stackoverflow.com/q/24478363
tagged with: iterator
has answer: http://stackoverflow.com/a/24478482
upvote count: 0
type: UnansweredQuestion
has title: Declaring an Iterator
tagged with: iteration
has comment: http://stackoverflow.com/comment/37887739
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/37888011
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37887968
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24478539
has body: I am having trouble with the syntax on an iterator I created. I would use a for-each loop, except I need to edit the elements that I would be pulling out of that loop. I created a class called Players which creates a List of 4 Hands(Hand is another class that represents an individual player) in a card game. I am trying to create an iterator for this class, which is giving me trouble. My implementation is as follows: public class Players { .... public class PlayerIterator implements Iterator&lt;Hand&gt; { private final Iterator&lt;Hand&gt; iterator; private PlayerIterator() { this.iterator = players.iterator(); } .... } } As far as I know, my implementation seems correct, based on the fact that I havent received any errors in eclipse. I am, however, having trouble declaring an iterator in the actual program. How would I declare an iterator like that? Right now this is giving me an error: Iterator&lt;Hand&gt; it = Players.PlayerIterator(); Hand: The class of variables I am iterating through: a list of 4 Hands Players: The class that constructs the list of Hands and contains the iterator implementation PlayerIterator: The class within the Players class that implements the iterator Does this make sense? I have a very loose grasp on iterators, so if I have not provided enough information I could easily create more.

http://stackoverflow.com/q/24523983
has title: Converting int array to collections
type: Question
upvote count: 2
has body: I'm learning Java step by step. Now I know up to arrays, and next is Collections. As I'm learning based on projects, I noticed that most of programmers choose to use Collections rather than plain arrays to eliminate the loops and to make use of the predefined functions (like sort and much more). So, first I'm trying to convert an int[] into a Collection. But I get an error in the foreach loop... import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Coll { public static void main(String[] args) { Coll obj = new Coll(); obj.op(); } void op() { System.out.println("To convert Array to Collections"); Scanner getinp = new Scanner(System.in); System.out.println("Enter the size of array : "); int siz = getinp.nextInt(); int[] arry = new int[siz]; System.out.println("Enter the values of elements"); for (int i = 0; i &lt; arry.length; i++) { System.out.println("arry[" + i + "] : "); arry[i] = getinp.nextInt(); } List arrycoll = Arrays.asList(arry); for (String elem : arrycoll) { System.out.println(elem); } } } The error is in the following line: for(String elem : arrycoll) Pointing to arrycoll, it states: required `String` but found `Object` If I define the arry as String and store Strings, it wouldn't be a error, but for int it's not working..
has answer: http://stackoverflow.com/a/24524319
tagged with: arrays
downvote count: 1
has answer: http://stackoverflow.com/a/24524348
favorite count: 0
has answer: http://stackoverflow.com/a/24524049
has comment: http://stackoverflow.com/comment/37972314
accepted answer: http://stackoverflow.com/a/24524028
linked to: http://stackoverflow.com/q/1467913
has comment: http://stackoverflow.com/comment/37972001
tagged with: collections
possible better answer: http://stackoverflow.com/a/24524049
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24524028
has comment: http://stackoverflow.com/comment/37972244
score: 1
tagged with: java

http://stackoverflow.com/q/24538378
score: -1
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37998984
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37999397
has body: According to my book it is ok! It says if we write &lt;classname&gt; with the method then we don't need to cast the Object parameter. Why am I getting the error?? import java.util.*; interface politics { //interface void politician(Object obj); } class obama implements politics &lt;obama&gt; //class { String job; public void politician(obama p) { if(p.job.equals("president")) { System.out.print("You are right Obama is Mr. PRESIDENT"); } else { System.out.print("So you say Obama is a "+job.toUpperCase()); } } } class interface2 { //class public static void main(String args[]) { //main Scanner in=new Scanner(System.in); obama o=new obama(); System.out.println("president or citizen?"); String s=in.next(); o.job=s; o.politician(o); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/37999288
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37999509
has comment: http://stackoverflow.com/comment/37999000
has comment: http://stackoverflow.com/comment/37999088
has answer: http://stackoverflow.com/a/24538669
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37999396
type: Question
has title: The following program generates a compile time error, it says -> type politics does not take parameters

http://stackoverflow.com/a/24874433
type: Answer
has comment: http://stackoverflow.com/comment/39724984
score: 1
has comment: http://stackoverflow.com/comment/39724987
upvote count: 1
downvote count: 0
has body: I researched a little bit. I came to the conclusion that yes ABQ can be implemented the same way as LBQ. I have pasted a code in paste bin to show that http://pastebin.com/ZD1uFy7S. The main reason for not implementing that way was because code was getting two complex especially because to support iterator and the performance benefits wasn't significant to go for more complex implementation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24541672
answers question: http://stackoverflow.com/q/24541672

http://stackoverflow.com/a/24544457
has body: When your app requests a PendingIntent, the system keeps a token on behalf of your app to perform an action as though your app is actually doing it. It is done this way so that, even if your app is killed, whatever process receives the PendingIntent can still follow through with it. When these tokens are created, certain info is recorded, e.g. the operation, the the action, etc. If your app were to request another PendingIntent with the same info, the same token will be returned. Now, the info used to determine if they are the same or different does not include the extras that the Intent itself carries. So when your app requests the same SMS operation with only different Intent extras, you're going to get the same token with the original extras over and over again, unless you pass a flag to indicate differently. As for the difference between the flags: FLAG_CANCEL_CURRENT "ensures that only entities given the new data will be able to launch it. If this assurance is not an issue, consider FLAG_UPDATE_CURRENT." In your case, I don't think this is an issue, so FLAG_UPDATE_CURRENT should be sufficient. If it is a concern, use FLAG_CANCEL_CURRENT. The quoted is directly from the docs here.
accepted answer of: http://stackoverflow.com/q/24544092
type: Answer
answers question: http://stackoverflow.com/q/24544092
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24497951
type: Question
has comment: http://stackoverflow.com/comment/37925598
has comment: http://stackoverflow.com/comment/37925724
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/37926115
accepted answer: http://stackoverflow.com/a/24498234
score: 0
has comment: http://stackoverflow.com/comment/37925288
answer count: 1
has comment: http://stackoverflow.com/comment/39320845
linked to: http://stackoverflow.com/q/7855822
favorite count: 0
has answer: http://stackoverflow.com/a/24498234
tagged with: serversocket
upvote count: 2
downvote count: 2
tagged with: sockets
linked to: http://stackoverflow.com/q/14782075
has comment: http://stackoverflow.com/comment/37925842
has comment: http://stackoverflow.com/comment/39309532
has comment: http://stackoverflow.com/comment/37924828
has title: When using ServerSockets and Sockets, the BufferedReader hangs and it appears the connection doesn't form properly
has comment: http://stackoverflow.com/comment/37925493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37925393
linked to: http://stackoverflow.com/q/8563529
has body: EDIT: I have corrected the mistake below in the code, by adding a line into the server code I'm trying to write some socket code that will allow me to send data from one computer to another for a game (which for simplicity's sake, we can think of as tic-tac-toe, not much data needs to be sent, just a couple of numbers). In order to achieve this I have written two classes, Server and Client. At the moment I am testing through the localhost using port 1234, and I am only using one single instance of the program (though the same problem occurs when trying to use two instances). Firstly here's the code, and then I can go into more depth about the problem, and what testing I've done to attempt to work out what is going wrong: public class Server { private ServerSocket server; private Socket socket; private Client socketHandler; private static final int DEFAULT_PORT = 1234; public Server() { this(DEFAULT_PORT); } public Server(int port) { Thread thread = new Thread() { public void run() { try { System.out.println("Attempting to Establish Connection"); server = new ServerSocket(port); socket = server.accept(); socketHandler = new Client(port, socket); //THIS LINE ADDED System.out.println("Server Online!"); } catch (Exception e) { e.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } //ADJUSTED Client getSocketHandler() { return socketHandler; } public void kill() { try { if (socket != null) socket.close(); if (server != null) server.close(); } catch(IOException e) { e.printStackTrace(); } finally { socket = null; server = null; } } } public class Client { public static final int DEFAULT_PORT = 1234; public static final String DEFAULT_HOST = "localhost"; private static final String THUMP_THUMP = "thump thump"; private static final int PULSE = 1000; private int port; private String ip; private Socket socket; private BufferedReader input = null; private PrintWriter output = null; boolean closed = true; String data = ""; public Client() { this(DEFAULT_PORT, DEF…
tagged with: java
has comment: http://stackoverflow.com/comment/37924917

http://stackoverflow.com/q/24560183
tagged with: file-io
possible better answer: http://stackoverflow.com/a/24561738
accepted answer: http://stackoverflow.com/a/24561674
has answer: http://stackoverflow.com/a/24561738
tagged with: ftp
has comment: http://stackoverflow.com/comment/38042627
has body: So what I'm trying to accomplish is create a new file on my FTP server and then write to the file. Here is my code try { URL url = new URL("ftp://" + user + ":" + pass + "@127.0.0.1/myFile.txt;type=i"); URLConnection urlc = url.openConnection(); OutputStream os = urlc.getOutputStream(); OutputStream buffer = new BufferedOutputStream(os); ObjectOutput output = new ObjectOutputStream(buffer); //I Write Here buffer.close(); os.close(); output.close(); } catch (Exception e) { e.printStackTrace(); } Regardless of how I write to the file output.writeBytes("Hello World"); output.writeChars("Hello World"); output.writeUTF("Hello World"); output.writeObject("Hello World"); The output is ¬í Also, everything is working fine but I get this in my Console java.net.SocketException: Socket closed at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at java.io.FilterOutputStream.flush(FilterOutputStream.java:140) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:141) at java.io.ObjectOutputStream$BlockDataOutputStream.flush(ObjectOutputStream.java:1823) at java.io.ObjectOutputStream.flush(ObjectOutputStream.java:719) at java.io.ObjectOutputStream.close(ObjectOutputStream.java:740) at test.Upload.main(Upload.java:30) Is it normal? Line 30 is: output.close();
type: AnsweredQuestion
tagged with: java
has title: ObjectOutput writing corrupt bytes
type: Question
has answer: http://stackoverflow.com/a/24561674
has answer: http://stackoverflow.com/a/24561452
score: 0
answer count: 3

http://stackoverflow.com/q/24478827
type: Question
tagged with: android-layout
has title: When onclick on the edittext in a listview using custom arrayadapter, Error occur
tagged with: listview
score: 0
has body: When I try to click the EditText in the ListView by following code, the apps stop and error occurred. The custom arrayadapter is using to adding RelativeLayout into list view RelativeLayoutListAdapter.java package com.example.justfortest; import java.util.List; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.RelativeLayout; public class RelativeLayoutListAdapter extends ArrayAdapter&lt;RelativeLayout&gt; { Context context; List&lt;RelativeLayout&gt; layoutItemList; int layoutResID; public RelativeLayoutListAdapter(Context context, int layoutResourceID, List&lt;RelativeLayout&gt; listItems) { super(context, layoutResourceID, listItems); this.context = context; this.layoutItemList = listItems; this.layoutResID = layoutResourceID; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutItemHolder layoutHolder; View view = convertView; if (view == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); layoutHolder = new LayoutItemHolder(); view = inflater.inflate(layoutResID, parent, false); layoutHolder.layoutcontect = (RelativeLayout) view.findViewById(R.id.layout_content); view.setTag(layoutHolder); } else { layoutHolder = (LayoutItemHolder) view.getTag(); } RelativeLayout dItem = (RelativeLayout) this.layoutItemList.get(position); layoutHolder.layoutcontect.addView(dItem); //This is Line 52 return view; } private static class LayoutItemHolder { RelativeLayout layoutcontect; } } here is the ActivityMain: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layoutlist = new ArrayList&lt;RelativeLayout&gt;(); mDrawerList = (ListView) findViewById(R.id.container); layoutlist.add(CreatLayout()); layoutlist.add(AddTakes()); layoutlist.add(AddTakes(…
answer count: 1
has comment: http://stackoverflow.com/comment/37890301
has comment: http://stackoverflow.com/comment/37889984
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37890154
has comment: http://stackoverflow.com/comment/37890188
has comment: http://stackoverflow.com/comment/37890396
has answer: http://stackoverflow.com/a/24479118
has comment: http://stackoverflow.com/comment/37890296
has comment: http://stackoverflow.com/comment/37890437
has comment: http://stackoverflow.com/comment/37890692
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/24568332
tagged with: try-catch
has answer: http://stackoverflow.com/a/24568367
accepted answer: http://stackoverflow.com/a/24568367
has answer: http://stackoverflow.com/a/24568420
upvote count: 2
has comment: http://stackoverflow.com/comment/38055267
tagged with: finally
favorite count: 0
tagged with: return
answer count: 5
has answer: http://stackoverflow.com/a/24568473
possible better answer: http://stackoverflow.com/a/24568420
has body: In this method, where can I use return statement? Inside finally? or try ? I am bit confused to return the string inside try catch statements. Here is my code. public List&lt;String&gt; getEmailAddr(String strAccountnbr, String strCode) throws Exception { String strQuery2 = null; ResultSet rs = null; PreparedStatement ps = null; try { List&lt;String&gt; emailAddress= new ArrayList&lt;String&gt;(); strQuery2 = "SELECT c.EmailAddress AS EmailAddress" + " FROM customeremailid c " + "WHERE c.AccountNbr = ? " + "AND c.Code = ? "; logMsg("strQuery2: "+strQuery2); ps = getDBConn().prepareStatement(strQuery2); ps.setString(1, strAccountnbr); ps.setString(2, strCode); rs = ps.executeQuery(); while(rs.next()) { emailAddress.add((rs.getString("EmailAddress"))); } } catch(Exception e) { e.printStackTrace(); } return emailAddress; } I am getting error as emailAddress cannot resolved to a variable. Any help?
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24568419
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24568377
has title: Return in try catch statement in java
type: Question

http://stackoverflow.com/q/24549378
answer count: 1
favorite count: 0
tagged with: maven
tagged with: spring
has body: Iam working with spring , hibernate maven project am getting the exception Cannot resolve reference to bean 'sessionFactory' on dispatcher servlet.xml file. Below iam adding the three file contents. both dispatcherservlet and application context are in resources folder. what is the problem? please help My error:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stockBo' defined in class path resource [dispatcher-servlet.xml]: Cannot resolve reference to bean 'stockDao' while setting bean property 'stockDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stockDao' defined in class path resource [dispatcher-servlet.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sessionFactory' is defined Dispatcher-servlet.xml file Applcaitioncontext.xml org.hibernate.dialect.MySQLDialect true /hibernate/Stock.hbm.xml Web.xml file contextConfigLocation classpath:ApplicationContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / 30
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38021201
type: Question
accepted answer: http://stackoverflow.com/a/24550524
has title: Cannot resolve reference to bean 'sessionFactory'
has answer: http://stackoverflow.com/a/24550524
has comment: http://stackoverflow.com/comment/38021284
upvote count: 1

http://stackoverflow.com/a/24453318
has body: Because of a silly mistake. panelBottom.add(bText, BorderLayout.NORTH); should be panelBottom.add(jScrollPane3, BorderLayout.NORTH);
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24453290
has comment: http://stackoverflow.com/comment/37842541
answers question: http://stackoverflow.com/q/24453290
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/37840873

http://stackoverflow.com/q/24485303
has body: I revise knowledge about I/O in java. Now I an introduce with pipes. I noticed that java.io.* have pipe mechanism and java.nio.* have similar mechanism. I am reading some tutorials about these things. My current vision - pipes from NIO and pipes from I/O looks same. But I understand that it is strange to have duplicate things in JDK. Thus I think that I am wrong. Can you clarify difference?
tagged with: io
answer count: 1
has title: Is there difference between pipes from NIO and IO
favorite count: 0
tagged with: dataflow
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24485352
tagged with: java
tagged with: nio
type: Question
score: 2
downvote count: 0

http://stackoverflow.com/comment/38017347
score: 0
type: Comment
has text: Keep looking. Requests like that are off-topic here.
type: QuestionComment
comment on: http://stackoverflow.com/q/24547657

http://stackoverflow.com/q/24499347
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
has comment: http://stackoverflow.com/comment/37937091
tagged with: google-cloud-endpoints
has comment: http://stackoverflow.com/comment/37935074
answer count: 0
has body: I have a GeoPt field for a JDO entity on App Engine and I created the following setter for it: public void setLocation(Float latitude,Float longitude){ location=new GeoPt(latitude, longitude); } However, when I generate the Cloud Endpoints client library through Google Plugin for Eclipse, this method does not show up in the list of methods available for this entity. How should I modify the setter such that the client library creates an endpoint for it?
score: 1
tagged with: java
upvote count: 1
tagged with: jdo
type: Question
has comment: http://stackoverflow.com/comment/37927425
linked to: http://stackoverflow.com/q/15450472
downvote count: 0
favorite count: 0
has title: How to create a setter for a GeoPt field of a JDO entity in App Engine datastore such that it shows up in the endpoint client library?

http://stackoverflow.com/a/24520760
answers question: http://stackoverflow.com/q/24520602
has body: In your application context, change the bean with id from emf to entityManagerFactory: true create org.hibernate.dialect.MySQLDialect To true create org.hibernate.dialect.MySQLDialect
has comment: http://stackoverflow.com/comment/66004000
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/44619555
has comment: http://stackoverflow.com/comment/67154201
score: 10

http://stackoverflow.com/comment/37906167
type: Comment
has text: Thank you, it was due to the incorrect naming of an activity.
comment on: http://stackoverflow.com/q/24481237
score: 0
type: QuestionComment

http://stackoverflow.com/q/24547467
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11550354
score: 3
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43404644
has body: My below code is working fine with primefaces 3.4.2 and JSF 2.1.10, after upgrading it to primefaces 5 and 2.1.27 the key and value of hashmap is throwing following error The class 'java.lang.String' does not have the property 'key'. How to access the key and value of hashmap in below code? &lt;p:selectOneMenu id="bldgGISTypeCode" value="#{buildingBean.originalBuilding.gisTypeCode}" styleClass="#{buildingBean.validationResults[8] eq false? 'ui-inputtext-border-color-red':''}" style="width:65%"&gt; &lt;f:selectItem itemLabel="Select One" itemValue="" /&gt; &lt;f:selectItems value="#{buildingBean.originalBuilding.gisTypeList}" var="gis" itemLabel="#{gis.key}" itemValue="#{gis.value}"/&gt; &lt;/p:selectOneMenu&gt;
favorite count: 0
has title: Linked Hash Map EL for key and value in primefaces 5
answer count: 0

http://stackoverflow.com/comment/38216813
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Trying to wrap my wee brain around how threads deadlock](http://stackoverflow.com/questions/749641/trying-to-wrap-my-wee-brain-around-how-threads-deadlock)
comment on: http://stackoverflow.com/q/24580686

http://stackoverflow.com/a/27573480
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24507629
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24507629
score: 4
has body: Go to Project Properties -> Java Build Path -> Libraries. Remove the Library "Unable to get system library for project". now select Android from left menu -> tick the appropriate version of android under Project Build Target. Click on apply and then OK. Now clean your project. Right click on project -> Android tools -> Fix Project Properties.

http://stackoverflow.com/q/24427619
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24427724
has answer: http://stackoverflow.com/a/24427736
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/24427760
has comment: http://stackoverflow.com/comment/37793450
has answer: http://stackoverflow.com/a/24427724
type: Question
has comment: http://stackoverflow.com/comment/37793506
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37793622
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7360111
has body: i have a problem. I have an EditText that has android:inputType="numberDecimal|numberSigned". In Java code i have this @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub int value = 0; String editContent = editText.getText().toString(); if(editContent != null &amp;&amp; editContent.length() &gt; 0) { value = Integer.parseInt(editContent); } seekBar.setProgress(value); } When i try to insert a negative number i have a NumberFormatException Invalid int "-". How can i solve this?
has comment: http://stackoverflow.com/comment/37794180
has answer: http://stackoverflow.com/a/24427723
upvote count: 1
has comment: http://stackoverflow.com/comment/37793420
has comment: http://stackoverflow.com/comment/37793784
possible better answer: http://stackoverflow.com/a/24427723
has title: NumberFormatException: Invalid int "-"
tagged with: android
has comment: http://stackoverflow.com/comment/37793510
has answer: http://stackoverflow.com/a/24428034

http://stackoverflow.com/a/24563869
has body: The name of the class would be [&lt;package identifier&gt;.]SomeClass$VariablesBean since it's a nested class.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24563858
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24563858

http://stackoverflow.com/q/24441002
answer count: 2
has answer: http://stackoverflow.com/a/24441670
upvote count: 1
has comment: http://stackoverflow.com/comment/37819261
possible better answer: http://stackoverflow.com/a/24441670
has title: Copying a folder from a .jar file
has comment: http://stackoverflow.com/comment/37818903
accepted answer: http://stackoverflow.com/a/24442057
has comment: http://stackoverflow.com/comment/37818595
linked to: http://stackoverflow.com/q/1386809
has comment: http://stackoverflow.com/comment/37818953
has comment: http://stackoverflow.com/comment/37819209
type: AnsweredQuestion
has body: I created a class called FileCopyFromJAR that has a static method called copy. This allows me to copy files to outside of the JAR by using getResourceAsStream: public static void copy(String source,String dest) throws IOException{ try{ File sourceFile = new File(source); File destFile = new File(dest); InputStream in = FileCopyFromJAR.class.getResourceAsStream(source); OutputStream out = new FileOutputStream(destFile); int bufferSize = 1024; byte[] buf = new byte[bufferSize]; int len; while ((len = in.read(buf)) &gt; 0){ out.write(buf,0,len); } in.close(); out.close(); } catch(IOException e){ throw e; } } Inside my code, I will call this by doing something like (this assumes test.txt is in the root of my .jar file): FileCopyFromJAR.copy("/test.txt","c:\\test.txt"); However, I get a FileNotFoundException if I specify a folder or a file inside a folder. Both of these return an error: FileCopyFromJAR.copy("folder\test.txt","c:\\test.txt"); FileCopyFromJAR.copy("folder", "c:\\folder"); I've also tried using various combinations like /folder\test.txt, etc. but nothing seems to work. Is there a way to make this work or do I have to use a different method?
has comment: http://stackoverflow.com/comment/37820372
has comment: http://stackoverflow.com/comment/37819295
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/37819318
score: 1
has comment: http://stackoverflow.com/comment/37819392
favorite count: 0
has comment: http://stackoverflow.com/comment/37818796
type: Question
has answer: http://stackoverflow.com/a/24442057
tagged with: java
has comment: http://stackoverflow.com/comment/37819345

http://stackoverflow.com/comment/37980034
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24528335
has text: What actually is your question/problem?
type: QuestionComment

http://stackoverflow.com/q/24558202
has body: Let's say I have the following object: object CaseObjs { trait Person case object Female extends Person case object Male extends Person } For purposes of Don't Repeat Yourself, I'd like to use these CaseObjs.Male and .Female as an Enum-like data structure in Java. In other words, I'd like to use these case object's in Java rather than create a new Java enum that duplicates code. Can I do this?
linked to: http://stackoverflow.com/q/20412287
has title: Use Scala Case Objects for Java Enums?
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24584006
tagged with: dry
type: Question
tagged with: scala
has comment: http://stackoverflow.com/comment/38083820
has answer: http://stackoverflow.com/a/24558307
answer count: 2
has comment: http://stackoverflow.com/comment/38083899
has comment: http://stackoverflow.com/comment/38045044
linked to: http://stackoverflow.com/q/20089920
has comment: http://stackoverflow.com/comment/38091224
has comment: http://stackoverflow.com/comment/38042368
tagged with: scala-java-interop
has comment: http://stackoverflow.com/comment/38086241
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38084227
tagged with: enums
type: UnansweredQuestion

http://stackoverflow.com/a/24583137
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24582758
has body: See the createAction() method below and how it creates an AbstractAction. See also the tutorial related to using actions with buttons. http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html import javax.swing.*; import javax.swing.plaf.nimbus.NimbusLookAndFeel; import java.awt.*; import java.awt.event.ActionEvent; public class EventMain { private static final ImageIcon PICTURE_1 = new ImageIcon(EventMain.class.getResource("images/v1.png")); private static final ImageIcon PICTURE_2 = new ImageIcon(EventMain.class.getResource("images/v2.png")); private JFrame frame; EventMain create() { setLookAndFeel(); frame = createFrame(); frame.getContentPane().add(createContent()); return this; } void show() { frame.setSize(470, 300); frame.setVisible(true); } private JFrame createFrame() { JFrame frame = new JFrame("Buttons"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); return frame; } private Component createContent() { final JLabel picture = new JLabel(); JButton picB1 = new JButton(createAction("Picture 1", picture, PICTURE_1)); JButton picB2 = new JButton(createAction("Picture 2", picture, PICTURE_2)); JButton picB3 = new JButton(createAction("Picture 3", picture, PICTURE_1)); JButton picB4 = new JButton(createAction("Picture 4", picture, PICTURE_2)); JButton picB5 = new JButton(createAction("Picture 5", picture, PICTURE_1)); JLabel statement = new JLabel("Choose a picture: ", JLabel.LEFT); // Create rows 1, 2, 3 JPanel panel = new JPanel(new GridLayout(3, 4)); panel.add(createRow(statement, picture)); panel.add(createRow(picB1, picB2)); panel.add(createRow(picB3, picB4, picB5)); return panel; } /** * Create an action for the button. http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html */ private Action createAction(String label, final JLabel picture, final Icon icon) { AbstractAction action = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { picture.setIcon(icon); } }; action.putValue(Action.NAME, label); r…
type: Answer
score: 2

http://stackoverflow.com/comment/37979738
type: Comment
score: 0
type: AnswerComment
has text: @kiviron I used a two level of parent pom why App1-Parent contains different extermal dependencies to App2-Parent (different spring version and external dependencny for example ). Instead for my main problem I updated my question with my new structure. But now this how to import this new module in my project (external dependeny or sub-module). Can you help me by putting the skeleton of your application?
comment on: http://stackoverflow.com/a/24527240

http://stackoverflow.com/q/24472244
has comment: http://stackoverflow.com/comment/37876629
tagged with: jsp
tagged with: javascript
tagged with: jquery
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37878137
has body: I am working with JSP and servlet and I have a checkbox in which I have lot of items, each item has a name and id along with its value. These items are getting populated dynamically. Now I need to return whatever items I am selecting back to jsp page. As of now, I am able to return the value of all those items which I have selected to jsp page. Below is my code: JQuery code Below code populates dynamically the checkbox list - $(document).ready(function () { $('.btn-secondary').click(function () { $('.btn-secondary').removeClass('currentButton') $(this).addClass('currentButton') $('form').hide() $("#form_" + $(this).attr('id')).show() $.get('/adataservlet', function (responseJson) { var $input = $('#id2'); var $type = 'checkbox'; $.each(responseJson, function (key, value) { var append = $(' ' + value + ' ').attr('id', key).val(value); $($input).append(' ').append(append); }); }); }); }); JSP code Servlet code In my below servlet code, I am extracting all the values which I have selected in the checkbox as soon as I click create button and it works fine. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // return list of values I have selected String[] reports = request.getParameterValues("meta"); System.out.println(reports); } But is there any way to get the list of id's instead of list of values whatever I am selecting? Since the above code will return the list of values whatever I have selected? Is this possible to do?
tagged with: java
has comment: http://stackoverflow.com/comment/37876771
tagged with: servlets
has title: How to pass "ID" instead of name/value from jsp to servlet?
type: Question

http://stackoverflow.com/comment/38058745
type: QuestionComment
has text: Maybe an incompatibility between gcj and Oracle's Java?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24569602

http://stackoverflow.com/comment/37892627
comment on: http://stackoverflow.com/q/24480466
score: 0
type: Comment
type: QuestionComment
has text: I used `getEncoding()` in the `FileReader` class, it returns UTF8

http://stackoverflow.com/comment/37855560
type: QuestionComment
has text: @SotiriosDelimanolis - added a definitely invalid example :)
score: 0
comment on: http://stackoverflow.com/q/24460982
type: Comment

http://stackoverflow.com/comment/38101161
type: AnswerComment
score: 0
has text: No, when I wrote above that I edited the plugin.xml file, I meant I did this by opening the plugin tab that has the MANIFEST.MF and plugin.xml (which holds the Overview, Dependencies, Runtime, Extensions, etc.). There's no more reference to the old name anywhere in the plugin, at lease by searching with the "File search" option. Still, it shows this error.
type: Comment
comment on: http://stackoverflow.com/a/24535012

http://stackoverflow.com/q/24563998
possible better answer: http://stackoverflow.com/a/24564083
has comment: http://stackoverflow.com/comment/38047296
has answer: http://stackoverflow.com/a/24564083
has comment: http://stackoverflow.com/comment/38047159
favorite count: 0
type: Question
has title: Convert a number from base 10 to N
has answer: http://stackoverflow.com/a/24564045
score: 4
has comment: http://stackoverflow.com/comment/38047350
tagged with: java
answer count: 3
accepted answer: http://stackoverflow.com/a/24564045
has comment: http://stackoverflow.com/comment/38047141
downvote count: 1
upvote count: 5
has comment: http://stackoverflow.com/comment/38047215
has answer: http://stackoverflow.com/a/41386025
type: AnsweredQuestion
has body: This code is a part of a project that I have to develop. I need to write a java method that converts a number (base 10) to another number in n base. This is the code of the class: public class converter { public int from_10_to_n(int base, int newbase) { int k = 0; String res = ""; String output = ""; do { //Below I explain what I'm doing here base /= newbase; k = base % newbase; res += String.valueOf(k); } while (base != 0); for(int i=res.length()-1; i&gt;-1; i--) { output += res.charAt(i); } return Integer.parseInt(output); } I thought to make the program in this way: The do {} while(); loop divides the numbers and saves in k the remainders. Then I make a for loop that reverses the string res (which has the reminders). By the way when I call the method in my main, I am missing the last digit. I mean: converter k = new converter(); int e = k.from_10_to_n(a /*base 10 number*/, b /*Base n number*/); System.out.println(a+" -&gt; "+b+" is " + e); With this code, if I want to convert 231 to base 4 I have 321 as result instead of 3213. I have checked my code but I cannot find a solution. Any idea? I have the same error with other bases. For example 31 (base 10) is 11111 (base 2) but my program returns 1111.

http://stackoverflow.com/q/24451430
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/19094787
has comment: http://stackoverflow.com/comment/37886947
has answer: http://stackoverflow.com/a/24451762
has answer: http://stackoverflow.com/a/24452427
has comment: http://stackoverflow.com/comment/37837725
has title: error with google map v2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14040185
tagged with: google-maps
has answer: http://stackoverflow.com/a/24451636
score: 0
answer count: 3
has body: i am trying to display or see google maps on my app. I have added the library google_play_services_lib(no error). Obtain a google maps api key. Follow the code in http://www.vogella.com/tutorials/AndroidGoogleMaps/article.html#overview_intro (no error). But run the app in emulator, it stopped. it says "Unfortunately ShowMapActivity has stopped ". i am not getting any error. i think problem is in xml file.fragment is not working. what should i do now. plz help me with this or give me simple sample project using google map. i am beginner at google map in android and trying badly to fix it but......:( here is the activity_main.xml file : <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /> MainActivity.java file : package com.vogella.android.locationapi.maps; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.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; public class MainActivity extends Activity { static final LatLng HAMBURG = new LatLng(53.558, 9.927); static final LatLng KIEL = new LatLng(53.551, 9.993); private GoogleMap map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /*map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG) .title("Hamburg")); Marker kiel = map.addMarker(new MarkerOptions() .position(KIEL) .title("Kiel") .snippet("Kiel is cool") .icon(BitmapDescriptorFactory .fromResource(R.drawable.ic_launcher))); // Move the ca…
has comment: http://stackoverflow.com/comment/37860469
has comment: http://stackoverflow.com/comment/37838018
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/57266950
type: Comment
type: QuestionComment
has text: Why dont you just override just createDispatcherServlet
score: 0
comment on: http://stackoverflow.com/q/24498662

http://stackoverflow.com/comment/38039890
has text: @BenBeri Stackoverflow is not a debug service :/ But as I said, you're calculating x/y based on sprite size. Of course that does give you odd results with varying sizes. My guess is thats the main problem causing the irregular positioning.
comment on: http://stackoverflow.com/a/24552914
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24509790
answers question: http://stackoverflow.com/q/24509454
has comment: http://stackoverflow.com/comment/37946425
has comment: http://stackoverflow.com/comment/37945957
type: Answer
accepted answer of: http://stackoverflow.com/q/24509454
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37946423
has body: You should try something like this : File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "topics.json");

http://stackoverflow.com/comment/64745168
has text: "the primary design goal for Optional is to be used as the return value of functions when a return value might be absent.". Well, it seems you cannot use them for return values in a remote EJB. Great...
score: 48
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24564612

http://stackoverflow.com/q/24516771
score: 0
has answer: http://stackoverflow.com/a/24572024
accepted answer: http://stackoverflow.com/a/24572024
tagged with: powermock
type: AnsweredQuestion
tagged with: java
has title: How can I test two static methods (one invokes the other) with PowerMockito?
type: Question
has body: How can I test the first static method method(String str, Param param)? public class Example { public static Example method(String str, Param param) { return method(str, param, null); } private static Example method(String str, Param param, SomeClass obj) { // ... } } I try to test it with code below @Test public void should_invoke_overloaded_method() throws Exception { final String str = "someString"; mockStatic(Example.class); when(Example.method(str, paramMock)) .thenCallRealMethod(); when(Example.method(str, paramMock, null)) .thenReturn(expectedMock); Example.method(str, paramMock); verifyStatic(); } But with no luck. How can I fix for example this test to verify invocation of the second method?
tagged with: mocking
answer count: 1

wildfly-8
tags question: http://stackoverflow.com/q/24452075
tags question: http://stackoverflow.com/q/24478436
type: Tag
tag name: wildfly-8
tags question: http://stackoverflow.com/q/24532734

http://stackoverflow.com/comment/37958961
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24516641
has text: oh coz it's a school tutorial work and it wants us to use vector instead so i have no choice lol thanks anyway mate!
score: 0

http://stackoverflow.com/comment/38139793
has text: No worries, make sure you accept it, took a while to get there would be a shame to waste those rep points.
comment on: http://stackoverflow.com/a/24576748
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24473987
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24446524
upvote count: 1
has body: tl;dr Instant.parse( "2016-09-27T18:33:39Z" ) Details Another solution is to avoid using the old SimoleDateFormat and java.util.Date classes as they are notoriously troublesome. Joda-Time Pass your ISO 8601 compliant string directly to Joda-Time: DateTime dateTime = new DateTime( myString ); java.time Or, preferably in java.time. The Joda-Time project is now in maintenance mode and advises migration to java.time. The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds. That means up to nine (9) digits of a decimal fraction. Instant instant = Instant.parse( "2016-09-27T18:33:39Z" ); To adjust into other offsets or time zones, search Stack Overflow for OffsetDateTime and ZonedDateTime classes. About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old date-time classes such as java.util.Date, .Calendar, &amp; java.text.SimpleDateFormat. The Joda-Time project, now in maintenance mode, advises migration to java.time. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Much of the java.time functionality is back-ported to Java 6 &amp; 7 in ThreeTen-Backport and further adapted to Android in ThreeTenABP (see How to use…). The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time.

http://stackoverflow.com/a/24529247
score: 4
has body: use replaceAll("\\d+","") on the String and then compare. This removes all the numbers from your String. Now you could use this new String and compare. or use : \\W+ // replaces everything apart from characters .
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24529205
type: Answer

http://stackoverflow.com/comment/37799099
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24429809
has text: try this too... Parent root = (Parent) loader.load(getClass().getResource("FXMLMain.fxml").toExternalForm());
score: 0

http://stackoverflow.com/comment/38085130
score: 0
type: AnswerComment
has text: Thanks. I also had a look at the related link, which uses @Controller : http://stackoverflow.com/questions/7280115/inject-a-file-resource-into-spring-bean
type: Comment
comment on: http://stackoverflow.com/a/24566286

http://stackoverflow.com/comment/37951921
type: Comment
type: QuestionComment
has text: @KonstantinV.Salikhov That should be an answer so you can get some Internet brownie points.
comment on: http://stackoverflow.com/q/24511380
score: 0

http://stackoverflow.com/q/24436466
tagged with: inheritance
tagged with: parent-child
score: 0
has comment: http://stackoverflow.com/comment/37809668
tagged with: android
has title: Class's object initialized in Parent activity re-initialized in child activity
has comment: http://stackoverflow.com/comment/37809756
has comment: http://stackoverflow.com/comment/37810285
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37809647
has comment: http://stackoverflow.com/comment/37809852
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/37809776
tagged with: java
has body: I have an object which is initialized in an activity(parent activity) now a child activity which extends the parent activity is re-initializing that object whenever the child activity's onCreate is executed. Breakdown: 1. on parent's onCreate a class's object gets initialized under a condition: if(obj == null){ Init(); } 2. a child activity is started (extends parent activity) at this moment the parent's onCreate gets called as well due to super.onCreate() and somehow it completely ignores the parent's condition to run init() in #1. Can anyone point me as to how can I get past this situation? Update: anyone..? :(
has answer: http://stackoverflow.com/a/24436661
has comment: http://stackoverflow.com/comment/37809609
answer count: 1
has comment: http://stackoverflow.com/comment/37809965

http://stackoverflow.com/comment/37979998
type: AnswerComment
comment on: http://stackoverflow.com/a/24525041
has text: I have edit the code with some additional logic.But,it's not working some times.Please check it.Thank you.
type: Comment
score: 0

http://stackoverflow.com/comment/37993055
comment on: http://stackoverflow.com/a/24535199
score: 1
type: AnswerComment
type: Comment
has text: What is the guarantee that the changes done (elements added) will be visible in to this thread?. How will this ensure *happens before* ?

http://stackoverflow.com/comment/37840398
score: 0
type: Comment
type: QuestionComment
has text: @aranhakki You now have two answers satisfying everything you need for a lock-less solution. Mine in the previous question and yshavit below. What is it you are looking for? Yshavit even goes into great detail explaining how it's working.
comment on: http://stackoverflow.com/q/24437784

flatmap
tags question: http://stackoverflow.com/q/24571491
type: Tag
tag name: flatmap

http://stackoverflow.com/comment/38071054
score: 1
comment on: http://stackoverflow.com/q/24576975
has text: You are asking why the language is defined they way it is. Amplifier(r1,r2) is a direct reference to a class, which is invalid. You could have used Amplifier myAmp = new Amplifier(r1,r2), but that would not have done what you appear to want to do.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37876963
type: Comment
type: QuestionComment
has text: I tried to repaint the entire frame but no result.
score: 0
comment on: http://stackoverflow.com/q/24472566

http://stackoverflow.com/q/24472536
downvote count: 0
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has body: I don't know how to do a GET to a REST web service through HTTPS with C#. I know how to do it in Java, but how to get the same behavior of the below code using c#? Java Code int port= 443; int protocol = "https"; AuthScope authScope = new AuthScope("host", port); DefaultHttpClient client = new DefaultHttpClient(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("user", "pass"); TrustSelfSignedStrategy strategy = new TrustSelfSignedStrategy(); SchemeSocketFactory schemeFactory = new SSLSocketFactory(strategy); Scheme https = new Scheme(protocol, port, schemeFactory); client.getCredentialsProvider().setCredentials(authScope, credentials); client.getConnectionManager().getSchemeRegistry().register(https); HttpGet httpget = new HttpGet("https://host/url/item"); HttpResponse response = client.execute(httpget); This is my code in c#. Uri uri = new Uri("https://host/url/item"); WebRequest http = HttpWebRequest.Create(url); http.Method = WebRequestMethods.Http.Get; NetworkCredential nc = new NetworkCredential("user", "pass"); http.Credentials = nc; HttpWebResponse response = (HttpWebResponse)http.GetResponse(); Stream stream = response.GetResponseStream(); At First, I had the next exception: c# The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.. But when I turned off the SSL Client Certificate Validation ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); Then The response has the html LOGIN page, not the xml response of the service. The url is ok, if I test it with the browser I have the right response. The Service is exposed by a Cisco Web API. Any ideas? Thanks for your time.
has comment: http://stackoverflow.com/comment/37997742
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37877427
tagged with: https
has comment: http://stackoverflow.com/comment/37877110
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/1702426
has comment: http://stackoverflow.com/comment/37876971
has comment: http://stackoverflow.com/comment/38037259
has title: HttpClient Get https C# NetworkCredentials not working
linked to: http://stackoverflow.com/q/22251689

http://stackoverflow.com/a/24515649
has body: If you want display images on the fly I think you should use SurfaceView. It is a lot faster and has a higher refresh rate. I made a video streaming application where I tried to display each video frame on the ImageView but that failed. But when I tried out SurfaceVIew it worked out fine.
answers question: http://stackoverflow.com/q/24515555
score: 0
type: Answer

http://stackoverflow.com/comment/37897374
comment on: http://stackoverflow.com/q/24483233
type: Comment
type: QuestionComment
score: 1
has text: try running the `mvn eclipse:clean` and then the `mvn eclipse:eclipse` command in a seperate command prompt and then refresh the project in eclipse. Most of the times, this works for me.

http://stackoverflow.com/comment/37891804
score: 0
type: Comment
type: QuestionComment
has text: @Blorgbeard I'm sorry! I genuinely thought this was a website set up to help people who were starting out programming, I'm just stumped and Can't seem to find anything that can help me, I've looked everywhere, I didnt ask for you to do it FOR me, I asked for ANY help.
comment on: http://stackoverflow.com/q/24480285

http://stackoverflow.com/comment/37890776
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24476917
has text: That did not help. The readme.txt mentions the marker files but doesn't mention anything about an 'empty' or any other flag. Nonetheless I tried copying the wars there and creating the .dodeploy files along with adding the word 'empty' to them. I then tried to start manually with standalone.sh and it still hangs. Also, setting the empty flag or dodeploy files doesn't address the other problem that the war files are not being published to jboss from eclipse. I don't think the other post mentioned this problem - only that jboss wasn't displaying the jsp correctly.

http://stackoverflow.com/q/24446998
has comment: http://stackoverflow.com/comment/37837395
has comment: http://stackoverflow.com/comment/37840543
downvote count: 0
tagged with: wicket
has comment: http://stackoverflow.com/comment/37857892
favorite count: 0
tagged with: clob
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: hibernate
has body: I want to store a large Text in my Database. For that I created the CLOB field description in my table and added it to hibernate like: @Column private byte[] description; In Wicket I added a Textarea like this: add(new TextArea&lt;Object&gt;("advisor.descriptionClob")); When I click on my AjaxSubmitLink nothing happens (no code at all gets executed), which is a bit confusing for me, since wicket shouldn't really care about what database type I use? Has anyone an idea what's going on here and how I fix this? I use Wicket 6.9.1, Hibernate 4.1.7 and a MySQL database
tagged with: mysql
has title: Saving large text in CLOB with Wicket

java
tags question: http://stackoverflow.com/q/24586308
tags question: http://stackoverflow.com/q/24452686
tags question: http://stackoverflow.com/q/24485109
tags question: http://stackoverflow.com/q/24465668
tags question: http://stackoverflow.com/q/24434466
tags question: http://stackoverflow.com/q/24498483
tags question: http://stackoverflow.com/q/24545184
tags question: http://stackoverflow.com/q/24471779
tags question: http://stackoverflow.com/q/24440229
tags question: http://stackoverflow.com/q/24583305
tags question: http://stackoverflow.com/q/24543376
tags question: http://stackoverflow.com/q/24581631
tags question: http://stackoverflow.com/q/24576059
tags question: http://stackoverflow.com/q/24445014
tags question: http://stackoverflow.com/q/24471832
tags question: http://stackoverflow.com/q/24496488
tags question: http://stackoverflow.com/q/24493130
tags question: http://stackoverflow.com/q/24536423
tags question: http://stackoverflow.com/q/24528729
tags question: http://stackoverflow.com/q/24430313
tags question: http://stackoverflow.com/q/24514516
tags question: http://stackoverflow.com/q/24452367
tags question: http://stackoverflow.com/q/24558735
tags question: http://stackoverflow.com/q/24498217
tags question: http://stackoverflow.com/q/24495607
tags question: http://stackoverflow.com/q/24572821
tags question: http://stackoverflow.com/q/24432247
tags question: http://stackoverflow.com/q/24524308
tags question: http://stackoverflow.com/q/24513328
tags question: http://stackoverflow.com/q/24501395
tags question: http://stackoverflow.com/q/24470815
tags question: http://stackoverflow.com/q/24451026
tags question: http://stackoverflow.com/q/24527419
tags question: http://stackoverflow.com/q/24467494
tags question: http://stackoverflow.com/q/24434288
tags question: http://stackoverflow.com/q/24468339
tags question: http://stackoverflow.com/q/24474978
tags question: http://stackoverflow.com/q/24526187
tags question: http://stackoverflow.com/q/24538991
tags question: http://stackoverflow.com/q/24526962
tags question: http://stackoverflow.com/q/24483949
tags question: http://stackoverflow.com/q/24538378
tags question: http://stackoverflow.com/q/24490502
tags question: http://stackoverflow.com/q/24546595
tags question: http://stackoverflow.com/q/24555728
tags question: http://stackoverflow.com/q/24567871
tags question: http://stackoverflow.com/q/24464258
tags question: http://stackoverflow.com/q/24535782
tags question: http://stackoverflow.com/q/24448366
tags question: http://stackoverflow.com/q/24448799
tags question: http://stackoverflow.com/q/24587967
tags question: http://stackoverflow.com/q/24515803
tags question: http://stackoverflow.com/q/24496426
tags question: http://stackoverflow.com/q/24520833
tags question: http://stackoverflow.com/q/24512876
tags question: http://stackoverflow.com/q/24491300
tags question: http://stackoverflow.com/q/24536332
tags question: http://stackoverflow.com/q/24584369
tags question: http://stackoverflow.com/q/24475830
tags question: http://stackoverflow.com/q/24549652
tags question: http://stackoverflow.com/q/24506074
tags question: http://stackoverflow.com/q/24581948
tags question: http://stackoverflow.com/q/24569386
tags question: http://stackoverflow.com/q/24497758
tags question: http://stackoverflow.com/q/24487146
tags question: http://stackoverflow.com/q/24483332
tags question: http://stackoverflow.com/q/24482863
tags question: http://stackoverflow.com/q/24557196
tags question: http://stackoverflow.com/q/24433951
tags question: http://stackoverflow.com/q/24512655
tags question: http://stackoverflow.com/q/24548282
tags question: http://stackoverflow.com/q/24447579
tags question: http://stackoverflow.com/q/24508732
tags question: http://stackoverflow.com/q/24568613
tags question: http://stackoverflow.com/q/24441831
tags question: http://stackoverflow.com/q/24450296
tags question: http://stackoverflow.com/q/24434650
tags question: http://stackoverflow.com/q/24572214
tags question: http://stackoverflow.com/q/24557268
tags question: http://stackoverflow.com/q/24435239

http://stackoverflow.com/comment/38083086
comment on: http://stackoverflow.com/a/24583477
score: 0
type: Comment
type: AnswerComment
has text: This is not what I am asking for.

http://stackoverflow.com/a/24674092
score: 0
type: AcceptedAnswer
has body: It was an issue with the selenium webdriver extension in safari. The selenium webdriver extension when upgraded from 2.30 to 2.38 worked fine.
type: Answer
accepted answer of: http://stackoverflow.com/q/24503850
answers question: http://stackoverflow.com/q/24503850

http://stackoverflow.com/q/24527977
tagged with: selenium
has comment: http://stackoverflow.com/comment/37995973
downvote count: 1
tagged with: java
score: -1
tagged with: selendroid
type: Question
has body: I need to click on a image icon which is a ImageView type. By using inspector I got the following code: WebElement element1 = driver.findElement(By.xpath("(//ImageView)[1]")); element1.click(); But when I am using this code in my script then its showing "Element not found". I also tried by using ID of that image icon. The same error occurs.
upvote count: 0
has answer: http://stackoverflow.com/a/24528573
favorite count: 0
tagged with: android
answer count: 1
has title: How to click on a image icon which is a ImageView type using Selendroid?
type: UnansweredQuestion

http://stackoverflow.com/comment/39084826
comment on: http://stackoverflow.com/q/24485365
score: 0
type: QuestionComment
has text: @SergeBallesta: I checked, that we get `org.hibernate.SessionFactory` by calling `org.hibernate.cfg.Configuration.buildSessionFactory()` and then `org.hibernate.Session` by calling `mySessionFactoryImpl.getCurrentSession()`.
type: Comment

http://stackoverflow.com/q/24517126
score: 1
tagged with: java
has body: I made some foolish mistakes with my last post, but I'm back and I feel I have a better formatted question. I am calling a function called getData() which is a byte[] return type and I am sending it through packets to another program. On the program side I receive "98 0 0 101" which tells me that something is wrong with my bDrive.getX() and bDrive.getY() functions. Those functions are derived from a Joystick class that I made which displays a View and draws a joystick. I have tried keeping everything in my Mybot Activity besides the socket work. public class Mybot extends Activity { Thread arduino; ArduinoConnection socketThread; Joystick bDrive; public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); setContentView(R.layout.activity_Mybot); socketThread = new ArduinoConnection(Mybot.this); arduino = new Thread( socketThread); arduino.start(); } public byte[] getData() { bDrive = (Joystick)findViewById(R.id.bDrive); // I think this is the culprit byte[] arrayOfData = new byte[4]; arrayOfData[0] = 98; arrayOfData[1] = (byte) bDrive.getX(); // Returns 0 arrayOfData[2] = (byte) bDrive.getY(); // Returns 0 arrayOfData[3] = 101; return arrayOfData; } } I feel the error is within the findViewById() portion of my getData() function. However I handled the onTouch within my Joystick class so I don't really understand why this would be an issue. public class ArduinoConnection implements Runnable { boolean sending = true; public static DatagramSocket socket; Mybot host; public ArduinoConnection(Mybot mini) { this.host = mini; } public void run() { try { socket = new DatagramSocket(); InetAddress localInetAddress = InetAddress.getByName("192.168.10.104"); socket.connect(localInetAddress, 61557); running = true; while (sending) { byte[] arrayOfByte = this.host.getData(); // Returning 98 0 0 101 DatagramPacket localDatagramPacket = new DatagramPacket(arrayOfByte, arrayOfByte.length); try { socket.send(localDatagramPacket); } catch (IOException localIOException) { …
type: Question
has title: Why is my byte[] array returning zero instead of the position?
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37959288
has comment: http://stackoverflow.com/comment/37960671
has comment: http://stackoverflow.com/comment/37959559
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/37936257
comment on: http://stackoverflow.com/q/24504213
score: 0
type: QuestionComment
has text: @Sanjeev : I have to check my log and I'm getting value in strSeparated_Id.
type: Comment

http://stackoverflow.com/q/24503393
score: 0
has title: Render Graphics in browser
has comment: http://stackoverflow.com/comment/38446897
tagged with: jogl
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/38446980
has comment: http://stackoverflow.com/comment/37937298
answer count: 0
has comment: http://stackoverflow.com/comment/37940780
tagged with: opengl
tagged with: java
has body: We have one client server application developed in Java. For the client we are using swing components. Inside the swing canvas, we are rendering graphics using jmonkeyengine. Our question is how we can move our client from swing to browser. Is there any technology through which we can show the client in browser or render the graphics in browser?
has comment: http://stackoverflow.com/comment/37942278
type: Question
tagged with: jmonkeyengine

http://stackoverflow.com/comment/37999518
score: 3
comment on: http://stackoverflow.com/q/24538586
has text: Your code seems wrong: You cannot SET false to an array. And you cannot call a method that takes an argument with no arguments... Please provide the original source - otherwhise any attempt to help you is damned to fail.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24447579
has title: Failed to start glassfish server because Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log
tagged with: glassfish-3
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24447676
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/62138272
has body: admin@BRMSDEV:/opt/glassfishv3/glassfish/bin$ ./asadmin start-domain domain1 java.io.IOException: Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log at java.util.logging.FileHandler.openFiles(FileHandler.java:389) at java.util.logging.FileHandler.&lt;init&gt;(FileHandler.java:287) at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:85) at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:148) at com.sun.enterprise.admin.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:239) at com.sun.enterprise.admin.cli.StartDomainCommand.runCommandNotEmbedded(StartDomainCommand.java:122) at com.sun.enterprise.admin.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117) at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:257) at com.sun.enterprise.admin.cli.AsadminMain.executeCommand(AsadminMain.java:229) at com.sun.enterprise.admin.cli.AsadminMain.main(AsadminMain.java:167) Waiting for DAS to start .Error starting domain: domain1. The server exited prematurely with exit code 0. Before it died, it produced the following output: Warning: Cannot open log file: /opt/glassfishv3/glassfish/domains/domain1/logs/jvm.log admin@BRMSDEV:/opt/glassfishv3/glassfish/bin$ ./asadmin start-domain domain1 java.io.IOException: Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log at java.util.logging.FileHandler.openFiles(FileHandler.java:389) at java.util.logging.FileHandler.&lt;init&gt;(FileHandler.java:287) at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:85) at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:148) at com.sun.enterprise.admin.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:239) at com.sun.enterprise.admin.cli.StartDomainCommand.runCommandNotEmbedded(StartDomainCommand.java:122) at com.sun.enterprise.admin.cli.StartDomainCommand.executeCommand(StartDom…
favorite count: 0
has answer: http://stackoverflow.com/a/45186130
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37830184
downvote count: 1

http://stackoverflow.com/q/24512143
upvote count: 1
tagged with: openshift
type: Question
type: AnsweredQuestion
tagged with: vaadin
has title: Deploying Vaadin App in Openshift
has comment: http://stackoverflow.com/comment/37952758
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37951158
has body: I just created my first Vaadin application. The application works fine on my local server. I want to upload this app to Openshift. I followed the instructions here: https://www.openshift.com/kb/kb-e1088-how-to-deploy-pre-compiled-java-applications-war-and-ear-files-onto-your-openshift-gear The app has been uploaded, but the only thing that is displayed is text. No panels or CSS or anything. Does anyone have any idea why this is happening? Thank you! Console: Jul 01, 2014 8:39:50 AM com.vaadin.server.VaadinServlet serveOnTheFlyCompiledScss WARNING: Scss file VAADIN/themes/test/styles.scss exists but ScssStylesheet was not able to find it Jul 01, 2014 8:39:50 AM com.vaadin.server.VaadinServlet serveStaticResourcesInVAADIN INFO: Requested resource [/VAADIN/themes/test/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
favorite count: 0
has answer: http://stackoverflow.com/a/32513323
accepted answer: http://stackoverflow.com/a/32513323
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/37952212
has comment: http://stackoverflow.com/comment/37951825
has comment: http://stackoverflow.com/comment/37950086
score: 1
tagged with: java

http://stackoverflow.com/q/24465979
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/37864351
tagged with: java
has comment: http://stackoverflow.com/comment/37865977
type: Question
has title: How to get String from a Java file to a different one in Android Studio
tagged with: variables
has comment: http://stackoverflow.com/comment/37864722
score: 0
has comment: http://stackoverflow.com/comment/37864763
has body: I have this code, I wan to transfer the variables from the java file of java_2 to java_2_1, I try to use the method extends, but it doesn't work: public class java_2 extends java {//There is java_1, which is the first, but //the String transfer is only between java_2.java and //java_2_1.java; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dise_2); botonRETURN1(); botonAHEAD1(); //I WANT TO TRANSFER ALL THIS VARIABLES TO java_2_1, but don't know how. final EditText A,B,C,D,E,F; String AA,BB,CC,DD,EE,FF,G; A=(EditText)findViewById(R.id.A); B=(EditText)findViewById(R.id.B); C=(EditText)findViewById(R.id.C); D=(EditText)findViewById(R.id.D); E=(EditText)findViewById(R.id.E); F=(EditText)findViewById(R.id.F); AA=A.getText().toString(); BB=B.getText().toString(); CC=C.getText().toString(); DD=D.getText().toString(); EE=E.getText().toString(); FF=F.getText().toString(); G=AA+BB+CC+DD+EE+FF; } TO: public class java_2_1 extends java_2{//I try doing this heritance thing, but it doesn't work; protected void onCreate(Bundle savedInstanceState) { } }
type: UnansweredQuestion

http://stackoverflow.com/a/24475676
has comment: http://stackoverflow.com/comment/37887817
has body: each activity has context so from the exception that you got i guess its a problem with the context of the MediaPlayerService. you are using bindService(...) to bind the intent to the MediaPlayerService that should bind the context. try to check if that binding is still there when you are trying to do "mService.next(section);"
answers question: http://stackoverflow.com/q/24468836
score: 0
type: Answer

http://stackoverflow.com/a/24540888
has comment: http://stackoverflow.com/comment/38012567
answers question: http://stackoverflow.com/q/24540497
type: AcceptedAnswer
has body: A dialog isn't actually a part of the activity's view hierarchy. Dialogs are added via the WindowManager. Check the source code for Dialog. When the Dialog is instantiated, it obtains a reference to the WindowManager from the context, and initializes a new Window. mWindowManager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); Window w = PolicyManager.makeNewWindow(mContext); Then later, when you show() the Dialog: WindowManager.LayoutParams l = mWindow.getAttributes(); try { mWindowManager.addView(mDecor, l); mShowing = true; When you call setContentView(), the view you supply is attached to the activity's default window. When you call Dialog.show(), the dialog's view is attached to a different window for the same display. That's why they are both displayed without actually being part of the same view hierarchy.
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/38030297
has comment: http://stackoverflow.com/comment/38011739
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24540497
score: 7

apache-poi
tags question: http://stackoverflow.com/q/24449595
tags question: http://stackoverflow.com/q/24429232
tags question: http://stackoverflow.com/q/24468922
tags question: http://stackoverflow.com/q/24541060
tags question: http://stackoverflow.com/q/24449145
tags question: http://stackoverflow.com/q/24495416
tags question: http://stackoverflow.com/q/24562700
tags question: http://stackoverflow.com/q/24564028
type: Tag
tags question: http://stackoverflow.com/q/24574490
tags question: http://stackoverflow.com/q/24461587
tags question: http://stackoverflow.com/q/24529486
tags question: http://stackoverflow.com/q/24545790
tags question: http://stackoverflow.com/q/24447502
tags question: http://stackoverflow.com/q/24460915
tags question: http://stackoverflow.com/q/24448360
tags question: http://stackoverflow.com/q/24554046
tags question: http://stackoverflow.com/q/24529418
tag name: apache-poi
tags question: http://stackoverflow.com/q/24548102
tags question: http://stackoverflow.com/q/24466575
tags question: http://stackoverflow.com/q/24571072
tags question: http://stackoverflow.com/q/24436659

http://stackoverflow.com/q/24564105
answer count: 1
has body: First off I need to tell you that I am new to java I have only been using it for a bout 3 weeks. I am putting together an app for our Electrical / instrumentation apprentices. I developed an app using Microsoft Visual Studio 2010 Express for Windows Phone 7; unfortunately I am unable to run the app on a test phone with out paying Microsoft for a developer’s license for each phone at a cost of $100.00ea. Is it possible to import and convert a Microsoft Visual Studio 2010 Express for Windows Phone 7 app in to eclipse and convert it for android? Please tell me that this is easy to do! Thanks
score: 0
has title: Convert Windows Phone 7 app to eclipse for android
has answer: http://stackoverflow.com/a/24564215
accepted answer: http://stackoverflow.com/a/24564215
has comment: http://stackoverflow.com/comment/38086395
tagged with: android
has comment: http://stackoverflow.com/comment/38047462
has comment: http://stackoverflow.com/comment/38082647
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38058201
tagged with: java
has comment: http://stackoverflow.com/comment/38052660
type: Question

http://stackoverflow.com/comment/37826035
type: QuestionComment
comment on: http://stackoverflow.com/q/24445207
has text: I think C# is not right tag here.
score: 0
type: Comment

http://stackoverflow.com/comment/38015806
type: QuestionComment
comment on: http://stackoverflow.com/q/24547213
has text: what type of content your used in placemap activityclass
score: 0
type: Comment

http://stackoverflow.com/a/24544380
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24544360
accepted answer of: http://stackoverflow.com/q/24544360
has body: You should add a timeout for the network operation. That way, it will throw an exception if this timeout is exceeded. For example, if using a DefaultHttpClient, it would be something like: HttpParams httpParameters = client.getParams(); HttpConnectionParams.setConnectionTimeout(httpParameters, CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(httpParameters, SOCKET_TIMEOUT); If it's an HttpUrlConnection instead, use: connection.setConnectTimeout(CONNECTION_TIMEOUT); connection.setReadTimeout(SOCKET_TIMEOUT); where CONNECTION_TIMEOUT and SOCKET_TIMEOUT are in milliseconds.
score: 4
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37993558
has text: Removing the dataType attribute on my ajax call did fix it. Why are you saying that my whole method should not be invoked? I'm on Spring 4.0.5
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24535303

http://stackoverflow.com/comment/38069070
has text: just go ahead, and write file length, then file contents into `outClient`. On client side, act accordingly.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24575971

certificate-revocation
tags question: http://stackoverflow.com/q/24536978
tag name: certificate-revocation
type: Tag

http://stackoverflow.com/q/24482503
has answer: http://stackoverflow.com/a/24482701
has title: Rounding a Bill Total in Java
has answer: http://stackoverflow.com/a/24482653
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37897485
has comment: http://stackoverflow.com/comment/37896152
has body: I'm trying to provide app users with the number of tip they would have to leave so that their bill would be rounded to a nice number. Example: Let's say the bill is 5.21 tipping @ 20 percent = 1.04 tip. 5.21 + 1.04 = 6.25 total. To make the tip 7.00 they would have to tip 1.79. I thought my logic was good here but I'm showing weird numbers popping when I run it. No errors in logcat, so it is something in my code. I'm pretty sure it is somewhere in the rounding part of the code as I'm not sure if I'm doing it even correctly at this point. The code is: package mkelleyjr.example.tippycalc; import java.text.DecimalFormat; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText amt = (EditText) findViewById(R.id.bill_amt); final EditText tip = (EditText) findViewById(R.id.bill_percent); final TextView result = (TextView) findViewById(R.id.res); final TextView total = (TextView) findViewById(R.id.total); final TextView round = (TextView) findViewById(R.id.round); Button calc = (Button) findViewById(R.id.button1); calc.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DecimalFormat decimalFormat = new DecimalFormat("$0.00"); decimalFormat.setMinimumFractionDigits(3); try{ double amount = Double.parseDouble(amt.getText().toString()); double tip_per = Double.parseDouble(tip.getText().toString()); double tip_cal = (amount * tip_per) / 100; double totalcost = amount + tip_cal; decimalFormat.format(totalcost); // round totalcost then perform math on it double rounded = (double)Math.round(totalcost); double roundtotal = rounded - totalcost; result.setText("Tip Amount : " + " $ " + Double.toString(tip_cal…
linked to: http://stackoverflow.com/q/3730019
type: Question
has answer: http://stackoverflow.com/a/24482601
duplicate of: http://stackoverflow.com/q/3730019
has comment: http://stackoverflow.com/comment/37895985
favorite count: 0
has comment: http://stackoverflow.com/comment/37897610
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37897025
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/59339515
score: 1
type: Comment
comment on: http://stackoverflow.com/a/35621309
has text: As mentioned in one of the previous answer's comments by hac.jack there appears to be a bug with SwipeRefreshLayout. There's an inner method setRefreshing(boolean refreshing, boolean notify) that's called by setRefreshing(booling refreshing). The notify parameter is set to false by default therefore the the OnRefreshListener is never updated. This answer is correct to get the listener updated.
type: AnswerComment

http://stackoverflow.com/comment/55565198
has text: I have observed the same behaviour and agree with @Ceiling-Gecko, the max attribute on DefaultRolloverStrategy apprently applies only to the iterator and the iterator only iterates when the remaining file name is repeated, therefore it doesn't seem possible to me to auto-remove old log files when the names are different. Nonetheless, it is really odd that this functionality does not exist when the API is so largelly used for so many people...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24551768
score: 1

http://stackoverflow.com/q/24500718
score: 0
tagged with: android
has body: I've searched everywhere for an answer to this dilemma. A CountDownTimer(bsCountDownTimer) will not start when it should. When I click the button, it is supposed to begin the onTick(), correct? However, only after I navigate to a different activity and navigate backwards using the UP button, or exit the app or destroy it and restart it does the onTick() start updating the text and sending information to LogCat like it is told to do. My best guess is that this problem is exclusive to either the CDT sub-class, onBsButtonClick(), onCreate(), or possible onResume()/onPause(). Here is some of the source code. public class HomeActivity extends Activity { @SuppressLint("NewApi") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home); if(bsTimeStamp!=0){bsIsRunning=true;} if(bsTimeStamp==0){bsIsRunning=false;} lastFed=(TextView)findViewById(R.id.lastFedTextView); feedAt=(TextView)findViewById(R.id.feedAtTextView); daysText = (EditText)findViewById(R.id.editTextDays); hoursText = (EditText)findViewById(R.id.editTextHours); minutesText = (EditText)findViewById(R.id.editTextMinutes); daysText.setText(""); hoursText.setText(""); minutesText.setText(""); // get timeStamp and boolean from onFeedButtonClick() START final SharedPreferences prefs = this.getPreferences(Context.MODE_PRIVATE); feedClickTimeStamp = prefs.getLong("savedOnFeedClick", placeholder); bsTimeStamp = prefs.getLong("savedOnBsClick", bsProgress); bsPlaceholder = prefs.getLong("saved placeholder", bsPlaceholder); bsIsRunning = prefs.getBoolean("bs is running", bsIsRunning); progressbs = Long.toString(bsProgress); placeholderbs = Long.toString(bsPlaceholder); timestampbs = Long.toString(bsTimeStamp); timestamp = Long.toString(feedClickTimeStamp); LAST_FED = prefs.getString("lastFed", LAST_FED); FEED_AT = prefs.getString("feedAt", FEED_AT); feedAt.setText("Feed at: " + FEED_AT); lastFed.setText("Last fed at: " + LAST_FED); // get timeStamp and bo…
type: AnsweredQuestion
has title: Why won't CountDownTimer start onTick when it should?
tagged with: countdowntimer
type: Question
has answer: http://stackoverflow.com/a/24520218
tagged with: java
has comment: http://stackoverflow.com/comment/37930041
has comment: http://stackoverflow.com/comment/37930109
answer count: 1
accepted answer: http://stackoverflow.com/a/24520218

http://stackoverflow.com/a/24434927
has comment: http://stackoverflow.com/comment/37808360
has comment: http://stackoverflow.com/comment/37808907
has body: You can do it in a single regex: Pattern regex = Pattern.compile("(?&lt;=^.{0,10000}?(.{0,12}))(\\d+)(?=(.{0,12}))"); Matcher regexMatcher = regex.matcher(subjectString); while (regexMatcher.find()) { before = regexMatcher.group(1); match = regexMatcher.group(2); after = regexMatcher.group(3); } Explanation: (?&lt;= # Assert that the following can be matched before current position ^.{0,10000}? # Match as few characters as possible from the start of the string (.{0,12}) # Match and capture up to 12 chars in group 1 ) # End of lookbehind (\d+) # Match and capture in group 2: Any number (?= # Assert that the following can be matched here: (.*) # Match and capture up to 12 chars in group 3 ) # End of lookahead
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37808823
has comment: http://stackoverflow.com/comment/37809039
has comment: http://stackoverflow.com/comment/37808791
answers question: http://stackoverflow.com/q/24434642
has comment: http://stackoverflow.com/comment/37807721
has comment: http://stackoverflow.com/comment/37808473
has comment: http://stackoverflow.com/comment/37808033
upvote count: 2
has comment: http://stackoverflow.com/comment/37808992
has comment: http://stackoverflow.com/comment/37808584
has comment: http://stackoverflow.com/comment/37807819
has comment: http://stackoverflow.com/comment/37808147
type: Answer
has comment: http://stackoverflow.com/comment/37808095
has comment: http://stackoverflow.com/comment/37807143

http://stackoverflow.com/comment/100322856
has text: @Trunk the format of a comment is not sufficient to describe the details (more than my previous comment already did). You may read [this](https://www.infoq.com/articles/Java-8-Lambdas-A-Peek-Under-the-Hood/) and [that](https://cr.openjdk.java.net/~briangoetz/lambda/lambda-translation.html), if you are interested in more details. But the takeaway regarding your question is simple: there is no significant difference, so if you prefer method references, go for it. Just don’t try to bend code towards using them excessively, i.e. when a lambda is much simpler, don’t stay away from using it.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24487805
type: QuestionComment

http://stackoverflow.com/q/24430436
favorite count: 0
has answer: http://stackoverflow.com/a/24493875
accepted answer: http://stackoverflow.com/a/24430640
has title: Fetching Nested JSON in Couchbase lite in Android
has body: I have a nested JSON as follows which I want to store and fetch from couchbase lite in android { "sensor":"12" , "patient":"2", "readings": {"5090":"100" , "5092":"100"} } I want to fetch value corresponding to key 5090 from my couchbase I am able to fetch the entire Document in couchbase using retrievedDocument.getProperties() as {_rev=1-7881f65efdcd0c119b936d4d3a734d42, sensor=12, readings={5090=100, 5092=100}, patient=2, _id=6482cee3-4267-459e-8039-860dbb5d1318} I am also able to get the nested json corresponding to the key "readings" by retrievedDocument.getProperty("readings") as {5090=100, 5092=100} now I need to fetch the value(100) corresponding to the nested key 5090 (inside readings) I tried following in Java retrievedDocument.getProperty("readings['5090']") retrievedDocument.getProperty("readings[\"5090\"]") retrievedDocument.getProperty("readings.5090") retrievedDocument.getProperty("readings[5090]") but all of them returns null
tagged with: couchbase
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24430640
downvote count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24493875

http://stackoverflow.com/comment/37819642
type: Comment
has text: No it does not.
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/24441614

spring-aop
tags question: http://stackoverflow.com/q/24489430
tags question: http://stackoverflow.com/q/24545702
tags question: http://stackoverflow.com/q/24515760
tags question: http://stackoverflow.com/q/24533098
tags question: http://stackoverflow.com/q/24447383
tag name: spring-aop
type: Tag

http://stackoverflow.com/a/24531232
has body: If you can use this: https://play.google.com/store/apps/details?id=usbwebcam.application&amp;hl=en You need to install soft from http://www.placaware.com/ on your pc too.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24531118
type: Answer
answers question: http://stackoverflow.com/q/24531118

http://stackoverflow.com/comment/37967248
comment on: http://stackoverflow.com/q/24520620
type: Comment
type: QuestionComment
has text: @Wamlab - Oh ... and read the link I posted above. It is intended to be helpful.
score: 0

http://stackoverflow.com/q/24449184
answer count: 1
has title: Which regular expression or pattern should be used to grab following contents from the text file?
has answer: http://stackoverflow.com/a/24460143
has comment: http://stackoverflow.com/comment/37837343
favorite count: 0
tagged with: pattern-matching
type: UnansweredQuestion
downvote count: 1
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37834479
has body: I need to split text starting from "9=DEXTER" upto the next "9=DEXTER". How to write pattern regex for it in java. using end of the line doesnt works since some phrase merged with the previouse phrase line. 9=DEXTER.1.19=14161035=X49=PARFX56=c3_user134=847152=20130408-22:27:59.606262=aquru2D00000016268=1618279=2269=055=USD/JPY270=27426.89271=01023=35336=3346=0273=22:27:22.935279=0269=055=USD/JPY270=27386.32271=460000001023=489336=3346=1273=22:27:22.9358722=0279=2269=055=USD/JPY270=27388.25271=01023=472336=3346=0273=22:27:22.935279=0269=055=USD/JPY270=27429.08271=440000001023=7336=3346=1273=22:27:22.9358722=0279=0269=055=USD/JPY270=27410.08271=440000001023=233336=3346=1273=22:27:22.9368722=0279=2269=055=USD/JPY270=27375.1271=01023=635336=3346=0273=22:27:23.013279=0269=0279=2269=055=USD/JPY270=27429.01271=01023=9336=3346=0273=22:27:23.015279=0269=055=USD/JPY270=27377.79271=410000001023=599336=3346=1273=22:27:23.0158722=0279=2269=055=USD/JPY270=27372.1271=01023=679336=3346=0273=22:27:23.019279=0269=055=USD/JPY270=27363.78271=480000001023=799336=3346=1273=22:27:23.0198722=0279=2269=055=USD/JPY270=27403.94271=01023=299336=3346=0273=22:27:23.019279=0269=055=USD/JPY270=27418.77271=440000001023=119336=3346=1273=22:27:23.0198722=0279=2269=055=USD/JPY270=27379.15271=01023=587336=3346=0273=22:27:23.019279=0269=055=USD/JPY270=27396.59271=410000001023=377336=3346=1273=22:27:23.0198722=0279=0269=055=USD/JPY270=27415.88271=470000001023=153336=3346=1273=22:27:23.0198722=0279=1269=055=USD/JPY270=27376.14271=460000001023=625336=3346=1273=22:27:23.0198722=0279=0269=055=USD/JPY270=27410.47271=950000001023=234336=3346=2273=22:27:23.0198722=0279=2269=055=USD/JPY270=27402.08271=01023=323336=3346=0273=22:27:23.019279=1269=055=USD/JPY270=27366.49271=880000001023=762336=3346=2273=22:27:23.0198722=0279=2269=055=USD/JPY270=27374.05271=01023=658336=3346=0273=22:27:23.019279=1269=055=USD/JPY270=27411.14271=850000001023=225336=3346=2273=22:27:23.0198722=0279=2269=055=USD/JPY270=27396.3271=01023=3…
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/37839020

http://stackoverflow.com/comment/37912620
comment on: http://stackoverflow.com/q/24491256
score: 0
type: QuestionComment
has text: If you have to look through it a lot sort it and put in a tree, though I don't think there's a standard implementation
type: Comment

padding
tags question: http://stackoverflow.com/q/24515981
tag name: padding
type: Tag

object
tags question: http://stackoverflow.com/q/24526962
tag name: object
tags question: http://stackoverflow.com/q/24518448
tags question: http://stackoverflow.com/q/24534670
tags question: http://stackoverflow.com/q/24493130
tags question: http://stackoverflow.com/q/24527687
tags question: http://stackoverflow.com/q/24582928
tags question: http://stackoverflow.com/q/24584258
tags question: http://stackoverflow.com/q/24556060
tags question: http://stackoverflow.com/q/24558674
tags question: http://stackoverflow.com/q/24467745
tags question: http://stackoverflow.com/q/24520421
tags question: http://stackoverflow.com/q/24484037
tags question: http://stackoverflow.com/q/24499338
tags question: http://stackoverflow.com/q/24532167
tags question: http://stackoverflow.com/q/24538333
tags question: http://stackoverflow.com/q/24543594
tags question: http://stackoverflow.com/q/24457175
tags question: http://stackoverflow.com/q/24439196
tags question: http://stackoverflow.com/q/24436466
tags question: http://stackoverflow.com/q/24454439
tags question: http://stackoverflow.com/q/24537993
tags question: http://stackoverflow.com/q/24483985
tags question: http://stackoverflow.com/q/24537871
type: Tag
tags question: http://stackoverflow.com/q/24514516

http://stackoverflow.com/comment/37961164
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24484915
has text: @CommuSoft after little tweaking I think `[edit2]` is final. [76 ns] runtime.
type: Comment

http://stackoverflow.com/a/24535371
has comment: http://stackoverflow.com/comment/37993538
has comment: http://stackoverflow.com/comment/37993854
answers question: http://stackoverflow.com/q/24535303
downvote count: 1
has comment: http://stackoverflow.com/comment/37993397
has comment: http://stackoverflow.com/comment/37993328
type: Answer
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/37993444
has body: remove this: contentType : 'application/json; charset=utf-8', because your content type is plain text from the begining: System.out.println("Post"); That contentType will work only if the content is json.
has comment: http://stackoverflow.com/comment/37993256

http://stackoverflow.com/a/24550131
downvote count: 0
answers question: http://stackoverflow.com/q/24547173
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38127275
type: Answer
score: 3
upvote count: 3
has body: The connection with database works correctly? if yes, see this tutorial: Here will explain step by step how to create dependent combobox. That's how I learned, and works perfectly. Try it and dont forget to give feedback
accepted answer of: http://stackoverflow.com/q/24547173

http://stackoverflow.com/comment/139515747
type: QuestionComment
comment on: http://stackoverflow.com/q/24541786
score: 0
type: Comment
has text: Seems like readability has a cost on debugging to me! (IMO - even readability is not that great with Lambdas and streams!)

http://stackoverflow.com/q/24439040
answer count: 0
type: UnansweredQuestion
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/37856059
downvote count: 0
tagged with: opengl
score: 1
has comment: http://stackoverflow.com/comment/37856256
tagged with: java
tagged with: collision-detection
type: Question
has comment: http://stackoverflow.com/comment/37856492
tagged with: 3d
has comment: http://stackoverflow.com/comment/37856618
has title: Collision between player and heightmap
has body: Im programming a small project, an opengl height map. It is build of triangles, which points are fit to the right y position (read out of an image). The player is represanted by a cuboid. (p1, p2, ... p8). now, i want to implement collision detection between the player and the heightmap. I thought about split the whole world in cubes, and this cubes again in cubes, and then distribute the triangles of the heightmap in this cubes (then check for the big cube, the smaller cube, which contains the player, and then check all triangles for collision). But which collision detection method would be the best here, and how could i implement it? (By the way, im using lwjgl [java])
has comment: http://stackoverflow.com/comment/37855665
has comment: http://stackoverflow.com/comment/37815550
upvote count: 1
has comment: http://stackoverflow.com/comment/37922860
has comment: http://stackoverflow.com/comment/37907488
has comment: http://stackoverflow.com/comment/37882858
favorite count: 0

http://stackoverflow.com/q/24464947
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24465558
upvote count: 3
score: 1
tagged with: java
has body: Could you help me understand what is written below. This is from Thinking in Java book. Because you are composing a new class from existing classes, this concept is called composition(if the composition happens dynamically, it's usually called aggregation). Composition is often referred to as a "has-a" relationship, as in "A car has an engine." Composition comes with a great deal of flexibility. The member objects of your new class are typically private, making them inaccessible to the client programmers who are using the class. This allows you to change those members without disturbing existing client code. You can also change the member objects at runtime, to dynamically change the behavior of your program. Inheritance, which is described next, does not have this flexibility since the compiler must place compile-time restrictions on classes created with inheritance. Because inheritance is so important in object-oriented programming, it is often highly emphasized, and the new programmer can get the idea that inheritance should be used everywhere. This can result in awkward and overly complicated designs. Instead, you should first look to composition when creating new classes, since it is simpler and more flexible. Without examples I can't grab this jelly. Could you provide me with examples of: Aggregation, that is composition happening dynamically. Inheritance facing compile-time restrictions. I mean that I'm looking for examples revealing advantages of composition over inheritance. Added later: I need examples of code (not description).
possible better answer: http://stackoverflow.com/a/24465106
type: Question
has title: Composition vs inheritance (how to understand Thinking in Java)
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37862637
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/24465106
accepted answer: http://stackoverflow.com/a/24465558

android-intent
tags question: http://stackoverflow.com/q/24561855
tags question: http://stackoverflow.com/q/24578523
tags question: http://stackoverflow.com/q/24450817
tags question: http://stackoverflow.com/q/24564310
tags question: http://stackoverflow.com/q/24505517
tags question: http://stackoverflow.com/q/24507466
tags question: http://stackoverflow.com/q/24441851
tags question: http://stackoverflow.com/q/24515120
tags question: http://stackoverflow.com/q/24491995
tags question: http://stackoverflow.com/q/24485012
tags question: http://stackoverflow.com/q/24541702
type: Tag
tags question: http://stackoverflow.com/q/24536375
tag name: android-intent
tags question: http://stackoverflow.com/q/24443240
tags question: http://stackoverflow.com/q/24474102
tags question: http://stackoverflow.com/q/24491300
tags question: http://stackoverflow.com/q/24544092
tags question: http://stackoverflow.com/q/24468366
tags question: http://stackoverflow.com/q/24490309
tags question: http://stackoverflow.com/q/24455922

http://stackoverflow.com/a/24481991
score: 0
answers question: http://stackoverflow.com/q/24481937
type: Answer
has body: Well, a two dimensional array is an array of arrays. So String[3][2] is [["string", "string"], ["string", "string"], ["string", "string"]] states.length is the length of the outer array, which is 3. states[i].length is the length of each individual array, which are all 2.

http://stackoverflow.com/comment/129902585
type: Comment
has text: This related [example](https://stackoverflow.com/a/73528614/230513) uses the approach illustrated in this recent [answer](https://stackoverflow.com/a/52719989/230513).
comment on: http://stackoverflow.com/q/24448002
score: 0
type: QuestionComment

http://stackoverflow.com/q/24491191
tagged with: grails
tagged with: groovy
has body: I upgrade to Grails 2.4.2 because that supposedly fixes a bug with the maven plugin that caused it to generate a bad pom.xml file. Now, when I try to run the 2.4.2-generated pom with mvn clean install I get the following error message: [ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.4.2:maven-compile (default-maven-compile) on project PROJECT : Failed to create classpath for Grails execution. Failure to find org.codehaus.groovy:groovy-all:jar:2.4.2 in https://REPO was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1] Groovy 2.4.2 obvious doesn't exist since 2.3.X is the latest release. How do I force the maven plugins to take 2.3.2's groovy-all package as the dependency to use for Groovy?
answer count: 1
favorite count: 0
score: 6
tagged with: maven
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24508001
tagged with: java
type: Question
has title: Grails maven plugin wants Groovy 2.4.2
has answer: http://stackoverflow.com/a/24508001
upvote count: 6
has comment: http://stackoverflow.com/comment/37920925

http://stackoverflow.com/q/24505034
has answer: http://stackoverflow.com/a/24505385
accepted answer: http://stackoverflow.com/a/24505385
score: 0
has comment: http://stackoverflow.com/comment/37937253
answer count: 1
has comment: http://stackoverflow.com/comment/37937504
has comment: http://stackoverflow.com/comment/37937286
has comment: http://stackoverflow.com/comment/37937644
tagged with: ftp
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37938417
has comment: http://stackoverflow.com/comment/37937572
has title: how to access or show the list of file available on ftp server in java
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37937857
tagged with: servlets
has body: I want to show list of file which is available on ftp server i am working with some demo ftp server but it is not working it is showing some error , I have to get list of all file available on ftp server here is code public class getFTPfileList { public static void main(String[] args) { FTPClient client = new FTPClient(); try { client.connect("ftp.javacodegeeks.com"); client.login("username", "password"); FTPFile[] files = client.listFiles(); for (FTPFile ftpFile : files) { if (ftpFile.getType() == FTPFile.FILE_TYPE) { System.out.println("File: " + ftpFile.getName() + "size-&gt; " + FileUtils.byteCountToDisplaySize(ftpFile .getSize())); } } client.logout(); } catch (IOException e) { e.printStackTrace(); } finally { try { client.disconnect(); } catch (IOException e) { e.printStackTrace(); } } } } The error message showing: java.net.UnknownHostException: ftp.javacodegeeks.com at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) at java.net.InetAddress.getAddressesFromNameService(Unknown Source) at java.net.InetAddress.getAllByName0(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getAllByName(Unknown Source) at java.net.InetAddress.getByName(Unknown Source) at org.apache.commons.net.SocketClient.connect(SocketClient.java:184) at org.apache.commons.net.SocketClient.connect(SocketClient.java:273) at com.journaldev.servlet.getFTPfileList.main(getFTPfileList.java:21)

http://stackoverflow.com/comment/37954407
type: QuestionComment
comment on: http://stackoverflow.com/q/24501324
has text: Very very confusing answer. Where are you talking about? Be clear. There is one or there are more browsers on your phone. And you have your app on your phone. In above answer you do not use the word 'browser' and you are also not using 'my app'. So I don't know what you ment. Please rephrase.
score: 0
type: Comment

http://stackoverflow.com/comment/37985733
has text: When i checked with System.getProperty("sun.arch.data.model") it says 32 Bit. Thanks I shall download 64 bit and try it out
comment on: http://stackoverflow.com/a/24531229
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24646289
score: 1
answers question: http://stackoverflow.com/q/24496671
downvote count: 0
type: Answer
upvote count: 1
has body: I would Wrap the call in an IllegalStateException, run it through the debugger and see what you get. Things to try Set the boolean isPlaying=mp.isPlaying(); and check its value. Try a mp.reset() before starting and see if it works. Implement MediaPlayer.OnErrorListener and register the method with the media player. See what error you get. This might be helpful.

http://stackoverflow.com/comment/38073029
type: Comment
comment on: http://stackoverflow.com/a/24574989
has text: @ChrisWalsh Is something missing from my sample or explanation which preventing you from tagging as answered? I'd happily expand my answer if necessary.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24571383
has body: I think you can still use a Json parsing. Parse and manipulate th value like a Json object and then modify your string to apply all the back slashes. For example with Gson you can do like import java.util.HashMap; import java.util.Map; import com.google.gson.Gson; public class TenWords { public static void main(String[] args) throws Exception { String json = " { \"Name1\":\"Value1\",\"Name2\":\"Value2\",\"Name3\":\"Value3\" } "; Map&lt;String, String&gt; obj = new HashMap&lt;String, String&gt;(); Gson gson = new Gson(); obj = gson.fromJson(json, obj.getClass()); obj.put("Name2", "NewValue"); System.out.println(gson.toJson(obj).replaceAll("\"","\\\\\"")); } } Output {\"Name3\":\"Value3\",\"Name1\":\"Value1\",\"Name2\":\"NewValue\"} The only problem is the order of name-value pair wont be maintained, but since your server is treating this as a Json it should be a problem.
answers question: http://stackoverflow.com/q/24570807
score: 0
type: Answer

eclipselink
tags question: http://stackoverflow.com/q/24477889
type: Tag
tags question: http://stackoverflow.com/q/24509224
tags question: http://stackoverflow.com/q/24472054
tags question: http://stackoverflow.com/q/24547830
tags question: http://stackoverflow.com/q/24452376
tags question: http://stackoverflow.com/q/24434931
tags question: http://stackoverflow.com/q/24485070
tags question: http://stackoverflow.com/q/24560085
tag name: eclipselink

http://stackoverflow.com/a/24483384
downvote count: 0
answers question: http://stackoverflow.com/q/24481533
has body: As you are using PrintWriter, which swallows I/O exceptions, you need to call checkError() after each write to see if an error has occurred.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24481533
type: AcceptedAnswer

http://stackoverflow.com/comment/37801870
type: Comment
has text: Could you add a main with the issue? I don't see the problem so I think I don't get your question. If WAP and COL extends Platform you could have a collection of Platform objects and call obj.matchFound(input)... something like Platform[] platforms= {new WAP(),new COL()}; for each(platform:platforms){platform.matchFound("some string")}
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24431409

http://stackoverflow.com/a/24578949
has comment: http://stackoverflow.com/comment/38085299
type: AcceptedAnswer
downvote count: 0
has body: Read out both columns into some data structure: class TableX { List&lt;?&gt; firstColVals; List&lt;?&gt; secondColVals; } Then, after you done with first step, which needs values from both columns, simply do TableX tableVals = readTable(); // your usual while (rs.next()) { ... } firstStep(tableVals); tableVals.secondColVals = null; // now unneeded data can be freed by GC secondStep(tableVals.firstColVals);
has comment: http://stackoverflow.com/comment/38076135
type: Answer
has comment: http://stackoverflow.com/comment/38075198
answers question: http://stackoverflow.com/q/24578904
has comment: http://stackoverflow.com/comment/38147847
has comment: http://stackoverflow.com/comment/38076345
has comment: http://stackoverflow.com/comment/38083784
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24578904
score: 1
has comment: http://stackoverflow.com/comment/38085639

http://stackoverflow.com/q/24482107
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@67a781cc
tagged with: java
tagged with: hibernate
has body: My c3p0 configuration is as following , and at times I receive the following error messages in my console. Why am I receiving this? 5 100 300 50 3000 thread org.hibernate.cache.NoCacheProvider Hibernate Configuration private static SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { System.err.println("in session Facotry"); Configuration configuration = new Configuration(); return configuration.configure().buildSessionFactory( new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()) .build()); } catch (HibernateException ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } Error INFO: WARN - Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@67a781cc 30 Jun 2014 11:57:59java.lang.IllegalStateException: This web container has not yet been started at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1652) at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611) at com.mchange.v2.c3p0.stmt.GooGooStatementCache.synchronousDestroyStatement(GooGooStatementCache.java:413) at com.mchange.v2.c3p0.stmt.GooGooStatementCache.closeAll(GooGooStatementCache.java:351) at com.mchange.v2.c3p0.impl.NewPooledConnection.closeAllCachedStatements(NewPooledConnection.java:598) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:468) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
type: Question
has answer: http://stackoverflow.com/a/24489172
answer count: 1
downvote count: 0
tagged with: c3p0
tagged with: glassfish
favorite count: 0

http://stackoverflow.com/comment/37947785
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24510923
has text: can you please show what you are getting in reqURI??

http://stackoverflow.com/a/24488771
accepted answer of: http://stackoverflow.com/q/24488727
score: 3
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/24488727
type: AcceptedAnswer
has body: Take a look on the following utility methods: Collections.synchronizedCollection() Collections.synchronizedList() Collections.synchronizedSet() Collections.synchronizedMap()
type: Answer

http://stackoverflow.com/comment/37903641
score: 3
has text: The JDBCConnection is closed when you try to execute an SQL statement. Can you show the code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24486685

http://stackoverflow.com/q/24501324
has comment: http://stackoverflow.com/comment/37954009
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37954906
answer count: 0
score: 1
tagged with: java
tagged with: mysql
type: Question
has title: Error referencing a PHP script on a local server
downvote count: 0
has body: Following this tutorial: http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ But I'm modifying and adopting it for personal use. First lets start with the error: Error parsing data org.json.JSONException: Value create_product.php of type java.lang.String cannot be converted to JSONObject VM exiting with result code 0, cleanup skipped. ^the exit is merely because I put a simple if (jsonobject==null){System.exit(0);} Ruling things out: When I use "http://api.androidhive.info/android_connect/create_product.php" as my testURL instead of my own "ttp://192.168.1.8/HypeServer/android_connect/create_product.php" the json parses properly and replies not enough parameters - which is the proper output. In this scenario the only variable that appears to be changing is the server address - as that's literally the only line I have to change to go between a functioning module and a non-operational one. So I figure the problem is with my server configuration setup. My server is accessible from my laptop and another computer on the network. I copied the link exactly into my code. Running the php scripts also works using the gui even just not java code within android studio. I'm using my phone which is on the same wifi network as me and seems to be grabbing at least some form of data from my server it just doesn't seem to be running the script. Versions: LAMP - Ubuntu(14.04) - Apache(2.4.7) - MySQL(5.5.37) - PHP(5.5.9) I taught myself pretty much all of this so its quite possible I'm missing some huge obvious concept but I am just stumped. On another note if I'm doing something else that is very bad I'd love to know. Here's all relevant code: public class ServerConnectActivity extends ActionBarActivity{ // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jsonParser = new JSONParser(); // url to get all products list private static String url_create_user = "http://192.168.1.8/HypeServer/android_connect/create_product.php"…
tagged with: apache2
has comment: http://stackoverflow.com/comment/37954858
has comment: http://stackoverflow.com/comment/37937503
tagged with: android
has comment: http://stackoverflow.com/comment/37954407
has comment: http://stackoverflow.com/comment/37937556

http://stackoverflow.com/q/24511789
has comment: http://stackoverflow.com/comment/37951243
tagged with: java
score: 12
answer count: 2
has title: Generic type in getConstructors() in Class
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/37949192
accepted answer: http://stackoverflow.com/a/24513534
has comment: http://stackoverflow.com/comment/37949702
linked to: http://stackoverflow.com/q/2914571
type: AnsweredQuestion
tagged with: reflection
has comment: http://stackoverflow.com/comment/37952675
has answer: http://stackoverflow.com/a/24544138
has comment: http://stackoverflow.com/comment/37949317
type: Question
has body: In the generic class Class&lt;T&gt; the method getConstructors() has a return type with unknown generic type parameter instead of T. The reason for this is explainend in the javadoc. Note that while this method returns an array of Constructor&lt;T&gt; objects (that is an array of constructors from this class), the return type of this method is Constructor&lt;?&gt;[] and not Constructor&lt;T&gt;[] as might be expected. This less informative return type is necessary since after being returned from this method, the array could be modified to hold Constructor objects for different classes, which would violate the type guarantees of Constructor&lt;T&gt;[]. A colleague of mine and I have tried to understand that explanation. In our understanding they are basically saying that it is of unknown generic type, because some caller could put other Constructor objects into that array. Did we get that right? And if so, why would someone design an API this way. Wouldn't it be better to use the specific type and trust the programmer to use the array correctly? To us it sounds a little like "We are making a worse API because the programmer using it might try something stupid". Where lies our fallacy?
upvote count: 12
possible better answer: http://stackoverflow.com/a/24544138
has answer: http://stackoverflow.com/a/24513534

http://stackoverflow.com/comment/38091377
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24588056
has text: What are the full error messages you are getting? Have you imported `hasSize` and `hasProperty` using static imports?
type: QuestionComment

http://stackoverflow.com/comment/37966386
has text: I understand `System.gc()` only "suggests". According to my observation, the diagnostic MBean ALWAYS runs full GC. Either this is just coincidence, or the MBean has special code path.
type: QuestionComment
comment on: http://stackoverflow.com/q/24520879
score: 0
type: Comment

http://stackoverflow.com/a/24587766
downvote count: 0
type: Answer
has body: To find the number of occurences of a value, you can simply use a counter variable. Initialize it to 0 before the loop and increment it by 1 whenever you encounter the desired value in the array. To find the list of all indices that point to the desired value, you can simply use a Set&lt;Integer&gt; structure, the similar principle goes here: Initialize an empty set before the loop, then add the indices to this set within the loop if they point to the value in subject. After the loop, you will have a set of all indices pointing to your certain value and set.size() (which might be used as an alternative to "counter variable") will give you the number of occurrences of that value.
score: 1
answers question: http://stackoverflow.com/q/24587736
upvote count: 1

http://stackoverflow.com/q/24437784
has comment: http://stackoverflow.com/comment/37812647
linked to: http://stackoverflow.com/q/24434566
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37813775
has comment: http://stackoverflow.com/comment/37812644
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37812417
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24438023
tagged with: lockless
has comment: http://stackoverflow.com/comment/37814062
answer count: 3
has comment: http://stackoverflow.com/comment/37812348
has title: Does this implementation work for a Lock-less Thread Safe Lazy Singleton in Java?
upvote count: 0
has answer: http://stackoverflow.com/a/24438169
has answer: http://stackoverflow.com/a/24438160
favorite count: 0
type: UnansweredQuestion
tagged with: singleton
has comment: http://stackoverflow.com/comment/37812413
has comment: http://stackoverflow.com/comment/37814193
has comment: http://stackoverflow.com/comment/37813498
has comment: http://stackoverflow.com/comment/37812622
has comment: http://stackoverflow.com/comment/37812586
has comment: http://stackoverflow.com/comment/37840398
has comment: http://stackoverflow.com/comment/37830396
has body: This is what I have so far, am I going in the right direction? Aim is to use this in scenarios where one thread requires access to the singleton more frequently than other threads, hence lock-less code is desirable, I wanted to use atomic variables for practice. public final class ThreadSafeLazyCompareAndSwapSingleton { private ThreadSafeLazyCompareAndSwapSingleton(){} private static volatile ThreadSafeLazyCompareAndSwapSingleton instance; private final static AtomicBoolean atomicBoolean = new AtomicBoolean(false); public static ThreadSafeLazyCompareAndSwapSingleton getCASInstance(){ if (instance==null){ boolean obs = instance==null; while (!atomicBoolean.compareAndSet(true, obs == (instance==null))){ instance = new ThreadSafeLazyCompareAndSwapSingleton(); } } return instance; } }

http://stackoverflow.com/comment/37908307
type: Comment
type: QuestionComment
score: 0
has text: This post talks about log4j1, so this is not helpful.
comment on: http://stackoverflow.com/q/24489019

http://stackoverflow.com/a/24502327
has comment: http://stackoverflow.com/comment/37933178
has comment: http://stackoverflow.com/comment/38060758
downvote count: 0
has body: First of, you've not updated the position of the current cursor in the ResultSet, which means that it's pointing to nothing... You could use... if (rs.next()) { rs.updateString("user", user); rs.updateString("pass", pass); rs.updateRow(); } But this assumes two things... You have a database that supports updating values in the ResultSet and You want to update the existing values. To insert a value into the database, you should be using the INSERT command, for example... try(Connection conn = DriverManager.getConnection( "jdbc:ucanaccess://C:/Users/nevik/Desktop/databaseJava/Employee.accdb")) { try (PreparedStatement stmt = conn.prepareStatement("INSERT into Table2 (user, pass) VALUES (?, ?)") { stmt.setString(1, user); stmt.setString(2, pass); int rowsUpdated = stmt.executeUpdate(); } } catch(SQLException ex){ System.err.println("Error: "+ ex); } You might like to take some time to go over a basic SQL tutorial and the JDBC(TM) Database Access trail As a side note... You should not be storing passwords in Strings, you should keep them in char arrays and You should not be storing passwords in the database without encrypting them in some way
has comment: http://stackoverflow.com/comment/37933153
has comment: http://stackoverflow.com/comment/37933090
answers question: http://stackoverflow.com/q/24502234
has comment: http://stackoverflow.com/comment/37933040
type: Answer
has comment: http://stackoverflow.com/comment/38059015
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37933121
has comment: http://stackoverflow.com/comment/38059664

http://stackoverflow.com/q/24542487
has comment: http://stackoverflow.com/comment/38007365
has answer: http://stackoverflow.com/a/24542881
linked to: http://stackoverflow.com/q/3537706
has answer: http://stackoverflow.com/a/24542549
upvote count: 3
tagged with: java
tagged with: unicode-string
type: Question
type: AnsweredQuestion
score: 3
has body: I need to print a unicode literal string as an equivalent unicode character. System.out.println("\u00A5"); // prints ¥ System.out.println("\\u"+"00A5"); //prints \u0045 I need to print it as ¥ How can evaluate this string a unicode character ?
has comment: http://stackoverflow.com/comment/38007417
has title: Print unicode literal string as Unicode character
accepted answer: http://stackoverflow.com/a/24542549
has answer: http://stackoverflow.com/a/24542528
answer count: 3
has comment: http://stackoverflow.com/comment/38007247
downvote count: 0
favorite count: 0
tagged with: unicode-literals
tagged with: unicode-escapes
has comment: http://stackoverflow.com/comment/38007259
possible better answer: http://stackoverflow.com/a/24542881

swing
tags question: http://stackoverflow.com/q/24565475
tags question: http://stackoverflow.com/q/24549750
tags question: http://stackoverflow.com/q/24583305
tags question: http://stackoverflow.com/q/24471832
tags question: http://stackoverflow.com/q/24482863
tags question: http://stackoverflow.com/q/24538508
tags question: http://stackoverflow.com/q/24499977
tags question: http://stackoverflow.com/q/24511406
tags question: http://stackoverflow.com/q/24443247
tags question: http://stackoverflow.com/q/24574329
tags question: http://stackoverflow.com/q/24506561
tags question: http://stackoverflow.com/q/24580952
tags question: http://stackoverflow.com/q/24504013
tags question: http://stackoverflow.com/q/24446984
tags question: http://stackoverflow.com/q/24535607
tags question: http://stackoverflow.com/q/24578087
tags question: http://stackoverflow.com/q/24428218
tags question: http://stackoverflow.com/q/24488821
tags question: http://stackoverflow.com/q/24503393
tags question: http://stackoverflow.com/q/24497935
tags question: http://stackoverflow.com/q/24509189
tags question: http://stackoverflow.com/q/24496686
tags question: http://stackoverflow.com/q/24442672
tags question: http://stackoverflow.com/q/24441423
tags question: http://stackoverflow.com/q/24486734
tags question: http://stackoverflow.com/q/24521715
tags question: http://stackoverflow.com/q/24529471
tags question: http://stackoverflow.com/q/24582836
tags question: http://stackoverflow.com/q/24572867
tags question: http://stackoverflow.com/q/24428367
tags question: http://stackoverflow.com/q/24515976
tags question: http://stackoverflow.com/q/24537857
tags question: http://stackoverflow.com/q/24582315
tags question: http://stackoverflow.com/q/24505579
tags question: http://stackoverflow.com/q/24495459
tags question: http://stackoverflow.com/q/24432740
tags question: http://stackoverflow.com/q/24438373
tags question: http://stackoverflow.com/q/24564760
tags question: http://stackoverflow.com/q/24478296
tags question: http://stackoverflow.com/q/24552821
tags question: http://stackoverflow.com/q/24546847
tags question: http://stackoverflow.com/q/24543752
tags question: http://stackoverflow.com/q/24527793
tags question: http://stackoverflow.com/q/24520935
tags question: http://stackoverflow.com/q/24561953
tags question: http://stackoverflow.com/q/24499976
tags question: http://stackoverflow.com/q/24446042
tags question: http://stackoverflow.com/q/24545803
tags question: http://stackoverflow.com/q/24483719
tags question: http://stackoverflow.com/q/24472751
tags question: http://stackoverflow.com/q/24477111
tags question: http://stackoverflow.com/q/24492675
tags question: http://stackoverflow.com/q/24470281
tags question: http://stackoverflow.com/q/24486705
tags question: http://stackoverflow.com/q/24471562
tags question: http://stackoverflow.com/q/24469383
tags question: http://stackoverflow.com/q/24577069
tags question: http://stackoverflow.com/q/24489780
tags question: http://stackoverflow.com/q/24436607
tags question: http://stackoverflow.com/q/24561449
tags question: http://stackoverflow.com/q/24560778
tags question: http://stackoverflow.com/q/24500250
tags question: http://stackoverflow.com/q/24450384
tags question: http://stackoverflow.com/q/24567309
tags question: http://stackoverflow.com/q/24462052
type: Tag
tags question: http://stackoverflow.com/q/24472237
tags question: http://stackoverflow.com/q/24480237
tags question: http://stackoverflow.com/q/24567082
tags question: http://stackoverflow.com/q/24489808
tags question: http://stackoverflow.com/q/24551034
tags question: http://stackoverflow.com/q/24535526
tags question: http://stackoverflow.com/q/24471197
tags question: http://stackoverflow.com/q/24583071
tags question: http://stackoverflow.com/q/24499451
tags question: http://stackoverflow.com/q/24479604
tags question: http://stackoverflow.com/q/24509932
tags question: http://stackoverflow.com/q/24433512
tags question: http://stackoverflow.com/q/24457607
tags question: http://stackoverflow.com/q/24520931

http://stackoverflow.com/a/62406794
type: Answer
has body: Had the same issue. I solved it by putting the comment inside the root element. Not exactly the same, but I think acceptable.
score: 0
answers question: http://stackoverflow.com/q/24551962

http://stackoverflow.com/comment/56494394
comment on: http://stackoverflow.com/a/24433315
score: 0
type: AnswerComment
type: Comment
has text: It can really help for java 1.7. But maybe, you can notice, what should we choose for Java 1.6 and lower?

http://stackoverflow.com/q/24582836
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2531193
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38082027
tagged with: combobox
downvote count: 0
has title: Binding from database in swing combobox in java
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38082046
tagged with: mysql
tagged with: swing
type: Question
has body: I want to display distinct year in combo box in ascending order. But the output in combox appears to be repetitive, repetitive in the sense that it shows all the elements of the column of database but i want to show only the distinct data of the column . What am i doing wrong?? I have simply done simple database query before in php. I know it is simply but i am not being to address the query in right order, i guess. My code is as follows. /* * 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 my_ui; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; /** * * @author enjal */ @Entity @Table(name = "production", catalog = "data2", schema = "") @NamedQueries({ @NamedQuery(name = "Production.findAll", query = "SELECT p FROM Production p"), @NamedQuery(name = "Production.findByProductionId", query = "SELECT p FROM Production p WHERE p.productionId = :productionId"), @NamedQuery(name = "Production.findByCropId", query = "SELECT p FROM Production p WHERE p.cropId = :cropId"), @NamedQuery(name = "Production.findByLocationId", query = "SELECT p FROM Production p WHERE p.locationId = :locationId"), @NamedQuery(name = "Production.findByArea", query = "SELECT p FROM Production p WHERE p.area = :area"), @NamedQuery(name = "Production.findByProductionAmount", query = "SELECT p FROM Production p WHERE p.productionAmount = :productionAmount"), @NamedQuery(name = "Production.findByYieldAmount", query = "SELECT p FROM Production p WHERE p.yieldAmo…
upvote count: 1
has answer: http://stackoverflow.com/a/24584055
linked to: http://stackoverflow.com/q/3422516

http://stackoverflow.com/comment/38022620
comment on: http://stackoverflow.com/q/24550923
score: 3
has text: [duplicate](http://stackoverflow.com/q/15173681/1113392) . see [this answer](http://stackoverflow.com/a/15174060/1113392)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24453755
answer count: 2
has title: Google app engine cronjob 10 minitues limitation
has body: I have deployed &amp; Scheduled Fb data collection java web application on GAE using cron.xml. my application is collecting data and loading data to google cloud storage. One limitation of GAE which I found while implementing is the application window will be active through cron job only for 10 minutes. https://developers.google.com/appengine/docs/java/config/cron Data collection process requires more than 10 minutes to collect complete data. please suggest me some alternative options.and reference links to increase 10 minutes time limit. Thanks .
tagged with: cron
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24454092
tagged with: java
has answer: http://stackoverflow.com/a/24457130
type: Question
score: 0

http://stackoverflow.com/comment/38078947
type: Comment
comment on: http://stackoverflow.com/q/24580927
type: QuestionComment
score: 0
has text: Your question does not seem consistent. First it says that the string needs to have "at least one 'i' removed", but then in the example you include the word "with 0 'i's removed".

http://stackoverflow.com/comment/37902829
type: Comment
type: QuestionComment
has text: Now my `getFragmentManager().beginTransaction().add()` is getting an error, since the `add()` method needs a `Fragment` and I have a `android.support.v4.app.Fragment` like: `add(R.id.container, new PlaceholderFragment())`
score: 0
comment on: http://stackoverflow.com/q/24485819

http://stackoverflow.com/comment/37878834
score: 0
type: Comment
has text: you can ask this question in another thread..maybe someone can help
comment on: http://stackoverflow.com/a/24473112
type: AnswerComment

http://stackoverflow.com/q/24557989
has title: how does jvm enter in public static void main?
has comment: http://stackoverflow.com/comment/38036146
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24560202
has comment: http://stackoverflow.com/comment/38036040
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24558269
has answer: http://stackoverflow.com/a/24558676
has body: How can jvm enter in default class: class try1 { public static void main(String args[]) { ... } } In it how does JVM access this method? In packages, if a class is 'default' its public methods cant be accessed from outside the package, so how does jvm enter this class?
has comment: http://stackoverflow.com/comment/38035571
has comment: http://stackoverflow.com/comment/38036105
answer count: 3
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/24575816
has comment: http://stackoverflow.com/comment/38068668
has comment: http://stackoverflow.com/comment/38068991
score: 0
has answer: http://stackoverflow.com/a/24575941
has comment: http://stackoverflow.com/comment/38068751
favorite count: 0
has comment: http://stackoverflow.com/comment/38121513
has title: How to set classpath for multiple jars in command line?
type: UnansweredQuestion
has body: In this jars folder, I am having multiple jars. How to set classpath to all of these jars? C:/users/jars/***
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38069484
has comment: http://stackoverflow.com/comment/38068599
has comment: http://stackoverflow.com/comment/38068645
linked to: http://stackoverflow.com/q/219585
tagged with: java
has comment: http://stackoverflow.com/comment/38075394
tagged with: classpath
duplicate of: http://stackoverflow.com/q/219585
type: Question
answer count: 1
tagged with: jar

http://stackoverflow.com/q/24575934
has body: OneClass.addComponentsToPane(onePanel); pane.add(onePanel,c); TwoClass two=new TwoClass(); two.addComponentsToPane(twoPanel); pane.add(twoPanel,c); 1)Both class.method and object.method are working but what is the difference and(pros and cons?) where we have to use both 2)Where static variable and method is needed and where should be avoided.
tagged with: java
tagged with: jpanel
type: Question
possible better answer: http://stackoverflow.com/a/24575984
has answer: http://stackoverflow.com/a/24575984
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/24576107
answer count: 3
has answer: http://stackoverflow.com/a/24576071
favorite count: 0
downvote count: 2
has title: What is the difference between class.method and object.method in Java and what are its cons and pros
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24576107

http://stackoverflow.com/comment/38084664
has text: @Henry ,no it doesn't ,all the power appearances refer to the one inside WeaponCircle class, triple checked
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24584369
type: Comment

http://stackoverflow.com/q/24487033
has comment: http://stackoverflow.com/comment/37905224
has comment: http://stackoverflow.com/comment/37912336
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37910470
tagged with: tomcat7
tagged with: spring
type: Question
has answer: http://stackoverflow.com/a/45375920
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37908306
has title: SocketException in tomcat7 error log
score: 0
answer count: 1
tagged with: c3p0
has comment: http://stackoverflow.com/comment/37909804
has body: I found following warning in tomcat7-stderr.{date}.log file. My log file is filled with this log. Mon Jun 30 12:27:47 GMT+05:30 2014 WARN: Caught while disconnecting... ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Socket is not connected STACKTRACE: java.net.SocketException: Socket is not connected at java.net.Socket.shutdownInput(Unknown Source) at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2261) at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4697) at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1630) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:617) at com.mchange.v2.c3p0.impl.NewPooledConnection.closeMaybeCheckedOut(NewPooledConnection.java:247) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:607) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:1012) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:636) ** END NESTED EXCEPTION ** I searched a lot on net but no success. It seems about c3p0 connection pool. Why this Exception/Warn is logging? How to solve it? Some extra information I am using c3p0 for connection pooling. I am connecting to MySQL server using named PIPE. here is my c3p0 config. MINPOOLSIZE=10 ACQUIREINCREMENT=1 MAXPOOLSIZE=500 INITIALPOOLSIZE=10 NUMBERHELPERTHREAD=100 MAXIDLETIME=10 MAXSTATEMENT=20 MAXSTATEMENTPERCONNECTION=5 IDLECONNECTIONTESTPERIOD=120 ACQUIRERETRYATTEMPT=10 ACQUIRERETRYDELAY=100 AUTOCOMMITONCLOSE=false BREAKAFTERACQUIREFAILURE=false TESTCONNECTIONONCHECKOUT=true TESTCONNECTIONONCHECKIN=true

jpql
tags question: http://stackoverflow.com/q/24573877
tag name: jpql
type: Tag
tags question: http://stackoverflow.com/q/24539038

http://stackoverflow.com/q/24540373
has comment: http://stackoverflow.com/comment/38004798
has comment: http://stackoverflow.com/comment/38004111
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38005560
has title: OpenGL stencil (Clip Entity)
score: 1
tagged with: java
upvote count: 1
tagged with: andengine
type: Question
has comment: http://stackoverflow.com/comment/38004635
has answer: http://stackoverflow.com/a/24545952
accepted answer: http://stackoverflow.com/a/24545952
answer count: 1
downvote count: 0
tagged with: opengl-es
favorite count: 0
has comment: http://stackoverflow.com/comment/38005237
tagged with: opengl-es-2.0
has body: I am trying to use a sprite as clip-entity. This means I want that all it's child entities are clipped so that only the parts of the children that overlap the clip-entity (parent) are visible. I'm trying to do that using the OpenGL stencil function. On my emulator I got it working, but on my Android phone it doesn't. What am I doing wrong? GLES20.glEnable(GLES20.GL_STENCIL_TEST); GLES20.glClearStencil(0); GLES20.glStencilMask(1); GLES20.glClear(GLES20.GL_STENCIL_BUFFER_BIT); // pre draw GLES20.glStencilFunc(GLES20.GL_NEVER, 1, 1); GLES20.glStencilOp(GLES20.GL_REPLACE, GLES20.GL_KEEP, GLES20.GL_KEEP); // draw clip-entity (this) (sprite) this.draw(); // post draw GLES20.glStencilFunc(GLES20.GL_LESS, 2, 1); GLES20.glStencilOp(GLES20.GL_KEEP, GLES20.GL_KEEP, GLES20.GL_KEEP); // draw children of clip-entity (this) which should now be clipped this.drawChildren(); GLES20.glDisable(GLES20.GL_STENCIL_TEST);
tagged with: android

http://stackoverflow.com/a/24565199
type: Answer
downvote count: 0
has body: Bi-Directional Many to Many using user managed join table object (Relatively common) Commonly used when you want to store extra information on the join object such as the date the relationship was created. public class Foo{ private UUID fooId; @OneToMany(mappedBy = "bar", cascade=CascadeType.ALL) private List&lt;FooBar&gt; bars; } public class Bar{ private UUID barId; @OneToMany(mappedBy = "foo", cascade=CascadeType.ALL) private List&lt;FooBar&gt; foos; } @Entity @Table(name="FOO_BAR") public class FooBar{ private UUID fooBarId; @ManyToOne @JoinColumn(name = "fooId") private Foo foo; @ManyToOne @JoinColumn(name = "barId") private Bar bar; //You can store other objects/fields on this table here. }
score: 3
has comment: http://stackoverflow.com/comment/87645169
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24522090
answers question: http://stackoverflow.com/q/24522090

annotations
tags question: http://stackoverflow.com/q/24533056
type: Tag
tags question: http://stackoverflow.com/q/24548106
tags question: http://stackoverflow.com/q/24467092
tags question: http://stackoverflow.com/q/24455107
tags question: http://stackoverflow.com/q/24486144
tags question: http://stackoverflow.com/q/24487270
tags question: http://stackoverflow.com/q/24431960
tags question: http://stackoverflow.com/q/24568652
tags question: http://stackoverflow.com/q/24475706
tags question: http://stackoverflow.com/q/24487865
tags question: http://stackoverflow.com/q/24429478
tags question: http://stackoverflow.com/q/24495448
tag name: annotations
tags question: http://stackoverflow.com/q/24524716
tags question: http://stackoverflow.com/q/24451372
tags question: http://stackoverflow.com/q/24552348
tags question: http://stackoverflow.com/q/24436067

http://stackoverflow.com/q/24476586
answer count: 1
has answer: http://stackoverflow.com/a/24476730
accepted answer: http://stackoverflow.com/a/24476730
tagged with: foreach
type: AnsweredQuestion
tagged with: java
has body: I would like to print by using JSTL a list of hours values. I have though to use foreach in this way &lt;select&gt; &lt;c:forEach begin="0" end="23" var="hour"&gt; &lt;option value="${hour}"&gt;${hour}&lt;/option&gt; &lt;/c:forEach&gt; &lt;/select&gt; But I get values like 0 1 2, instead I would like to get values like 00 01 02 03 and so on.Does it exist a way to achieve this by using foreach?
has title: Print in JSTL by using foreach hours values
type: Question
tagged with: jstl
score: 0

http://stackoverflow.com/a/24438617
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37814416
has comment: http://stackoverflow.com/comment/37814276
upvote count: 3
has body: You may use the following code snippet to add and array of customized classes of JButton. You may edit it as per your needs. import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * A JList of JButtons. */ public class JButtonListDemo implements Runnable { private JList jlist; public static void main(String args[]) { SwingUtilities.invokeLater(new JButtonListDemo()); } public void run() { Object[] items = new ButtonItem[] { new ButtonItem("Apple"), new ButtonItem("Banana"), new ButtonItem("Carrot"), new ButtonItem("Date"), new ButtonItem("Eggplant"), new ButtonItem("Fig"), new ButtonItem("Guava"), }; jlist = new JList(items); jlist.setCellRenderer(new ButtonListRenderer()); jlist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jlist.setVisibleRowCount(5); jlist.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { clickButtonAt(event.getPoint()); } }); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new JScrollPane(jlist)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private void clickButtonAt(Point point) { int index = jlist.locationToIndex(point); ButtonItem item = (ButtonItem) jlist.getModel().getElementAt(index); item.getButton().doClick(); // jlist.repaint(jlist.getCellBounds(index, index)); } public class ButtonItem { private JButton button; public ButtonItem(String name) { this.button = new JButton(name); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println(button.getText() + " was clicked."); } }); } public JButton getButton() { return button; } @Override public String toString() { return button.getText(); } } class ButtonListRenderer extends JButton implements ListCellRenderer { public Component getListCellRendererComponent(JList comp, Object value, int index, boolean isSelected, boolean hasFocus) { setEnabled(comp.isEnabled()); setFont(c…
answers question: http://stackoverflow.com/q/24438373

http://stackoverflow.com/q/24462052
linked to: http://stackoverflow.com/q/14574045
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/37857173
type: AnsweredQuestion
has body: Could someone please tell me why my code does not work Properly? I am trying to make the colour change when I move over it but its just not working. I'm using the intersects method. package com.dilkiel.game; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; import javax.swing.ImageIcon; import javax.swing.JPanel; public class Screen extends JPanel implements Runnable { private static final long serialVersionUID = 1L; private Thread thread; public int tickCount = 0; public boolean running = false; public int xPlayerOffset = 100; public int yPlayerOffset = 100; public int WIDTH = 1280; public int HEIGHT = 720; public InputHandler input = new InputHandler(this); public Screen() { setFocusable(true); setMaximumSize(new Dimension(WIDTH, HEIGHT)); setMinimumSize(new Dimension(WIDTH, HEIGHT)); setPreferredSize(new Dimension(WIDTH, HEIGHT)); start(); } public void tick() { tickCount++; if (input.up.isPressed()) { yPlayerOffset -= 5; } if (input.down.isPressed()) { yPlayerOffset += 5; } if (input.left.isPressed()) { xPlayerOffset -= 5; } if (input.right.isPressed()) { xPlayerOffset += 5; } } public synchronized void start() { running = true; thread = new Thread(this, "Game Loop"); thread.start(); } public synchronized void stop() { running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } Image frontView = new ImageIcon("res/frontView.png").getImage(); Rectangle player = new Rectangle(xPlayerOffset, yPlayerOffset + 40, 40, 40); Rectangle box = new Rectangle(250, 250, 80, 80); public void paint(Graphics g) { g.setColor(Color.CYAN); g.fillRect(0, 0, WIDTH, HEIGHT); g.drawImage(frontView, xPlayerOffset, yPlayerOffset, this); g.setColor(Color.BLACK); if (player.intersects(box)) { //i want this to work can you please show me how. Thanks g.setColor(Color.GREEN); } g.fillRect(xPlayerOffset, yPlayerOffset + 40, 40, 40); g.fillRect(250, 250, 80, 80); g.dispose(); } publ…
has comment: http://stackoverflow.com/comment/37857389
type: Question
has answer: http://stackoverflow.com/a/24464339
possible better answer: http://stackoverflow.com/a/24462111
has answer: http://stackoverflow.com/a/24462111
favorite count: 0
score: 0
answer count: 2
upvote count: 1
tagged with: swing
downvote count: 1
accepted answer: http://stackoverflow.com/a/24464339
has title: Java intersects method not working Properly
tagged with: java

http://stackoverflow.com/a/24500820
has body: You can set the @XmlJavaTypeAdapter at the package level and have it apply to all mapped fields/properties in domain classes in that package. This is done on a special package-info class.
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24499783
type: Answer
answers question: http://stackoverflow.com/q/24499783
downvote count: 0
score: 1

http://stackoverflow.com/a/24451443
upvote count: 1
score: 1
has body: Yes, of course. Your question is unclear, but I think this does what you want: if(x == arr.length-1 || x &gt; 0) sb.append(arr[x]); else sb.append(-arr[x]); - cancels itself out. -(-5) is just 5. Alternatively: (this might or might not be easier to understand for you) if(x == arr.length-1) sb.append(arr[x]); else sb.append(Math.abs(arr[x])); Math.abs is a method that makes sure a number isn't negative - if the number you give it is positive or zero, it returns it. If the number you give it is negative, it returns the positive version. Alternatively: sb.append((x == arr.length - 1) ? arr[x] : Math.abs(arr[x])); This is just "shorthand" for the previous suggestion.
downvote count: 0
answers question: http://stackoverflow.com/q/24451296
type: Answer

spring-security
tags question: http://stackoverflow.com/q/24535164
tags question: http://stackoverflow.com/q/24446783
tags question: http://stackoverflow.com/q/24533385
tags question: http://stackoverflow.com/q/24492835
tags question: http://stackoverflow.com/q/24577091
tags question: http://stackoverflow.com/q/24439335
type: Tag
tags question: http://stackoverflow.com/q/24429788
tags question: http://stackoverflow.com/q/24469706
tags question: http://stackoverflow.com/q/24575794
tags question: http://stackoverflow.com/q/24570108
tags question: http://stackoverflow.com/q/24488943
tags question: http://stackoverflow.com/q/24554255
tags question: http://stackoverflow.com/q/24431540
tags question: http://stackoverflow.com/q/24428009
tags question: http://stackoverflow.com/q/24560635
tags question: http://stackoverflow.com/q/24474171
tags question: http://stackoverflow.com/q/24561304
tags question: http://stackoverflow.com/q/24585075
tags question: http://stackoverflow.com/q/24511812
tags question: http://stackoverflow.com/q/24544882
tags question: http://stackoverflow.com/q/24530603
tag name: spring-security

http://stackoverflow.com/comment/37979282
comment on: http://stackoverflow.com/q/24527767
type: Comment
type: QuestionComment
has text: Look at my ans here : http://stackoverflow.com/questions/24128346/getting-rotation-from-exifinterface-always-returns-0/24219714#24219714
score: 0

http://stackoverflow.com/comment/37914572
comment on: http://stackoverflow.com/a/24491876
type: AnswerComment
has text: That's right - I did not realize your fragment class is static. In that case you cannot access it as I described above. Do you need to keep it as an inner class? If you just move it to its own file as a regular public class (not static) you can access its methods directly. Otherwise you can use an interface to connect the static inner class to your outer activity.
score: 0
type: Comment

http://stackoverflow.com/comment/38376698
type: AnswerComment
comment on: http://stackoverflow.com/a/24660238
score: 0
has text: Elder versions of Hibernate do definitely support it (but may be newer). There are many ways to open a transactions, between them is that with @Transactional, in which case one transaction is opened automatically for you (if that is an public method). Did you try with Hibernate or EclipseLink?
type: Comment

http://stackoverflow.com/comment/37886299
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24477301
type: AnswerComment
has text: It gave me an error -- button1 = (Button) findViewById(R.id.abus); button2 = (Button) findViewById(R.id.weoff); button1.setOnClickListener(new OnClickListener() { button2.setOnClickListener(new OnClickListener() {

http://stackoverflow.com/comment/37831518
has text: See also [*Initial Threads*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24448031
type: Comment

http://stackoverflow.com/comment/37921343
has text: Can you make an example of lazy initialization?
comment on: http://stackoverflow.com/a/24496061
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24544017
has body: The Java language specification states A break statement with label Identifier attempts to transfer control to the enclosing labeled statement (§14.7) that has the same Identifier as its label; this statement, which is called the break target, then immediately completes normally. The statement here is actually a block statement. Once you break, that block ends. So, no, the for loop should not iterate again since it's inside the block that just ended.
type: Answer
answers question: http://stackoverflow.com/q/24543955
score: 0

http://stackoverflow.com/a/24535501
score: 4
accepted answer of: http://stackoverflow.com/q/24535372
has body: To convert two ints (containing double data) into a double, you don't need a temporary buffer. You can do this: long doubleBits = my_int_x &amp; 0xFFFFFFFFL; doubleBits &lt;&lt;= 32; doubleBits |= my_int_y &amp; 0xFFFFFFFFL; double myDouble = Double.longBitsToDouble(doubleBits); However, check how you are reading my_int_x and my_int_y in your Java program. Maybe you can get a double directly at that moment (ideally, you should).
has comment: http://stackoverflow.com/comment/37994109
type: Answer
answers question: http://stackoverflow.com/q/24535372
upvote count: 4
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24475366
has body: You can try the below example code to use ObjectOutputStream in Java in order to write it in the file : import java.io.Serializable; public class Person implements Serializable { private String firstName; private String lastName; private int age; public Person() { } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } //Overriding toString to be able to print out the object in a readable way //when it is later read from the file. public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(firstName); buffer.append("\n"); buffer.append(lastName); buffer.append("\n"); buffer.append(age); buffer.append("\n"); return buffer.toString(); } } This is the code for creating instances of the Person class and writing them to an ObjectOuputStream: import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { /** * Example method for using the ObjectOutputStream class */ public void writePersons(String filename) { ObjectOutputStream outputStream = null; try { //Construct the LineNumberReader object outputStream = new ObjectOutputStream(new FileOutputStream(filename)); Person person = new Person(); person.setFirstName("James"); person.setLastName("Ryan"); person.setAge(19); outputStream.writeObject(person); person = new Person(); person.setFirstName("Obi-wan"); person.setLastName("Kenobi"); person.setAge(30); outputStream.writeObject(person); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } finally { //Close the ObjectOutputStream try { if (outputStream != null) { outputStream.flush(); outputStream.close(); } } catch (IOException ex) {…
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24475286
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24475286

http://stackoverflow.com/comment/38054275
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24567430
score: 0
has text: Thank you all for answering.

http://stackoverflow.com/q/24501042
has answer: http://stackoverflow.com/a/24606569
tagged with: java
answer count: 6
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37930571
has answer: http://stackoverflow.com/a/24502370
has title: Android app in Eclipse: Edit text not showing on Graphical layout
has answer: http://stackoverflow.com/a/25977509
score: 105
has comment: http://stackoverflow.com/comment/40542347
has answer: http://stackoverflow.com/a/26696567
downvote count: 0
upvote count: 105
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24502370
tagged with: text
type: AnsweredQuestion
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/37930743
has answer: http://stackoverflow.com/a/26026704
has body: I am trying to add a text field onto my Android app in Eclipse, but then I drag the Plain text option on to the graphical layout, a message at the bottom comes up. It reads Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V Exception details are logged in Window > Show View > Error Log Even when I go to Window > Show View there is no error log option. The whole designer is useless now, because I can not use it anymore until I delete the EditText directly from the xml. What is causing this error, and how do I fix it? I am running the latest version (as of today, 6-30-14), and Windows 8 Pro x64. Here is my full layout code: <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="18dp" android:text="@string/welcome_text" /> <requestFocus />
possible better answer: http://stackoverflow.com/a/24606569
type: Question
has comment: http://stackoverflow.com/comment/37930755
has comment: http://stackoverflow.com/comment/37930269
has answer: http://stackoverflow.com/a/24544231

http://stackoverflow.com/q/24559839
duplicate of: http://stackoverflow.com/q/24202523
has comment: http://stackoverflow.com/comment/38047626
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24564443
has comment: http://stackoverflow.com/comment/38045073
has answer: http://stackoverflow.com/a/24561535
tagged with: java
tagged with: ram
has body: For a heuristic precomputed table i need a byte array with 1504935936 entries. This should take about 1.5 GB of Memory. public class Main{ public static void main(String[] args){ byte[] arr = new byte[1504935936]; } } Why do I have a "OutOfMemoryError: Java heap space"-Exception, if I give the program 2 GB of RAM with java -Xmx2048M Main With java -Xmx2153M Main it works. Why does it need that much RAM?
tagged with: memory
accepted answer: http://stackoverflow.com/a/24560713
has comment: http://stackoverflow.com/comment/38042316
linked to: http://stackoverflow.com/q/24202523
score: 12
type: Question
upvote count: 12
has title: Memory usage of byte array in Java
has answer: http://stackoverflow.com/a/24560257
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/38040936
linked to: http://stackoverflow.com/q/5882216
has answer: http://stackoverflow.com/a/24560713
linked to: http://stackoverflow.com/q/7298455
possible better answer: http://stackoverflow.com/a/24561535
has answer: http://stackoverflow.com/a/24562764
favorite count: 0
linked to: http://stackoverflow.com/q/22332990
answer count: 5

http://stackoverflow.com/comment/37997006
has text: @bruins1993 Yes your `onCreate()` would look like the updated code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24537196

http://stackoverflow.com/comment/37971332
has text: I tried looking at these links https://spring.io/guides/gs/batch-processing/ , https://spring.io/guides/gs/yarn-batch-processing/ , but didnt find anything useful
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24509211

automation
tags question: http://stackoverflow.com/q/24512443
tags question: http://stackoverflow.com/q/24549083
tag name: automation
type: Tag
tags question: http://stackoverflow.com/q/24430829
tags question: http://stackoverflow.com/q/24549750

http://stackoverflow.com/q/24543811
has title: Repetition of the program?
possible better answer: http://stackoverflow.com/a/24543837
score: -1
has answer: http://stackoverflow.com/a/24543837
downvote count: 2
answer count: 3
upvote count: 1
favorite count: 0
tagged with: repeat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38009621
tagged with: java
has body: I want to loop my program to repeat if the user inputs y the program will repeat over and over again ,but if the user finally inputs n the program will stop import java.util.Scanner; public class ReverseIt { public static void main(String[] args) { Scanner sc = new Scanner (System.in); String name; System.out.println("Input Name"); name = sc.nextLine(); StringBuilder rev = new StringBuilder(name); System.out.println("NAME: "+name+"\n"); System.out.println("REVERSE:" +rev.reverse()+"\n"); System.out.println("Would you like to do it again?(Y/N)\n"); char repeat; repeat = sc.next().charAt(0); if(repeat == 'n'){ System.out.println("Program Stopped"); } while(repeat == 'y'){ System.out.println("Input Name"); name = sc.nextLine(); System.out.println("NAME: "+name+"\n"); System.out.println("REVERSE:" +rev.reverse()+"\n"); System.out.println("Would you like to do it again?(Y/N)\n"); } }
tagged with: loops
has answer: http://stackoverflow.com/a/24544181
has comment: http://stackoverflow.com/comment/38009594
type: Question
has answer: http://stackoverflow.com/a/24543835
accepted answer: http://stackoverflow.com/a/24543835

http://stackoverflow.com/comment/37940151
type: Comment
comment on: http://stackoverflow.com/a/24506138
type: AnswerComment
has text: In every constructor call another constructor call in done... Constructor calls constructor calls constructor ... [, ...] ... There you are building up stack and heap with new instances.
score: 0

recursion
type: Tag
tags question: http://stackoverflow.com/q/24450246
tags question: http://stackoverflow.com/q/24460480
tag name: recursion
tags question: http://stackoverflow.com/q/24581618
tags question: http://stackoverflow.com/q/24436194
tags question: http://stackoverflow.com/q/24496122
tags question: http://stackoverflow.com/q/24499353
tags question: http://stackoverflow.com/q/24583985
tags question: http://stackoverflow.com/q/24429619
tags question: http://stackoverflow.com/q/24467439
tags question: http://stackoverflow.com/q/24581202
tags question: http://stackoverflow.com/q/24477929

http://stackoverflow.com/comment/38029588
comment on: http://stackoverflow.com/q/24554255
score: 0
type: Comment
type: QuestionComment
has text: Let me pick your answer.

http://stackoverflow.com/a/24567285
score: 3
has comment: http://stackoverflow.com/comment/38053427
answers question: http://stackoverflow.com/q/24567221
upvote count: 3
has body: Actually, especially in Java 7 onwards, even your second method is not going to work. (See below for why.) Anyway, the reason is that maps must have distinct keys, and when you are using your value as key, two equal values would be treated as equal keys. The proper fix, by the way, is to sort by value, then by key: int compare = map.get(k1).compareTo(map.get(k2)); if (compare == 0) { compare = k1.compareTo(k2); } return compare; Proper comparators must follow three rules: compare(a, a) == 0 for all values of a. signum(compare(a, b)) == -signum(compare(b, a)) for all values of a and b. if signum(compare(a, b)) == signum(compare(b, c)), then signum(compare(a, c)) must also have the same value, for all values of a, b, and c.
has comment: http://stackoverflow.com/comment/38053459
type: Answer
downvote count: 0

http://stackoverflow.com/q/24511060
has comment: http://stackoverflow.com/comment/37971047
has body: I have setup ActiveMQ and able to produce and consume MapMessage. Message gets stored in ACTIVEMQ_MSGS table under Oracle until it is getting consumed. After consumption record from database gets deleted. Writing trigger and manually pushing data in to another table is one option. But I just want to check with you whether is there any property I can set with which this can be accomplished. My configuration from activemq.xml looks like this: &lt;bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/&gt; &lt;property name="url" value="jdbc:oracle:thin:@localhost/XE"/&gt; &lt;property name="username" value="USERNAME"/&gt; &lt;property name="password" value="PASSWORD"/&gt; &lt;property name="maxActive" value="200"/&gt; &lt;property name="poolPreparedStatements" value="true"/&gt; &lt;/bean&gt; &lt;persistenceAdapter&gt; &lt;jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" dataSource="#oracle-ds"/&gt; &lt;/persistenceAdapter&gt; My Java code looks like: // Getting JMS connection from the server and starting it ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(Constants.ACTIVEMQ_URL); connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); // Destination represents 'NIKHIL.QUEUE' on the JMS server. Destination destination = session.createQueue("NIKHIL.QUEUE"); // MessageProducer is used for sending messages (as opposed to MessageConsumer which is used for receiving them) producer = session.createProducer(destination); //Message creation goes here...
score: 0
has title: ActiveMQ: Store JMS message permanently after consumption
answer count: 1
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/24528574
has comment: http://stackoverflow.com/comment/37962359
tagged with: activemq-classic
has comment: http://stackoverflow.com/comment/37948556
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/38059716
type: QuestionComment
has text: I dont get any exception but the file gets "corrupt"/incorrect codepage/characters. If just restarts my app it works. And it never fails locally only on the server. Therefore I guess its network related. Should I change byte[1024] to another value? Should I use HttpUrlConnection instead?
comment on: http://stackoverflow.com/q/24570161
score: 0
type: Comment

http://stackoverflow.com/comment/38038273
comment on: http://stackoverflow.com/q/24557698
score: 0
type: QuestionComment
type: Comment
has text: @owlstead I have updated the question to provide the ruby code and the gem I believe it is using to encrypt.

http://stackoverflow.com/q/24574456
has answer: http://stackoverflow.com/a/24575538
linked to: http://stackoverflow.com/q/3240415
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38068080
has title: Java SE Swing Notification
has comment: http://stackoverflow.com/comment/38066356
tagged with: notifications
has comment: http://stackoverflow.com/comment/38074923
has comment: http://stackoverflow.com/comment/38075991
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has body: I am working on an inventory management system with Java SE.I want the system to display a notification when the quantity of an item(s) in stock goes down below a set threshold. say ,when the quantity of an item in the database is below 50..The system should display a notification to the user. I have researched though,but the result don,t match up what exactly i need .
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3035880
has answer: http://stackoverflow.com/a/24577199

http://stackoverflow.com/q/24458144
answer count: 4
has answer: http://stackoverflow.com/a/24458255
has comment: http://stackoverflow.com/comment/37849826
type: AnsweredQuestion
tagged with: passwords
has comment: http://stackoverflow.com/comment/37850385
accepted answer: http://stackoverflow.com/a/24458307
has answer: http://stackoverflow.com/a/24458298
tagged with: java
possible better answer: http://stackoverflow.com/a/24458255
type: Question
tagged with: temporary
score: 0
tagged with: random
has answer: http://stackoverflow.com/a/24458307
has comment: http://stackoverflow.com/comment/37849937
has answer: http://stackoverflow.com/a/24458686
has comment: http://stackoverflow.com/comment/37849787
has body: I found these codes online at: http://www.java2s.com/Code/Java/Security/GeneratearandomStringsuitableforuseasatemporarypassword.htm But I am not really sure about the codes' logic. public static String generateRandomPassword() { String letters = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"; String pw = ""; for (int i=0; i&lt;PASSWORD_LENGTH; i++) { int index = (int)(RANDOM.nextDouble()*letters.length()); pw += letters.substring(index, index+1); } return pw; } Can someone explain this two lines of codes for me so I can understand better? int index = (int)(RANDOM.nextDouble()*letters.length()); pw += letters.substring(index, index+1); Thank You. :D
has title: JAVA Can someone explain this code for me? Auto-Gen

http://stackoverflow.com/comment/38007656
has text: Thanks for explaining . Clears up the whole thing now. COmplining fine now , after implementing your suggestion. I liked the simple language in which you have explained , hence accepted the answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24524393
type: Comment

http://stackoverflow.com/comment/37876027
type: AnswerComment
has text: @PierreOverFlow: Sorry for misunderstanding of the question, but personally I don't believe that would be possible
type: Comment
comment on: http://stackoverflow.com/a/24472090
score: 0

http://stackoverflow.com/q/24497087
tagged with: unit-testing
type: Question
score: 5
tagged with: spock
has body: I'm trying to test some code that's in src/groovy using Spock. The code I'm testing references grailsApplication. Since it's in src/groovy, I used dependency injection to inject grailsApplication into the bean, like so: ticketRequestEmailInfo(TicketRequestEmailInfo) { grailsApplication = ref('grailsApplication') } The problem I'm having is when the test code hits the line of code that references grailsApplication, I'm getting a NullPointerException: java.lang.NullPointerException: Cannot get property 'config' on null object My test class has the following: @TestMixin(GrailsUnitTestMixin) class TicketRequestEmailInfoSpec extends Specification { def setup() { grailsApplication.config.acme.purchase.trsUrlBase = "http://localhost:8082/purchase/order/" } Does anyone have any suggestions?
has answer: http://stackoverflow.com/a/24501325
upvote count: 5
tagged with: grails
answer count: 2
tagged with: groovy
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24501325
has title: Accessing grailsApplication from spock unit test testing code in src/groovy
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24516995
has answer: http://stackoverflow.com/a/24516995

http://stackoverflow.com/comment/37967287
comment on: http://stackoverflow.com/q/24521401
has text: If it's removing the last two words, the `" "` (space) may not actually be the delimiter, it could be a "blank" character (such as ASCII 255)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24472685
score: 0
has comment: http://stackoverflow.com/comment/37877234
has comment: http://stackoverflow.com/comment/37877248
answer count: 1
has title: how to make a 'modified' ArrayList thread safe in java?
has answer: http://stackoverflow.com/a/24472709
has comment: http://stackoverflow.com/comment/37877119
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37877126
has comment: http://stackoverflow.com/comment/37877369
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37877636
accepted answer: http://stackoverflow.com/a/24472709
has comment: http://stackoverflow.com/comment/37877753
has body: I am implementing a distributed mutex, and I need to keep track of all the requests that have been made. I've a message class which is comparable and I've a modified ArrayList requestList = new ArrayList&lt;Message&gt;() { public synchronized boolean add(Message msg) { boolean ret = super.add(msg); Collections.sort(requestList); return ret; } I suspect that this requestList is getting modified by two threads and I'm seeing elements at the top of the list which should not be there. how do I make this requestList thread safe? would doing as follows work? requestList = Collections.synchronizedList(new ArrayList&lt;Message&gt;() { public synchronized boolean add(Message msg) { boolean ret = super.add(msg); Collections.sort(requestList); return ret; }); also how does Collection.synchronizedList work? by sort of putting a 'synchronized' for all the methods of the ArrayList?
has comment: http://stackoverflow.com/comment/37877250
has comment: http://stackoverflow.com/comment/37877210
tagged with: arraylist

http://stackoverflow.com/q/24447451
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: jsprit
tagged with: java
has answer: http://stackoverflow.com/a/24467964
type: Question
accepted answer: http://stackoverflow.com/a/24467964
tagged with: jobs
has title: Related jobs in JSprit
has body: Is it possible to handle relations between jobs (in this case services) in jsprit? For instance one job has to start at the same time with one or more other jobs. Or one job must not start before the end of another job (normal sequence). If not, do you know other java libraries that can handle such kind of restrictions? Thank you!
answer count: 1
downvote count: 0
favorite count: 0

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

http://stackoverflow.com/q/24566706
has title: Spring MVC 3.2 Jackson Bad Request
score: 0
tagged with: datatables
has body: I migrated from Spring 3.1 to Spring 3.2.5. before migrating to Spring 3.2.5 everything seems to be working howerver when I updated my library some of my rest calls are returning a 400 Bad Request. Here's the method @RequestMapping(value = AJAX_SEARCH_MED) @ResponseBody DataTablesAjaxResponse<ActiveMedicationView> ajaxSearchActiveMedication( @PathVariable(PATH_PIN) String pin, @RequestBody DataTablesAjaxRequest request); I already configured my mvc:annotation to this <property name="favorPathExtension" value="false" /> in my pom. I have this jackson marshalling library org.codehaus.jackson jackson-mapper-asl 1.9.10 However when making calls from data tables I always receive a bad request. The code calling the method $('#prescriptionsTable').dataTable({ "bProcessing":true, "bServerSide":true, "bFilter":false, "sAjaxSource":"/cms/ajax/patient/2012010000000009/active-medication.html", "aoColumnDefs":[ //Other configurations here
has comment: http://stackoverflow.com/comment/38052874
has comment: http://stackoverflow.com/comment/38052554
tagged with: spring
has answer: http://stackoverflow.com/a/24567487
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38053431
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38053957
tagged with: java
has comment: http://stackoverflow.com/comment/38053488
has comment: http://stackoverflow.com/comment/38053598
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/24567487
tagged with: jackson
has comment: http://stackoverflow.com/comment/38052321

http://stackoverflow.com/a/24493904
has body: I am assuming you have java installed in either C:\Program Files (x86)\Java\jdk1.6.0_23 or C:\Program Files\Java\jdk1.6.0_23 folder. Path can't take a space in it, so you need to replace this PROGRA~2 instead of Program Files(86); it's the Windows short name for the same folder. Similarly, use PROGRA~1 for the Program Files folder.
accepted answer of: http://stackoverflow.com/q/24488074
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24488074
type: Answer
score: 2
upvote count: 2

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

http://stackoverflow.com/comment/38012984
type: Comment
comment on: http://stackoverflow.com/a/24545238
has text: public void onClick(View v) { if (v.getId() == R.id.air_pick) { Intent i = new Intent(Main.this, Airport.class); startActivity(i);........in this code air_pick is the button to be clicked which is in Main.java class...after clicking it focus should be transfered to Airport.class....this Airport.java contains only 4 buttons and nothing else....and when air_pick button is pressed,Airport.java is called and meanwhile softkeypad pops up...
type: AnswerComment
score: 0

http://stackoverflow.com/a/24484502
type: Answer
has comment: http://stackoverflow.com/comment/37899761
upvote count: 1
has body: This is the regexp you need: "\\d.*\\d*\\sTO\\s*\\d.*"
score: 1
answers question: http://stackoverflow.com/q/24484461
downvote count: 0

http://stackoverflow.com/a/24430098
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24430063
has body: Your code: public RightTriangle(double triHeight, double triBase) { triHeight = height; triBase = base; } Should be: public RightTriangle(double triHeight, double triBase) { height = triHeight; base = triBase; }
type: Answer
upvote count: 5

http://stackoverflow.com/comment/38014498
comment on: http://stackoverflow.com/a/24546487
type: AnswerComment
has text: I need the equation to be disdisplayed on edit text 2 base on initial values when I generated the edit text
score: 0
type: Comment

http://stackoverflow.com/a/24503005
has comment: http://stackoverflow.com/comment/38003289
has comment: http://stackoverflow.com/comment/37958001
has comment: http://stackoverflow.com/comment/37963947
answers question: http://stackoverflow.com/q/24502526
has comment: http://stackoverflow.com/comment/38000282
has body: This is a proof of concept only! I randomly generate the tiles that get painted, I hope you have some kind of virtual map setup so you know which tiles to paint at any given virtual point! Basically, what this does, is when the screen is moved left or right, it shifts the "master" image left or right and stitches new tiles onto new edge My test was using a style sheet of 31x31 cells (don't ask, I just grab it off the net) This is VERY scaled down example of the output, it was running at 1100x700+ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Scroll { public static void main(String[] args) { new Scroll(); } public Scroll() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private BufferedImage screen; private BufferedImage styleSheet; public TestPane() { try { styleSheet = ImageIO.read(getClass().getResource("/StyleSheet.png")); } catch (IOException ex) { ex.printStackTrace…
has comment: http://stackoverflow.com/comment/38003096
has comment: http://stackoverflow.com/comment/37964298
has comment: http://stackoverflow.com/comment/37963895
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37964251

http://stackoverflow.com/comment/38180011
type: Comment
has text: Thanks a lot for your detailed answer! I see that this is in general a way to force a certain jar version to be loaded, but in our case we have a lot of customers who are using a "customized" jnlp version. Therefore we try to keep the number of mandatory changes to our "default" jnlp file as low as possible, to avoid "manual merges". So in this case the cache deletion (or timestamp adjustment on the server) is the smaller trouble to us.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24604587

http://stackoverflow.com/comment/37847629
type: QuestionComment
comment on: http://stackoverflow.com/q/24455263
has text: @AniketThakur the message at the receiving end are null. When sending, I'm verifying the logs, it seems to send without any issue. both before and after sending the message
score: 0
type: Comment

http://stackoverflow.com/comment/37805309
comment on: http://stackoverflow.com/q/24433704
type: QuestionComment
has text: Could you please provide an example?
score: 0
type: Comment

http://stackoverflow.com/comment/37943165
type: Comment
has text: if I get those right, neither one of them will open my standard mail client (outlook, thunderbird etc.) - correct me if I'm wrong
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24507281

http://stackoverflow.com/q/24502187
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37932341
accepted answer: http://stackoverflow.com/a/24503132
has comment: http://stackoverflow.com/comment/37932677
has comment: http://stackoverflow.com/comment/37932363
type: Question
has answer: http://stackoverflow.com/a/24503132
tagged with: java
has title: How to set up a Java workspace without an IDE
tagged with: compilation
upvote count: 2
has body: I usually code with IDEs like Intellij Idea or Eclipse, but due to several reasons, I no longer have access to an IDE, and I'd like to be able to code in Java on a remote Linux machine through a ssh terminal. Making simple progams with only a few classes is easy, but some of my projects have several libraries and several separate .java files. I also need to export to a .jar file. For example, I have the following file organisation: project/ src/ a.java b.java c.java libs/ lib1.jar lib2.jar out/ export_here.jar someconfig.conf The java app consists of the a, b, and c .java files, uses libraries lib1 and lib2, and the file someconfig.conf needs to be inside the export jar. I want to know how to easily compile and build a project such as this. In other words, I just want to know how to export my project into a runnable jar the right way. I expect this can be done with a few commands. If so, I plan to make a shell script to automate everything. Thanks in advance!
has comment: http://stackoverflow.com/comment/37932932
answer count: 1
tagged with: executable-jar
tagged with: jar
has comment: http://stackoverflow.com/comment/37932362
has comment: http://stackoverflow.com/comment/37932384
has comment: http://stackoverflow.com/comment/37932395
favorite count: 0
has comment: http://stackoverflow.com/comment/37932473
tagged with: workspace
score: 2

http://stackoverflow.com/q/24478027
has answer: http://stackoverflow.com/a/24478318
possible better answer: http://stackoverflow.com/a/24478192
accepted answer: http://stackoverflow.com/a/24478318
answer count: 6
score: 4
has comment: http://stackoverflow.com/comment/37887232
has comment: http://stackoverflow.com/comment/37887213
has title: Why does the code skip the for-loop
favorite count: 0
has comment: http://stackoverflow.com/comment/37887176
has comment: http://stackoverflow.com/comment/37887233
has body: my task was to write a method that should combine letters which occur more then two times in a row. Example: ABBCCCDDDD -> ABBC3D4 I was told to us the library's In.java and Out.java for in and output. My problem is that the method skips the for-loop. I hope you can help me. If you have any questions about the code just ask me please public class Aufgabe9_4 { static void codieren(String s){ int Zähler = 0; char[] a = s.toUpperCase().toCharArray(); for (int i = 0; i&lt;s.length()-1; i++){ if (a[i] == a[i+1] &amp;&amp; a[i] ==a[i+2]){ Zähler = 3; while (a[i] == a[i+Zähler]) Zähler++; i = i + Zähler; } Out.println(a[i] + Zähler); } } public static void main(String args[]) { Out.println("Geben sie eine Reihenfolge von Buchstaben ein!"); String s = In.readString(); Out.println("Die Codierung lautet:"); codieren(s); } }
has answer: http://stackoverflow.com/a/24478263
has comment: http://stackoverflow.com/comment/37887949
has answer: http://stackoverflow.com/a/24478192
upvote count: 4
has comment: http://stackoverflow.com/comment/37887398
has comment: http://stackoverflow.com/comment/37887281
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24478408
has answer: http://stackoverflow.com/a/24478382
has comment: http://stackoverflow.com/comment/37887294
has comment: http://stackoverflow.com/comment/37887165
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37887347
tagged with: for-loop
has answer: http://stackoverflow.com/a/24478311
has comment: http://stackoverflow.com/comment/37887162

erasure
tag name: erasure
type: Tag
tags question: http://stackoverflow.com/q/24480430

http://stackoverflow.com/q/24493496
has body: I'm working with some Java/Spring web applications and RabbitMQ. I have App1 and App2 on the same tomcat server at the address 192.168.0.101. They both communicate with a RabbitMQ server located at : 192.168.0.100. App1 has this configuration in the spring context: &lt;bean id="connectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory" destroy-method="destroy"&gt; &lt;property name="host" value="192.168.0.100" /&gt; &lt;property name="username" value="app" /&gt; &lt;property name="password" value="guest" /&gt; &lt;property name="virtualHost" value="/" /&gt; &lt;/bean&gt; App2 has the same config except a different username, let's say: &lt;bean id="connectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory" destroy-method="destroy"&gt; &lt;property name="host" value="192.168.0.100" /&gt; &lt;property name="username" value="app2" /&gt; &lt;property name="password" value="guest" /&gt; &lt;property name="virtualHost" value="/" /&gt; &lt;/bean&gt; The problem is that App1 can connect successfully to the RabbitMQ server, and App2 has always a invalid credentials error in the RabbitMQ logs. Here is the permissions list for these users: Listing permissions in vhost "/" ... app .* .* .* app2 .* .* .* And here is what I get when I try to log in with the API (with both users): curl -i -u app:guest http://192.168.0.100:15672/api/whoami and curl -i -u app2:guest http://192.168.0.100:15672/api/whoami HTTP/1.1 401 Unauthorized Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact) Date: Mon, 30 Jun 2014 14:58:37 GMT Content-Length: 57 {"error":"not_authorised","reason":"Not management user"} which seems pretty normal, I think, each user is recognized as valid user but not authorized for management. When I set the management tag for app2, I get this : curl -i -u app2:guest http://192.168.0.100:15672/api/whoami HTTP/1.1 200 OK Server: MochiWeb/1.1 WebMachine/1.10.0 (never breaks eye contact) Date: Mon,…
tagged with: java
has title: RabbitMQ invalid credentials with valid information
type: Question
has comment: http://stackoverflow.com/comment/37919888
tagged with: spring-amqp
has comment: http://stackoverflow.com/comment/37919378
downvote count: 0
has comment: http://stackoverflow.com/comment/37937222
has answer: http://stackoverflow.com/a/24511915
answer count: 1
favorite count: 0
tagged with: credentials
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37942363
tagged with: spring
tagged with: rabbitmq
score: 3
has comment: http://stackoverflow.com/comment/37982942
upvote count: 3

http://stackoverflow.com/comment/38032840
comment on: http://stackoverflow.com/a/24552980
type: AnswerComment
score: 0
type: Comment
has text: Also note the user may have disabled the All Mail folder, so be prepared to search iteratively if you can't find it.

spring
tags question: http://stackoverflow.com/q/24564554
tags question: http://stackoverflow.com/q/24575923
tags question: http://stackoverflow.com/q/24564164
tags question: http://stackoverflow.com/q/24570108
tags question: http://stackoverflow.com/q/24506234
tags question: http://stackoverflow.com/q/24432828
tags question: http://stackoverflow.com/q/24575507
tags question: http://stackoverflow.com/q/24551166
tags question: http://stackoverflow.com/q/24566706
tags question: http://stackoverflow.com/q/24586307
tags question: http://stackoverflow.com/q/24559007
tags question: http://stackoverflow.com/q/24475706
tags question: http://stackoverflow.com/q/24454701
tags question: http://stackoverflow.com/q/24519531
tags question: http://stackoverflow.com/q/24547766
tags question: http://stackoverflow.com/q/24569213
tags question: http://stackoverflow.com/q/24511957
tags question: http://stackoverflow.com/q/24546793
tags question: http://stackoverflow.com/q/24488636
tags question: http://stackoverflow.com/q/24573395
tags question: http://stackoverflow.com/q/24481848
tags question: http://stackoverflow.com/q/24563583
tags question: http://stackoverflow.com/q/24516070
tags question: http://stackoverflow.com/q/24544242
tags question: http://stackoverflow.com/q/24584380
tags question: http://stackoverflow.com/q/24538854
tags question: http://stackoverflow.com/q/24553076
tags question: http://stackoverflow.com/q/24488943
tags question: http://stackoverflow.com/q/24490357
tags question: http://stackoverflow.com/q/24497229
tags question: http://stackoverflow.com/q/24505532
tags question: http://stackoverflow.com/q/24486370
tags question: http://stackoverflow.com/q/24488528
tags question: http://stackoverflow.com/q/24475790
tags question: http://stackoverflow.com/q/24587771
tags question: http://stackoverflow.com/q/24468602
tags question: http://stackoverflow.com/q/24447319
tags question: http://stackoverflow.com/q/24534287
tags question: http://stackoverflow.com/q/24467675
tags question: http://stackoverflow.com/q/24554255
tags question: http://stackoverflow.com/q/24431540
tags question: http://stackoverflow.com/q/24504115
tags question: http://stackoverflow.com/q/24555845
tags question: http://stackoverflow.com/q/24462082
tags question: http://stackoverflow.com/q/24481542
tags question: http://stackoverflow.com/q/24514667
tags question: http://stackoverflow.com/q/24474283
tags question: http://stackoverflow.com/q/24443639
tags question: http://stackoverflow.com/q/24574935
tags question: http://stackoverflow.com/q/24485993
tags question: http://stackoverflow.com/q/24499655
tags question: http://stackoverflow.com/q/24448686
tags question: http://stackoverflow.com/q/24548056
tags question: http://stackoverflow.com/q/24488888
tags question: http://stackoverflow.com/q/24571656
tags question: http://stackoverflow.com/q/24562576
tags question: http://stackoverflow.com/q/24548914
tags question: http://stackoverflow.com/q/24473102
tags question: http://stackoverflow.com/q/24510150
tags question: http://stackoverflow.com/q/24560635
tags question: http://stackoverflow.com/q/24474171
tags question: http://stackoverflow.com/q/24511380
tags question: http://stackoverflow.com/q/24477018
tags question: http://stackoverflow.com/q/24561304
tags question: http://stackoverflow.com/q/24545942
tags question: http://stackoverflow.com/q/24453579
tags question: http://stackoverflow.com/q/24523279
tags question: http://stackoverflow.com/q/24569287
tags question: http://stackoverflow.com/q/24475549
tags question: http://stackoverflow.com/q/24487865
tags question: http://stackoverflow.com/q/24568972
tags question: http://stackoverflow.com/q/24493496
tags question: http://stackoverflow.com/q/24525498
type: Tag
tags question: http://stackoverflow.com/q/24471935
tags question: http://stackoverflow.com/q/24548004
tags question: http://stackoverflow.com/q/24490373
tags question: http://stackoverflow.com/q/24583521
tags question: http://stackoverflow.com/q/24544699
tags question: http://stackoverflow.com/q/24506667

http://stackoverflow.com/comment/38105957
comment on: http://stackoverflow.com/q/24576614
type: Comment
type: QuestionComment
has text: Where do you see i want to click on 2 button at the same time? I speak about two different button. Validation button and diffusion Mail button;) and each one have 2 commons validator on the second one another validation
score: 0

http://stackoverflow.com/q/24567070
has answer: http://stackoverflow.com/a/24567201
tagged with: java
has title: saving an object for an app in android, or whether that is even the right approach
type: Question
has body: So, I've got some very minor experience in Java, and I'm trying to learn/work on an android project. The issue I'm having is wrapping my head around saving/retrieving user data. Its a simple marking app(its mostly for myself) but basically there is a semester object, which contains classes objects, which contains markable objects (i.e tests each with their own weightage). So basically what I'm asking is how would I go about retrieving data.. What I really want is to display "Oh hey, this is your mark for the current semester:" when you open up the main activity/start the app (which would involve loading up the semester object which the user has entered their data into and calling up a method), but I don't know how I would open/save the objects each time the app is opened and closed. Would I implement serialization in the semester class, or would I save/open up the object whenever I close/open the app. Is saving the semester object even the right approach? I've been searching for a while and I've seen questions about people opening files and I'm pretty lost right now. (Oh and while I'm on the topic of this project, is the idea of nesting objects a bad approach? Like having a semester object which contains multiple class objects, each which contains multiple markable objects)
answer count: 3
has answer: http://stackoverflow.com/a/24567465
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24567148
type: UnansweredQuestion

interface
tags question: http://stackoverflow.com/q/24482592
tag name: interface
tags question: http://stackoverflow.com/q/24523764
tags question: http://stackoverflow.com/q/24451207
tags question: http://stackoverflow.com/q/24574293
tags question: http://stackoverflow.com/q/24566313
tags question: http://stackoverflow.com/q/24445247
tags question: http://stackoverflow.com/q/24540624
tags question: http://stackoverflow.com/q/24499744
tags question: http://stackoverflow.com/q/24544255
tags question: http://stackoverflow.com/q/24472746
tags question: http://stackoverflow.com/q/24584895
type: Tag
tags question: http://stackoverflow.com/q/24555352
tags question: http://stackoverflow.com/q/24465349
tags question: http://stackoverflow.com/q/24568408
tags question: http://stackoverflow.com/q/24510367
tags question: http://stackoverflow.com/q/24512578
tags question: http://stackoverflow.com/q/24582575
tags question: http://stackoverflow.com/q/24547856
tags question: http://stackoverflow.com/q/24503082
tags question: http://stackoverflow.com/q/24580541
tags question: http://stackoverflow.com/q/24519882
tags question: http://stackoverflow.com/q/24443977
tags question: http://stackoverflow.com/q/24484390
tags question: http://stackoverflow.com/q/24574462

http://stackoverflow.com/comment/38004163
score: 0
type: AnswerComment
has text: can I pass parameters to `run()` for the hsv and carousel views?
type: Comment
comment on: http://stackoverflow.com/a/24540865

http://stackoverflow.com/q/24484662
tagged with: android
has body: i'm a beginner in java and android. now i want to work with external database (cancer.db). i created "DataBaseHelper" class. public class DataBaseHelper extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static String DB_PATH = "/data/data/YOUR_PACKAGE/databases/"; private static String DB_NAME = "myDBName"; private SQLiteDatabase myDataBase; private final Context myContext; /** * Constructor * Takes and keeps a reference of the passed context in order to access to the application assets and resources. * @param context */ public DataBaseHelper(Context context) { super(context, DB_NAME, null, 1); this.myContext = context; } public void createDataBase() throws IOException{ boolean dbExist = checkDataBase(); if(dbExist){ //do nothing - database already exist }else{ //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exists, false if it doesn't */ private boolean checkDataBase(){ SQLiteDatabase checkDB = null; try{ String myPath = DB_PATH + DB_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); }catch(SQLiteException e){ //database does't exist yet. } if(checkDB != null){ checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your local assets-folder to the just created empty database in the * system folder, from where it can be accessed and handled. * This is done by transfering bytestream. * */ private void copyDataBase() throws IOException{ //Open your local db as the input stream InputStream myInput = myContext.getAssets().open(DB_NAME); // Path to the just created empty…
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37900993
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37900596
tagged with: database
score: -1
tagged with: sqlite
answer count: 1
has title: working with external data base in android programing with eclipse
has comment: http://stackoverflow.com/comment/37900026
favorite count: 0
has answer: http://stackoverflow.com/a/24484875
has comment: http://stackoverflow.com/comment/37900326
type: UnansweredQuestion

http://stackoverflow.com/a/24564045
downvote count: 0
score: 6
type: Answer
upvote count: 6
has body: Flip the order of the first 2 lines in the loop; by doing the division first, you lose the first remainder. But then you'll need to handle the last remainder.
answers question: http://stackoverflow.com/q/24563998
has comment: http://stackoverflow.com/comment/38047189
has comment: http://stackoverflow.com/comment/38047250
has comment: http://stackoverflow.com/comment/38047238
accepted answer of: http://stackoverflow.com/q/24563998
type: AcceptedAnswer

http://stackoverflow.com/comment/37961121
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24517732
has text: Wouldn't it be `t[0] = t[0] + t[1],t[1] = t[1] + t[2],...`? In which case your first pass would result in `{3,5,7,<no clue about the fourth>}`/

http://stackoverflow.com/a/24473193
has comment: http://stackoverflow.com/comment/38122142
answers question: http://stackoverflow.com/q/24473102
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38141873
has body: ClassPathXmlApplicationContext is a subclass of ConfigurableApplicationContext which means it implements Closable. ApplicationContext does not extend Closeable, so the Closable#close() method cannot be invoked on any reference of type ApplicationContext. However, Eclipse detects that you are assigning a value of type ClassPathXmlApplicationContext (which needs to be closed), and warns that you should close it, even though you can't through the reference type of the variable you are assigning it to. You need to either cast the reference value or assign it to a variable of a type that does implement Closeable. ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("spring.xml"); You can then invoke close() normally appContext.close();
upvote count: 1
type: Answer

http://stackoverflow.com/a/24579555
has body: The standard way of dealing with this is the so-called observer pattern. You should make sure that there is only one instance of Gamma, as otherwise you have to make sure all instances are synchonized. a and b ask g to be registered as observers. g notifies all its observers of a change of its state. class Gamma extends Observable { int x = 10; public int getX(){ return x; } public void setX(int y){ x = y; notifyObservers (null); } } class Alpha implements Observer { // ... public Alpha (Gamma g) { g.addObserver (this); } public void update(Observable o, Object arg) { // this method gets called by g whenever g's state changes // do necessary updates here // ... } }
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/38076937
downvote count: 0
answers question: http://stackoverflow.com/q/24579543
type: Answer

http://stackoverflow.com/comment/37920213
type: AnswerComment
score: 0
type: Comment
has text: I think one of the tricky things here is that the WEB-INF is exploded and deployed to a custom location `/usr/share/jboss-5.1.0.GA/server/myServlet/deploy/dev.ear/dev.war/WEB-INF/lib/hello.vml` I still get the `org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/hello.vml'` When I print the classpath to the logger via `URL[] urls = ((URLClassLoader)cl).getURLs(); for(URL url: urls){ LOGGER.info("Classpath item: " + url.getFile()); }`, I see `Classpath item: /usr/share/jboss-5.1.0.GA/bin/run.jar`
comment on: http://stackoverflow.com/a/24495331

http://stackoverflow.com/a/24532085
has comment: http://stackoverflow.com/comment/37987114
answers question: http://stackoverflow.com/q/24530086
type: Answer
has comment: http://stackoverflow.com/comment/37987044
has body: As the javadoc says : getString(int columnIndex) Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language. and getString(String columnLabel) Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language. So this is not going to work. It will give you : java.sql.SQLException: Before start of result set First of all you need to iterate through the Resultset obtained using next() then you can retrieve the specific values by either pass 1 which is the column index in this case or points which is the columnName of your table and based on the where clause it shall give you different values of the column points
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24503459
answers question: http://stackoverflow.com/q/24503082
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37934849
score: 1
has body: If you are using/can use Java 8 'default methods' might be what you are looking for -> http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html However, I don't think you are far off from what you want to achieve with the code listed above. MyInterface.java public interface MyInterface { public ... method1(...); public ... method2(...); public ... method3(...); public ... method4(...); } Default.java public abstract class Default implements MyInterface { public abstract ... method1(...); public ... method2(...) { // code } public ... method3(...) { // code } public abstract ... method4(...); } SomeBaseClass.java public abstract class SomeBaseClass extends Default { public void someNewMethod(); } MyClass.java public class MyClass extends SomeBaseClass { // other class code @Override public ... method1(...) { // code } @Override public ... method4(...) { // code } }
downvote count: 0

http://stackoverflow.com/comment/37987005
type: AnswerComment
comment on: http://stackoverflow.com/a/24531789
has text: Ho @SubOptimal. Thank you for the answer. Is there any way to do this directly into the project, maybe configuring a Maven plugin into the pom.xml? I wouldn't like to use Maven from the outside of Eclipse
score: 0
type: Comment

http://stackoverflow.com/q/24444680
has body: I want to write a Java program , in which that need to execute a batch file to convert mp3 to wav file,am having command and its working fine in a command prompt,so to convert the file from wave to mp3 the first step is to have to change the directory to the where that batch file presents and then i need to execute mu-law-mp3.bat muic command in command prompt now my question is how i can achieve this through Java? In my java program I need to execute cd command to the location of batch file I need to execute above command .
score: 0
tagged with: batch-file
answer count: 3
has comment: http://stackoverflow.com/comment/37825101
favorite count: 0
has answer: http://stackoverflow.com/a/24445526
possible better answer: http://stackoverflow.com/a/24445700
tagged with: windows
has answer: http://stackoverflow.com/a/24445700
linked to: http://stackoverflow.com/q/22954463
has answer: http://stackoverflow.com/a/24444795
type: AnsweredQuestion
has title: Execute command prompt commands in java
tagged with: java
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24445526

http://stackoverflow.com/comment/37806207
comment on: http://stackoverflow.com/q/24433951
score: 0
type: Comment
type: QuestionComment
has text: Yeah there are a number of instances of the variable in other classes as it is used in the decision making system

arrays
tags question: http://stackoverflow.com/q/24550801
tags question: http://stackoverflow.com/q/24563427
tags question: http://stackoverflow.com/q/24459349
tags question: http://stackoverflow.com/q/24483495
tags question: http://stackoverflow.com/q/24552126
tags question: http://stackoverflow.com/q/24481937
tags question: http://stackoverflow.com/q/24449598
tags question: http://stackoverflow.com/q/24509615
tags question: http://stackoverflow.com/q/24523983
type: Tag
tags question: http://stackoverflow.com/q/24439961
tags question: http://stackoverflow.com/q/24518218
tags question: http://stackoverflow.com/q/24471104
tags question: http://stackoverflow.com/q/24533135
tags question: http://stackoverflow.com/q/24520445
tags question: http://stackoverflow.com/q/24428748
tags question: http://stackoverflow.com/q/24572620
tags question: http://stackoverflow.com/q/24559843
tags question: http://stackoverflow.com/q/24452292
tags question: http://stackoverflow.com/q/24489841
tags question: http://stackoverflow.com/q/24544629
tags question: http://stackoverflow.com/q/24521926
tags question: http://stackoverflow.com/q/24565525
tags question: http://stackoverflow.com/q/24538459
tags question: http://stackoverflow.com/q/24498217
tags question: http://stackoverflow.com/q/24526187
tags question: http://stackoverflow.com/q/24543708
tags question: http://stackoverflow.com/q/24562162
tags question: http://stackoverflow.com/q/24496691
tags question: http://stackoverflow.com/q/24520782
tags question: http://stackoverflow.com/q/24434925
tags question: http://stackoverflow.com/q/24499814
tags question: http://stackoverflow.com/q/24494438
tags question: http://stackoverflow.com/q/24482003
tags question: http://stackoverflow.com/q/24450929
tags question: http://stackoverflow.com/q/24473571
tags question: http://stackoverflow.com/q/24491256
tags question: http://stackoverflow.com/q/24579849
tags question: http://stackoverflow.com/q/24559288
tags question: http://stackoverflow.com/q/24518448
tags question: http://stackoverflow.com/q/24443659
tags question: http://stackoverflow.com/q/24558019
tags question: http://stackoverflow.com/q/24536244
tags question: http://stackoverflow.com/q/24548266
tags question: http://stackoverflow.com/q/24547406
tags question: http://stackoverflow.com/q/24471454
tags question: http://stackoverflow.com/q/24544279
tags question: http://stackoverflow.com/q/24476968
tags question: http://stackoverflow.com/q/24470715
tags question: http://stackoverflow.com/q/24501952
tags question: http://stackoverflow.com/q/24439006
tags question: http://stackoverflow.com/q/24538333
tags question: http://stackoverflow.com/q/24436194
tags question: http://stackoverflow.com/q/24490354
tags question: http://stackoverflow.com/q/24458204
tags question: http://stackoverflow.com/q/24490663
tags question: http://stackoverflow.com/q/24547679
tag name: arrays
tags question: http://stackoverflow.com/q/24582928
tags question: http://stackoverflow.com/q/24461735
tags question: http://stackoverflow.com/q/24485708
tags question: http://stackoverflow.com/q/24526019
tags question: http://stackoverflow.com/q/24446562
tags question: http://stackoverflow.com/q/24502678
tags question: http://stackoverflow.com/q/24502158
tags question: http://stackoverflow.com/q/24559839
tags question: http://stackoverflow.com/q/24521832
tags question: http://stackoverflow.com/q/24451368
tags question: http://stackoverflow.com/q/24488317
tags question: http://stackoverflow.com/q/24517251
tags question: http://stackoverflow.com/q/24482020
tags question: http://stackoverflow.com/q/24450641
tags question: http://stackoverflow.com/q/24587736
tags question: http://stackoverflow.com/q/24496405
tags question: http://stackoverflow.com/q/24487067
tags question: http://stackoverflow.com/q/24580328
tags question: http://stackoverflow.com/q/24576919
tags question: http://stackoverflow.com/q/24459541
tags question: http://stackoverflow.com/q/24475194
tags question: http://stackoverflow.com/q/24490892

http://stackoverflow.com/a/24520207
score: 1
answers question: http://stackoverflow.com/q/24520129
downvote count: 0
type: Answer
has body: Try putting thread.sleep after synchronized block
upvote count: 1

http://stackoverflow.com/comment/38006584
type: QuestionComment
comment on: http://stackoverflow.com/q/24542149
has text: Put some effort for valid formatting pls
score: 0
type: Comment

http://stackoverflow.com/comment/37927109
score: 0
comment on: http://stackoverflow.com/a/24498946
type: AnswerComment
has text: @BobStout I think your comment was before my edit. I believe the updated answer corrects your problem as the fiddle matches the image of your desired output (in IE9).
type: Comment

http://stackoverflow.com/comment/38017809
has text: How is `TestDaoImpl` being used? Are you injecting it into a test? If so, how?
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24548056
type: Comment

http://stackoverflow.com/comment/37917340
has text: What error do you get?
type: QuestionComment
comment on: http://stackoverflow.com/q/24494024
score: 0
type: Comment

http://stackoverflow.com/comment/37841750
type: Comment
type: QuestionComment
has text: yes, what is your suggestion?
comment on: http://stackoverflow.com/q/24451257
score: 0

http://stackoverflow.com/comment/37834999
has text: but I extends Serializable in my interface?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24450115
score: 0

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24509932
tags question: http://stackoverflow.com/q/24551295
tags question: http://stackoverflow.com/q/24580918
tags question: http://stackoverflow.com/q/24481035
tags question: http://stackoverflow.com/q/24455434
tags question: http://stackoverflow.com/q/24484772
tags question: http://stackoverflow.com/q/24541052
tags question: http://stackoverflow.com/q/24456513
type: Tag
tags question: http://stackoverflow.com/q/24570803
tags question: http://stackoverflow.com/q/24562866
tags question: http://stackoverflow.com/q/24478851
tags question: http://stackoverflow.com/q/24565475
tags question: http://stackoverflow.com/q/24586630
tags question: http://stackoverflow.com/q/24542272
tags question: http://stackoverflow.com/q/24442640
tags question: http://stackoverflow.com/q/24480504
tags question: http://stackoverflow.com/q/24496967

http://stackoverflow.com/comment/38007172
type: AnswerComment
has text: Thanks. The official Eclipse Gradle plugin only assists with importing projects into Eclipse but not actually building, however the [STS Plugin](https://github.com/spring-projects/eclipse-integration-gradle/wiki/Gradle-Task-UI) does. But if gradle does the building, will Eclipse/WTP still be able to use the common projects as virtual jars? Is Gradle's integration better with Eclipse or IntelliJ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24531777

http://stackoverflow.com/comment/38000052
comment on: http://stackoverflow.com/q/24538586
has text: Thank you for all the comments so far. I think that I might have been unclear by providing an example however. I am more concerned with the speed of the two tasks that I mentioned. Is the speed of a test "if(aCondition)" is in any way discernibly different from the speed of an assignment "x=value"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37829377
has text: @Puce - My IDE knows it as a constant and colours it for me to remind me. I don't need to mangle my code to support an archaic and IMHO bad naming convention. A wise man understands the difference between a dogma and a mantra. :) I'm not going to shout in my code just to adhere to a coding standard.
type: Comment
score: 3
comment on: http://stackoverflow.com/a/24435279
type: AnswerComment

http://stackoverflow.com/comment/38009634
has text: That makes so much more sense, thank you!
comment on: http://stackoverflow.com/q/24543795
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37966651
comment on: http://stackoverflow.com/a/24521033
score: 0
type: Comment
type: AnswerComment
has text: *"helpful to install an eclipse plugin called WindowBuilder"* which has a habit of using `null` layouts instead! Not a good choice - IMHO

http://stackoverflow.com/comment/37884841
has text: You never managed to say what you're trying to compute. "Scan line" is a class of algorithms that can compute many things. As @Marco13 said, the scan line itself is a data structure that normally includes the list of edges, line segments, arcs, etc. that it currently intersects. The ends points of the edges, etc. and also intersections are processed as "events" that change the scan line.
comment on: http://stackoverflow.com/q/24469459
score: 0
type: Comment
type: QuestionComment

methods
tags question: http://stackoverflow.com/q/24521576
tags question: http://stackoverflow.com/q/24537871
tags question: http://stackoverflow.com/q/24433751
tags question: http://stackoverflow.com/q/24500648
tag name: methods
tags question: http://stackoverflow.com/q/24466332
tags question: http://stackoverflow.com/q/24564790
tags question: http://stackoverflow.com/q/24460712
tags question: http://stackoverflow.com/q/24435073
tags question: http://stackoverflow.com/q/24429677
tags question: http://stackoverflow.com/q/24437105
type: Tag
tags question: http://stackoverflow.com/q/24477929
tags question: http://stackoverflow.com/q/24518218
tags question: http://stackoverflow.com/q/24580117
tags question: http://stackoverflow.com/q/24565525
tags question: http://stackoverflow.com/q/24512876
tags question: http://stackoverflow.com/q/24579391
tags question: http://stackoverflow.com/q/24501634
tags question: http://stackoverflow.com/q/24482016
tags question: http://stackoverflow.com/q/24579849
tags question: http://stackoverflow.com/q/24428014
tags question: http://stackoverflow.com/q/24585677
tags question: http://stackoverflow.com/q/24576028
tags question: http://stackoverflow.com/q/24467330
tags question: http://stackoverflow.com/q/24542816
tags question: http://stackoverflow.com/q/24438105
tags question: http://stackoverflow.com/q/24500397
tags question: http://stackoverflow.com/q/24563505
tags question: http://stackoverflow.com/q/24497203

http://stackoverflow.com/q/24482153
type: Question
tagged with: instantiation
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24490825
answer count: 1
has body: I have write an classLoader. By using it I dynamically instantiating an class. But if the class refers to other classes, I got error saying that can not find the symbol although I have already included these other classes in the classpath. I can I solve this. Here is my code: public static void main(String[] args) { String className = "classLoader.SayHello"; String Dir = "D:\\temp\\"; KonaClassLoader kcl = new KonaClassLoader(); Class&lt;?&gt; clazz = null; Object obj = null; Method m = null; try { clazz = kcl.loadClassFromLocal(Dir,className); obj = clazz.newInstance(); m = clazz.getMethod("sayGoodbye", String.class); m.invoke(obj, "Robin"); } catch (Exception e) { e.printStackTrace(); } } The problem is that if I define any other object in the class SayHello, I got error saying that "can not find Symbol".I have already included these other classes in the classpath.
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24490825
has comment: http://stackoverflow.com/comment/37897827
has comment: http://stackoverflow.com/comment/37911635
has title: How to dynamically instantiating an class referring othere classes
tagged with: java
has comment: http://stackoverflow.com/comment/37913318
upvote count: 1

http://stackoverflow.com/q/24545089
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38011959
score: 1
tagged with: java
type: Question
tagged with: key-generator
has comment: http://stackoverflow.com/comment/38012035
has title: random secret key generator using fixed seed java
has comment: http://stackoverflow.com/comment/38014636
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24545505
accepted answer: http://stackoverflow.com/a/24545505
favorite count: 0
has comment: http://stackoverflow.com/comment/38011928
has body: I want to generate a secret key (128 bit) based upon some predefined seed value . Currently i am using javax.crypto.KeyGenerator (AES) to generate key using secureRandom . How can i pass my own seen rather than using secureRandom object . code i am currently using : // KeyGenerator kgen = KeyGenerator.getInstance("AES"); kgen.init(128,SecureRandom random); // 128 bits key size key = kgen.generateKey(); // Thank You ..

http://stackoverflow.com/a/24499961
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24499338
type: Answer
has body: Thanks for the input everyone. I figured out the issue - it's the fact that we're using a MapFragment that doesn't like our venue parcelable. Found the answer here: BadParcelableException in google maps code
score: 1

http://stackoverflow.com/comment/37920651
score: 0
type: AnswerComment
type: Comment
has text: so instead of putting my images and resorses in the other drawable i should just place them here, sorry i like being very specific
comment on: http://stackoverflow.com/a/24495653

http://stackoverflow.com/a/24525553
has comment: http://stackoverflow.com/comment/37977358
type: Answer
has comment: http://stackoverflow.com/comment/37978029
has comment: http://stackoverflow.com/comment/37978109
has comment: http://stackoverflow.com/comment/37981637
has comment: http://stackoverflow.com/comment/37979694
has comment: http://stackoverflow.com/comment/37980698
has comment: http://stackoverflow.com/comment/37979803
has body: Try removing UserDetails as argument to the method of @RequestMapping(value="displayForm", method=RequestMethod.GET) public String helloWorld(UserDetails ud) { return "loginPage"; } Hope this solves it.
has comment: http://stackoverflow.com/comment/37976360
has comment: http://stackoverflow.com/comment/37976153
score: 0
has comment: http://stackoverflow.com/comment/37979418
has comment: http://stackoverflow.com/comment/37977154
answers question: http://stackoverflow.com/q/24524916
has comment: http://stackoverflow.com/comment/37977044

http://stackoverflow.com/a/24526835
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24526583
has body: checkMethod(a3); Pass a copy of a value which is a reference to object instance of Car Inside method... a3.a = 5 Using a3, modify object instance of Car which is identified by a3 ( which is a copy of original a3). a3 = null Set the reference to null ( copy) When this happens, only the copy you passed to your method will point to null. But the original a3 still points to your object instance of Car.
answers question: http://stackoverflow.com/q/24526583
type: AcceptedAnswer
downvote count: 0
score: 1

stack
tags question: http://stackoverflow.com/q/24581818
tags question: http://stackoverflow.com/q/24568147
type: Tag
tag name: stack

http://stackoverflow.com/a/24521207
accepted answer of: http://stackoverflow.com/q/24520620
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37967131
answers question: http://stackoverflow.com/q/24520620
has comment: http://stackoverflow.com/comment/37967390
has comment: http://stackoverflow.com/comment/37967293
has comment: http://stackoverflow.com/comment/37967108
has comment: http://stackoverflow.com/comment/37967130
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37967355
has comment: http://stackoverflow.com/comment/37967063
has comment: http://stackoverflow.com/comment/37967283
type: Answer
has comment: http://stackoverflow.com/comment/37967652
has comment: http://stackoverflow.com/comment/37967184
has body: The instance variables up, down, right, left in InputHandler class are initialized with public Key up = new Key(); public Key down = new Key(); public Key right = new Key(); public Key left = new Key(); If input is a reference variable of InputHandler and an object of InputHandler is assinged to it, then the up, down, right and left can never be null based on above code. Therefore based on confirming the line 20 is if(input.up.isPressed()){ most possibly input is null. It will help us help you, if you can provide code where InputHander input is assigned an object if anywhere done so. Where in the code the key listener registered using addKeyListenter() method? And also the provided tick() method belongs to which class? From stacktrace it is evident that all three Player, Level and Game classes have method with same name tick() at ca.wamlab.game.entities.Player.tick(Player.java:20) at ca.wamlab.game.level.Level.tick(Level.java:38) at ca.wamlab.game.Game.tick(Game.java:169) Many important details are unknown to help with this. More details would be helpful.

http://stackoverflow.com/a/62945888
downvote count: 0
has body: Simply add @Validated annotation at the top of your class. Put whatever annotations for validations (@NotBlank, @Min(1), etc.) before the @RequestParam annotation in your method signature.
has comment: http://stackoverflow.com/comment/137924946
type: Answer
has comment: http://stackoverflow.com/comment/137925580
answers question: http://stackoverflow.com/q/24582842
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/137953337

http://stackoverflow.com/comment/37838482
score: 0
type: QuestionComment
type: Comment
has text: You might want to try enclosing your operation on the OverContent in `overContent.saveState(); PdfGState state = new PdfGState(); state.setFillOpacity(0.5f); overContent.setGState(state);` and `overContent.restoreState();`
comment on: http://stackoverflow.com/q/24444265

http://stackoverflow.com/comment/38144037
score: 0
type: AnswerComment
type: Comment
has text: Yes I know, the first day of week is dependent on the Locale. But maybe I was not quite clear. I referred to the line `calendar.set(Calendar.DAY_OF_WEEK, 1)`. The number 1 stands for the constant `Calendar.SUNDAY`. And the OP wants "07/21/2014" which is a Monday.
comment on: http://stackoverflow.com/a/24583600

http://stackoverflow.com/q/24453860
has comment: http://stackoverflow.com/comment/37844604
type: UnansweredQuestion
has body: I've been trying to implement a Scala application which makes POST request to given REST web services. In the request, there is a list of strings. I try to use scalaj but it only allows params as the map from String to String. So, I wonder if there is anyway to make a POST request containing the list of Strings in Scala, solutions in Java are also welcomed.
score: 0
tagged with: scala
tagged with: java
has comment: http://stackoverflow.com/comment/37844185
type: Question
has comment: http://stackoverflow.com/comment/37842214
has comment: http://stackoverflow.com/comment/37844236
tagged with: post
has comment: http://stackoverflow.com/comment/37842697
has answer: http://stackoverflow.com/a/24456048
has title: Making POST request containing a list
answer count: 1
has comment: http://stackoverflow.com/comment/37842317

http://stackoverflow.com/comment/37875894
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24472035
has text: What have you tried? Did you check out the [List API](http://docs.oracle.com/javase/7/docs/api/java/util/List.html)?

http://stackoverflow.com/comment/37879110
type: Comment
comment on: http://stackoverflow.com/a/24473760
has text: Well, this is a project in which I believe we are not supposed to change that specific line. Can we incorporate this any other way?
score: 0
type: AnswerComment

http://stackoverflow.com/a/24585483
answers question: http://stackoverflow.com/q/24585300
has body: Since the input is already sorted to compute range and median, you can use the following code to get the mode after a single loop and without any extra memory (live on ideone): // this must be sorted int[] values = {1, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 8}; int mode = values[0]; int modeOccurrences = 1; int occurrences = 1; int current = values[0]; for (int i = 1; i &lt; values.length; i++) { int value = values[i]; if (value == current) { occurrences++; } else { if (occurrences &gt; modeOccurrences) { mode = current; modeOccurrences = occurrences; } occurrences = 1; current = value; } } if (occurrences &gt; modeOccurrences) { mode = current; modeOccurrences = occurrences; } You can even generify this piece of code to work with plain objects instead of numerical types, provided modes can be sorted and compared (I used enums in my demo)
type: Answer
score: 0

http://stackoverflow.com/comment/37861618
comment on: http://stackoverflow.com/q/24464432
type: Comment
type: QuestionComment
score: 0
has text: what happens to `tb` in your original code ? It seems like it's getting garbage collected

http://stackoverflow.com/comment/38003008
type: Comment
type: QuestionComment
score: 0
has text: You construct the injector every time it is requested. Try making it a singleton.
comment on: http://stackoverflow.com/q/24539675

http://stackoverflow.com/comment/38006178
has text: and why the strange inport: `import com.google.gwt.thirdparty.streamhtmlparser.ParseException;`?
score: 1
comment on: http://stackoverflow.com/q/24541920
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27607365
upvote count: 3
type: Answer
has body: This answer may be late but I faced the same problem, none of the above answers helped me, to solve this problem, refer the following : http://blog.jonasbandi.net/2013/08/jboss-remote-ejb-invocation-unexpected.html The code that works for me is as below: Properties jndiProperties=new Properties(); jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); jndiProperties.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080/"); //This property is important for remote resolving jndiProperties.put("jboss.naming.client.ejb.context", true); //This propert is not important for remote resolving jndiProperties.put("org.jboss.ejb.client.scoped.context", "true"); Context context=new InitialContext(jndiProperties); /* java:global/JEETest_Project/EJBTest_Project/GenericStateless!test.stateless.GenericStateless java:app/EJBTest_Project/GenericStateless!test.stateless.GenericStateless java:module/GenericStateless!test.stateless.GenericStateless java:jboss/exported/JEETest_Project/EJBTest_Project/GenericStateless!test.stateless.GenericStateless java:global/JEETest_Project/EJBTest_Project/GenericStateless java:app/EJBTest_Project/GenericStateless java:module/GenericStateless */ //None of the above names work for remote EJb resolution ONLY THIS WORKS - //"/JEETest_Project/EJBTest_Project/GenericStateless!test.stateless.GenericStateless" GenericStateless bean=(GenericStateless)context.lookup("/JEETest_Project/EJBTest_Project/GenericStateless!test.stateless.GenericStateless"); //GenericStateless bean=(GenericStateless)c.lookup("GenericStateless!test.stateless.GenericStateless"); System.out.println(bean.getInt());
has comment: http://stackoverflow.com/comment/63034260
downvote count: 0
answers question: http://stackoverflow.com/q/24452075
score: 3

http://stackoverflow.com/comment/38079590
type: AnswerComment
comment on: http://stackoverflow.com/a/24581484
type: Comment
has text: @emory Oh dear lord, thank you. That totally threw me off; it now makes sense what the problem is. Marco, I'd probably explain what Emory is pointing out.
score: 0

http://stackoverflow.com/q/24485882
type: AnsweredQuestion
has title: Is there a java version of EGLImage to read pixel from OpenGL efficiently?
tagged with: opengl-es
tagged with: video-processing
type: Question
tagged with: android
tagged with: android-mediacodec
answer count: 1
has answer: http://stackoverflow.com/a/24494681
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24494681
has body: I'm working on video editing APP with the use of OpenGL. In Android version 4.2 or lower, I can apply shader codes on video frames in OpenGL, but I get a bottleneck on copying the video frames back to memory for video encoding, since surface input for video encoder is not available until Android 4.3. The traditional glReadPixels() gives unacceptable performance, and I'm trying to find alternatives. EGLImage(Reference 1, Reference 2) seems to be a good candidate, since it does not requires OpenGL ES 3.0. However, the related classes EGLImageKHR and the wrapper GraphicBuffer are written in C++, so it cannot be directly used in my APP, which use java to control the camera input and video decoder. Is there a same usage of EGLImageKHR or similar alternatives that can be used in java, or more precisely, incorporated with the Android MediaCodec architecture?

http://stackoverflow.com/comment/38056279
has text: Asserts in After and AfterClass methods are discouraged. Their sole purpose is to perform some tidyup after each test or all the tests.
comment on: http://stackoverflow.com/q/24568488
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38096921
type: AnswerComment
type: Comment
score: 1
has text: @chmod The mechanics of writing the native method itself should be the same as for dynamic natives. The differences with static are that you have to compile and link your native code to produce a static library, and then perform a second step to link that static library into the JVM itself.
comment on: http://stackoverflow.com/a/24544960

hql
tags question: http://stackoverflow.com/q/24431693
tag name: hql
tags question: http://stackoverflow.com/q/24551177
tags question: http://stackoverflow.com/q/24452911
tags question: http://stackoverflow.com/q/24570070
tags question: http://stackoverflow.com/q/24481429
type: Tag
tags question: http://stackoverflow.com/q/24427827
tags question: http://stackoverflow.com/q/24548945
tags question: http://stackoverflow.com/q/24508575
tags question: http://stackoverflow.com/q/24477900

http://stackoverflow.com/q/24526398
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/37976320
has body: What is the difference between this lines: List&lt;Object&gt; list = new ArrayList&lt;Object&gt;(); and List list = new ArrayList(); As i understand, all is object and when you do just List list, you just mentioned that.
accepted answer: http://stackoverflow.com/a/24526445
has answer: http://stackoverflow.com/a/24526461
downvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/37976384
has title: Difference between List<Object> and List
has comment: http://stackoverflow.com/comment/37976417
has answer: http://stackoverflow.com/a/24526606
has comment: http://stackoverflow.com/comment/37977103
possible better answer: http://stackoverflow.com/a/24526461
favorite count: 0
has answer: http://stackoverflow.com/a/24526516
has answer: http://stackoverflow.com/a/24526483
has answer: http://stackoverflow.com/a/24526654
has comment: http://stackoverflow.com/comment/37976821
has comment: http://stackoverflow.com/comment/37977162
upvote count: 6
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/24526445
tagged with: java
has answer: http://stackoverflow.com/a/61288311
has answer: http://stackoverflow.com/a/54204424

http://stackoverflow.com/q/24535610
tagged with: java
type: Question
tagged with: android-view
has answer: http://stackoverflow.com/a/24535873
has comment: http://stackoverflow.com/comment/37993875
has title: refresh android screen based on button
score: 0
has comment: http://stackoverflow.com/comment/37994009
accepted answer: http://stackoverflow.com/a/24535873
answer count: 1
tagged with: android-activity
has body: I am making a simple Reversi game for Android, and the problem I am having is that when the player makes a move, there is no delay between the player and the AI. So when the player makes a move, the next thing that the player will see is the AI's move. What I want is the player to make a move, the correct tiles are flipped, the AI makes a move, the correct tiles are flipped, repeat. I think what the issue is is that I am only using one Activity. Can this be achieved using one Activity using postInvalidate() or refreshDrawableState(), or do I need to have another (or multiple) activities?
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/24488308
upvote count: 2
has body: If you really want to do that (but IMHO you should not ...) you can use a filter that will block the application once it let an uncaught exception go. It could be something like : public class CrashFilter implements Filter { private boolean crashed = false; private String msg = "Major problem : application stopped"; @Override public void doFilter(ServletRequest sr, ServletResponse sr1, FilterChain fc) throws IOException, ServletException { if (crashed) { HttpServletResponse resp = (HttpServletResponse) sr1; resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); return; } try { fc.doFilter(sr, sr1); } catch (Exception ex) { crashed = true; throw new ServletException(ex); } } // init and destroy omitted from brevity }
has comment: http://stackoverflow.com/comment/37913403
has comment: http://stackoverflow.com/comment/37925450
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24456886
has comment: http://stackoverflow.com/comment/37914369
type: Answer
has comment: http://stackoverflow.com/comment/37914023

http://stackoverflow.com/q/24475506
has comment: http://stackoverflow.com/comment/37882595
tagged with: classcastexception
has title: ClassCastException in plugin loader
answer count: 0
tagged with: urlclassloader
type: UnansweredQuestion
type: Question
has body: I am currently experiencing another strange problem with Java. My goal was to make a small plugin system to provide an API for one of my applications. I managed to do such a thing and it works pretty good in Windows. But when I try to run the same application with the same plugin in Linux (Debian 7), it throws a ClassCastException. Here's the loader: public ArrayList&lt;ServerPlugin&gt; loadPlugins() throws ServerException { ArrayList&lt;ServerPlugin&gt; plugins = new ArrayList&lt;ServerPlugin&gt;(); File pluginDir = new File("plugins"); IMServer.getServer().getSystemLogger().log(Logger.INFO, "Plugin Folder: " + pluginDir.getAbsolutePath()); File[] jars = pluginDir.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith(".jar"); } }); try { for (File f : jars) { URLClassLoader loader = URLClassLoader.newInstance(new URL[] { f.toURI().toURL() }); ResourceBundle props = ResourceBundle.getBundle("plugin", Locale.getDefault(), loader); final String pluginClassName = props.getString("MainClass"); final String pluginName = props.getString("PluginName"); IMServer.getServer().getSystemLogger().log(Logger.INFO, "Enabling " + pluginName); Object pluginObject = loader.loadClass(pluginClassName).newInstance(); if (pluginObject instanceof ServerPlugin) { ServerPlugin plugin = (ServerPlugin) pluginObject; plugin.onLoad(); plugins.add(plugin); } } } catch (Exception ex) { IMServer.getServer().getSystemLogger().log(Logger.ERROR, "Unknown error in plugin system: \n"); ex.printStackTrace(); } return plugins; } As you can see, I tried to prevent the exception by building in an instanceof check. Now I don't get the exception but also the plugin is not loading (kinda obvious). And here is the code of the plugin: public class Plugin implements ServerPlugin { @Override public CommandList getCommandList() { CommandList commands = new CommandList(); commands.add("SEND"); return commands; } @Override public void onCommand(String command, String[…
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37882698

http://stackoverflow.com/comment/37915987
has text: Can you please post the error?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24493233
type: QuestionComment

http://stackoverflow.com/comment/37951862
has text: My bad, I've changed the answer to fix your problem. The reason one works, and the other not, is that you're passing a second argument to `exec`.
type: Comment
comment on: http://stackoverflow.com/a/24512538
score: 0
type: AnswerComment

http://stackoverflow.com/q/24451754
answer count: 2
has answer: http://stackoverflow.com/a/24451855
score: 0
has body: System.out.println("record:::" + recordXML); URL url = new URL(Constants + tableName + "/update?commit=true"); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/xml"); OutputStream os = conn.getOutputStream(); System.out.println("insertorupdate"); os.write(recordXML.getBytes()); os.flush(); here where i put the UTF-8 chracter support
has answer: http://stackoverflow.com/a/24451834
type: UnansweredQuestion
has title: How to write a data into database using outputstream UTF-8
tagged with: gwt
tagged with: java
type: Question

http://stackoverflow.com/a/24536853
has comment: http://stackoverflow.com/comment/38001424
answers question: http://stackoverflow.com/q/24518081
accepted answer of: http://stackoverflow.com/q/24518081
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38003996
has body: This is a bit of a guess, but I think the issue is that you're providing an input stream to the FXMLLoader instead of a URL. Because of this, the FXMLLoader is unaware of the location of the FXML resource, and hence it can't resolve the .. in the URL tag. This would explain the error message: null/../css/button.css javafx.fxml.LoadException: unknown path:23 The path you provided is relative to null because the FXMLLoader doesn't know the location of the FXML file; notice also it reports "unknown path" as the source of the FXML. Try this (which is more common anyway) fxmlLoader = new FXMLLoader(getClass().getResource("Document.fxml")); root = fxmlLoader.load(); I'm figuring it returns null for the controller only because there was an error in loading the fxml.
type: Answer

http://stackoverflow.com/q/24532072
has comment: http://stackoverflow.com/comment/37987162
has comment: http://stackoverflow.com/comment/37987014
has body: If i declared one scanner variable for a certain class in java. Can i use it to scan several inputs from the user ? For example at the beginning i want to scan an integer. The a double. And at the end a string. Will this work ?
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37987063
linked to: http://stackoverflow.com/q/7056749
tagged with: java
has comment: http://stackoverflow.com/comment/37987226
has comment: http://stackoverflow.com/comment/37986896
has answer: http://stackoverflow.com/a/24532272
type: Question
has comment: http://stackoverflow.com/comment/37986978
has comment: http://stackoverflow.com/comment/37988837
answer count: 1
has comment: http://stackoverflow.com/comment/37986850
has title: Can i use one Scanner variable for a whole class in java?

http://stackoverflow.com/comment/112709888
has text: which jenkins version did this work on? not on 2.220
score: 1
comment on: http://stackoverflow.com/a/52468162
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24569534
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24611642
type: Question
has body: org.spockframework:spock-core:0.7-groovy-2.0 Gradle 1.12 Groovy 1.8.6 java Hello, I am trying to use spock with my java application to run unit tests and building with gradle. However, since I am new to spock, I am not sure how I can pass in the actual parameters to get a correct output? This is the function signature I want to test, which takes in an inputStream, char[], and a String: public String makeRequest(InputStream keystoreFilename, char[] keystorePassword, String cnn_url) { ... } So in my test specification, I want to pass the keystore file as an inputStream where the actual keystore is located here ../resources/keystore.bks, and the actual password for the keystore and the url to where the web service is. However, I get this error when trying to run the unit test: groovy.lang.MissingMethodException: No signature of method: com.sunsystem.HttpSnapClient.SnapClientTest.FileInputStream() My specification test is below, but I think I am going about this the wrong way. import spock.lang.Specification; import java.io.InputStream; import java.io.FileInputStream; class SnapClientTest extends Specification { def 'Connect to https web service'() { setup: def snapzClient = new SnapzClient(); def inputStream = FileInputStream("../resources/keystore.bks") def keystorePwd = "password".toCharArray() def url = "https://example_webservice.com" expect: 'success when all correct parameters are used' snapzClient.makeRequest(A, B, C) == RESULT where: A | B | C | RESULT inputStream | keystorePwd | url | 0 } } Many thanks for any suggestions,
score: 5
has title: Passing actual parameters in a spock unit test specification
has comment: http://stackoverflow.com/comment/38140803
has answer: http://stackoverflow.com/a/24606148
tagged with: java
answer count: 3
tagged with: unit-testing
accepted answer: http://stackoverflow.com/a/24611642
possible better answer: http://stackoverflow.com/a/24606148
tagged with: spock
upvote count: 5
has answer: http://stackoverflow.com/a/24570794
tagged with: groovy
type: AnsweredQuestion

http://stackoverflow.com/a/24446700
has comment: http://stackoverflow.com/comment/37828773
has comment: http://stackoverflow.com/comment/37828693
answers question: http://stackoverflow.com/q/24446137
score: 0
has comment: http://stackoverflow.com/comment/37829187
has comment: http://stackoverflow.com/comment/37829219
type: Answer
has comment: http://stackoverflow.com/comment/37828974
has body: I think you are using Struts. Hence the solution would be, &lt;html:radio property="gender" value="Male"&gt; &lt;html:radio property="gender" value="Female"&gt; You cannot use collections property for radio button. There is no sense though on using collection for radio button. You have to create the radio button tags as much as you needed and while creating you have to specify the value for each radio button.
has comment: http://stackoverflow.com/comment/37829145

http://stackoverflow.com/comment/37917714
comment on: http://stackoverflow.com/a/24493641
type: AnswerComment
score: 0
type: Comment
has text: @kopytko That's why I stated _if the code guarantees it_. Assuming the logging code is within a critical section that's locked over, the log event is guaranteed to be put in the queue in sequential order. And since there is a single thread taking from the queue, it will also get it and log it in order.

http://stackoverflow.com/q/24543464
linked to: http://stackoverflow.com/q/9713058
has body: this is my code // assume var data has japanese characters xmlhttp.open("POST","adminUpdate?&amp;value="+data,true); // tried GET as well xmlhttp.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); xmlhttp.send(); if I insert alert(data) then i can see japanese characters perfectly fine. But on the server side (servlet class) when I add this code : String query = request.getParameter("value"); system.out.println(query) Now I see garbage value ?????? Ok so I added this line server side : System.out.println("content type : "+ request.getContentType()); and I got this : text/plain;charset=UTF-8 So now my question is if the encoding is set correctly then why I cant see Japanese characters
answer count: 1
tagged with: ajax
score: 0
has answer: http://stackoverflow.com/a/24543502
has comment: http://stackoverflow.com/comment/38008945
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24543502
tagged with: java
has title: xmlhttp.setRequestHeader not working
tagged with: character-encoding
tagged with: servlets
type: Question

http://stackoverflow.com/comment/37983250
score: 0
type: AnswerComment
type: Comment
has text: @Sirs One cannot subclass an enum anyway, who cares if it's final or not?
comment on: http://stackoverflow.com/a/24529877

http://stackoverflow.com/q/24508753
tagged with: web-services
tagged with: spring
type: AnsweredQuestion
tagged with: cxf
has body: I wrote a ws-security service that works very well so far. I have just one problem. My service can only be user from a single client... that is because of the service-config.xml where I need to name the explicit user I want the outgoing message encrypted for. My beans for the service look like this <entry key="action" value="Timestamp Signature Encrypt"/> <!-- Use this action spec for WCF clients <entry key="action" value="Signature Encrypt Timestamp"/> --> <entry key="signaturePropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/alice.properties"/> <entry key="decryptionPropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/bob.properties"/> <entry key="passwordCallbackClass" value="de.narz.apacheCXFTest.helloWorld.passwordHandling.PasswordCallbackHandler"/> <entry key="action" value="Timestamp Signature Encrypt"/> <entry key="user" value="bob"/> <entry key="signaturePropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/bob.properties"/> <entry key="encryptionPropFile" value="de/narz/apacheCXFTest/helloWorld/keyManagement/config/alice.properties"/> <entry key="signatureKeyIdentifier" value="DirectReference"/> <entry key="encryptionUser" value="Alice"/> <entry key="passwordCallbackClass" value="de.narz.apacheCXFTest.helloWorld.passwordHandling.PasswordCallbackHandler"/> <entry key="signatureParts" value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body"/> <entry key="encryptionParts" value="{Element}{http://www.w3.org/2000/09/xmldsig#}Signature;{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body"/> <entry key="encryptionSymAlgorithm" value="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/> what can I do to force the service to determine the client alice by itself? Like this my alice-client is the only one that is able to communicate with the server. I want to store several client-keys in my keystore an…
score: 1
tagged with: java
has title: apache cxf - how to resolve client certificates in keystore
accepted answer: http://stackoverflow.com/a/24537042
type: Question
tagged with: ws-security
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24537042
upvote count: 1

http://stackoverflow.com/comment/38127797
comment on: http://stackoverflow.com/q/24584594
type: Comment
type: QuestionComment
has text: So what does 'zero byte lock file' have to do with it? And why are you reading data and throwing it away? Three separate times? And, again, why is this a problem in the first place? If you can't read a file, for *any* reason, you can't copy it. So, if you get an IOException when copying, just close everything and delete the target file: it's invalid, incomplete, or empty.
score: 0

http://stackoverflow.com/comment/38077390
type: AnswerComment
comment on: http://stackoverflow.com/a/24570357
has text: wait, why do you have separate entity for one-to-many association? If FK was stored in Attachment table, then mentioned by you `Attachment.findById().delete()` would work as expected.
score: 0
type: Comment

http://stackoverflow.com/comment/38011554
comment on: http://stackoverflow.com/q/24544907
type: Comment
type: QuestionComment
has text: What do you expect ? `Request` is not a `String`
score: 1

http://stackoverflow.com/comment/39133413
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25120778
has text: @shivi I added a screen shot showing it in the Package Explorer.
type: AnswerComment

http://stackoverflow.com/comment/38064053
type: Comment
type: QuestionComment
has text: Search for _baby names_.
comment on: http://stackoverflow.com/q/24573132
score: 0

http://stackoverflow.com/a/24518544
has comment: http://stackoverflow.com/comment/37961935
has comment: http://stackoverflow.com/comment/37995489
has body: If im understanding your question right, and you want the sum of the first, second, third, etc. columns then you could try the following. // array for the sums of the columns int[] colSums; int largestSize = 0; // loop through and find the largest array of values (in this example its the 4th) for(int x = 0; x &lt; data.length; x++) { largestSize = Math.max(largestSize,data[x].length); } colSums = new int[largestSize]; // create the int array with the right length // loop through the data array and add sums to the colSums array for(int x = 0; x &lt; data.length; x++) { colSums[x] = 0; // so that its not null when we add to it for(int y = 0; y &lt; data[x].length; y++) { // here I add the number to the solSums array colSums[y] += data[x][y]; } } // now colSums[0] will be the sum of the first column, colSums[1] = sum of second, etc...
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24518180

http://stackoverflow.com/comment/38041416
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24560988
has text: Thank you very much. That worked. That is so stupid that you have to tell java this though.
score: 0

http://stackoverflow.com/comment/48603417
comment on: http://stackoverflow.com/q/24505847
type: Comment
type: QuestionComment
has text: there is one web application available probe.war. deploy it in your tomcat so you can see graph of memory usage and you can find what is the root cause
score: 0

http://stackoverflow.com/q/24533233
answer count: 2
has answer: http://stackoverflow.com/a/24535856
downvote count: 0
has answer: http://stackoverflow.com/a/27262971
favorite count: 0
has comment: http://stackoverflow.com/comment/37989219
tagged with: android
possible better answer: http://stackoverflow.com/a/27262971
has title: How can I make ZXing Barcode Scanner compatible with 2.2 and above Android
accepted answer: http://stackoverflow.com/a/24535856
upvote count: 1
type: AnsweredQuestion
has body: I want ZXing Barcode Scanner compatible with android 2.2 and above. What I did - I used Zing 2.3.0 in my application and its perfectly working in 4.0 and above but when I run in android 2.2 and I click the button to start scanner the application got crashed. What extra I need to implement ?? Note: I have added CaptureActivity project from zxing as a library in my project and CaptureActivity and MyProject in both the menifest file minsdk is 8 and targeted is 17
tagged with: backwards-compatibility
score: 1
tagged with: java
tagged with: zxing
type: Question

http://stackoverflow.com/a/42338314
answers question: http://stackoverflow.com/q/24571571
score: 0
has body: I am explaining the full code of getting inputStream from FTP server and then how to read data from that inputstream. I am assuming, you are using TLS/SSL security layer. public FTPSClient makeFTPConnection(String vserver, int vport, String vuser, String vpassword) { LOGGER.debug("ENTRY"); try { ftpClient = new FTPSClient(); } catch (NoSuchAlgorithmException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { ftpClient.connect(vserver, vport); ftpClient.login(vuser, vpassword); ftpClient.execPBSZ(0); ftpClient.execPROT("P"); ftpClient.changeWorkingDirectory("/"); ftpClient.changeWorkingDirectory("/feeds"); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); } catch (Exception e) { LOGGER.error(e.getMessage()); } /* // int reply=ftpClient.getReply(); String replyStr=ftpClient.getReplyString(); ftpClient.getAuthValue();*/ LOGGER.debug("EXIT"); return ftpClient; } Then after making the connection, we will check weather file exist at ftp or not. public InputStream checkWOFileExistAtFTP(FTPSClient ftpClient, String host,String user, String filePath) throws IOException { int returnCode; // filePath="ftp://"+user+"@"+host+"/"+filePath; InputStream inputStream = ftpClient.retrieveFileStream(filePath); String dd=ftpClient.getReplyString(); returnCode = ftpClient.getReplyCode(); if (inputStream == null || returnCode == 550) { return null; } return inputStream; } Now we already got the inputStream in above method now its time to read data from it. BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); System.out.println("Reading file start."); char[] charBuffer = new char[8 * 1024]; StringBuilder builder = new StringBuilder(); int numCharsRead; while ((numCharsRead = br.read(charBuffer, 0, charBuffer.length)) != -1) { builder.append(charBuffer, 0, numCharsRead); } //will print all data system.out.println(builder.toString());
type: Answer

http://stackoverflow.com/comment/37917560
type: AnswerComment
comment on: http://stackoverflow.com/a/24492108
has text: @Feuermurmel He checked out the source code and saw that List.add(e) delegates to another signature to finally throw the exception while Set.add(e) directly throws.
type: Comment
score: 2

http://stackoverflow.com/comment/37821251
type: QuestionComment
comment on: http://stackoverflow.com/q/24442463
type: Comment
has text: Then either you didn't search hard enough or in the right direction, for [example](http://stackoverflow.com/questions/6091531/how-to-get-the-x-and-y-of-a-program-window-in-java)
score: 0

http://stackoverflow.com/comment/37957995
comment on: http://stackoverflow.com/a/24515106
type: AnswerComment
score: 0
type: Comment
has text: I am trying to find a way to use this code without resorting to a command line check. Is my shutdown method correct?

http://stackoverflow.com/q/24503914
has answer: http://stackoverflow.com/a/24506347
has title: Deactivate the Touch Event for empty or null text
tagged with: java
has answer: http://stackoverflow.com/a/24503987
accepted answer: http://stackoverflow.com/a/24503987
score: 0
answer count: 2
has body: I have an text where i activate the Touch Event. Now i want that if my text is empty or null or there is hint displayed on it, then the Touch event must deactivated. text1.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(text1.equals("")){ } else{ switch (event.getAction()) { case MotionEvent.ACTION_DOWN: text1.setBackgroundColor(Color.RED); InputConnection ic = getCurrentInputConnection(); ic.commitText(textOne, 1); break; case MotionEvent.ACTION_UP: text1.setBackgroundColor(Color.YELLOW); break; } } return true; } } But when i touch my text for above specified conditions, it will crash the screen as well as Touch is still activated. Any suggestions?
possible better answer: http://stackoverflow.com/a/24506347
tagged with: android
tagged with: textview
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/38025646
score: 3
comment on: http://stackoverflow.com/q/24552821
type: QuestionComment
type: Comment
has text: Yes, we can. But, what have you tried already?

http://stackoverflow.com/q/24445473
upvote count: 2
has answer: http://stackoverflow.com/a/24450654
has body: I want to read this default block size value from hdfs-site.xml using a java program ? Can anyone help in this ? dfs.blocksize 134217728
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/24624633
type: Question
tagged with: hadoop
answer count: 2
has title: Read default block size of HDFS using Java API
downvote count: 0
tagged with: hdfs
favorite count: 0
has answer: http://stackoverflow.com/a/24624633
has comment: http://stackoverflow.com/comment/37829972
possible better answer: http://stackoverflow.com/a/24450654

http://stackoverflow.com/comment/38038882
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24559433
has text: Upper-casing the name will solve the problem, but could be a little distracting for a reader, since upper-case names are mostly used as constants or `enum` objects under the standard Java coding conventions. I tend to use names like `needToContinue` or `willContinue`, which are more descriptive than `continue` would be even if it were allowed.

http://stackoverflow.com/q/24558099
tagged with: split
possible better answer: http://stackoverflow.com/a/24558370
has comment: http://stackoverflow.com/comment/38036173
has answer: http://stackoverflow.com/a/24558370
has comment: http://stackoverflow.com/comment/38036196
answer count: 3
has answer: http://stackoverflow.com/a/24558458
has body: I got stuck with an issue, that I can't seem to solve. When splitting I should be able to get id, name, check by setting row[0], row[1], row[2]. Strangely only row[0] (id) seem to work. Name, check gives me an error. Could someone help me further? Example of data: id,name,check 1,john,0 1,patrick,0 1,naruto,0 Code: ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;(); try { DataInputStream dis = new DataInputStream(openFileInput(listLocation(listLoc))); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); String line; while ((line = br.readLine()) != null) { String[] row = line.split(Pattern.quote(",")); //names.add(row[0]); // id names.add(row[1]); // name // ERROR AT THIS LINE //names.add(row[2]); // check } br.close(); } catch (IOException e) { e.printStackTrace(); } Error message: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 Solved It seems I had an incorrect value (question marks) at end of file. When removing this line. My code worked (without Patter.quote). Thank you all for fast reply's. First answer helped me on reminding me of using Log value where I could see the 'incorrect value'. My bad.
has comment: http://stackoverflow.com/comment/38036721
has title: Splitting error- IndexOutOfBoundsException
downvote count: 0
has comment: http://stackoverflow.com/comment/38036255
favorite count: 0
accepted answer: http://stackoverflow.com/a/24558458
has comment: http://stackoverflow.com/comment/38035739
tagged with: android
has comment: http://stackoverflow.com/comment/38036231
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24559307
upvote count: 1
has comment: http://stackoverflow.com/comment/38036649
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/38136309
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24573593
has text: Have you added that `jar` to your project you have to first extract the downloaded .zip file and than use jar file.You can check in the link that the required class is there in jar.

http://stackoverflow.com/comment/37910688
type: AnswerComment
type: Comment
has text: @theUndisputedHacker Yes `if (e.getSource().equals(c1)&& c1.getState()== true)` e.getSource() gives you the element which is clicked and getState() gives you the information if it is checked or unchecked.
comment on: http://stackoverflow.com/a/24490291
score: 0

http://stackoverflow.com/a/24531361
has comment: http://stackoverflow.com/comment/37986285
downvote count: 0
score: 1
has body: It's ocorring because of line $("#datatoexport").val($("#customers").html()); where the Jquery method .html retrieve the entire html from the html table. There is not easy way to extract text from a html table, you will need a parse function in jquery like in this post: Getting text from td cells with jQuery In adiction, the sample that you post isn't the best form to request a server processing text, look in this How to use Servlets and Ajax?
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24530852

http://stackoverflow.com/comment/37946365
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24509601
has text: And fetching part as well please
score: 0

http://stackoverflow.com/comment/37870634
score: 0
type: Comment
has text: How? Show me an example, please.
comment on: http://stackoverflow.com/a/24469251
type: AnswerComment

http://stackoverflow.com/comment/37953350
type: AnswerComment
score: 0
type: Comment
has text: Thank you for explaining the break when using a switch!
comment on: http://stackoverflow.com/a/24513934

http://stackoverflow.com/comment/37905109
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24487152
has text: @marshall Josh Blosh describes the Eagerly singleton in detail, have you read that? (Effective Java 2n Ed.) I have access to the book on some hours.

http://stackoverflow.com/comment/38023324
comment on: http://stackoverflow.com/q/24551412
has text: Btw, Googled "rest level 2" and found nothing but beds.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24543502
has comment: http://stackoverflow.com/comment/38009082
has comment: http://stackoverflow.com/comment/38009058
type: Answer
accepted answer of: http://stackoverflow.com/q/24543464
has comment: http://stackoverflow.com/comment/38009135
has comment: http://stackoverflow.com/comment/38009424
answers question: http://stackoverflow.com/q/24543464
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38010117
has body: One option is to send the query parameters as part of the request body and have the content type set to application/x-www-form-urlencoded. Then, before getting the parameter, set the request's content character encoding request.setCharacterEncoding("UTF-8"); String query = request.getParameter("value"); Note that wherever you're printing the query value has to be able to display UTF-8 encoded characters.
downvote count: 0
has comment: http://stackoverflow.com/comment/38009154
has comment: http://stackoverflow.com/comment/38009414
type: AcceptedAnswer

http://stackoverflow.com/comment/37878221
score: 0
comment on: http://stackoverflow.com/q/24473260
type: Comment
has text: Do I need to create two .java files with the same file name? one has the interface and the other has the implementation definition?
type: QuestionComment

http://stackoverflow.com/q/24582315
tagged with: swing
has comment: http://stackoverflow.com/comment/38081099
has title: Get notified by any change on DefaultComboBoxModel
has comment: http://stackoverflow.com/comment/38081139
tagged with: java
type: Question
has body: I have two JComboBox with the same DefaultComboBoxModel, when i want to add/remove an element i use the correct methods addElement and removeElementAt and the two JComboBox are correctly updated, but i want to be notified that the model has changed, is there any tricks to be notified by the DefaultComboBoxModel ?
has comment: http://stackoverflow.com/comment/38081092
score: 0
has comment: http://stackoverflow.com/comment/38081097
tagged with: jcombobox
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38081158

http://stackoverflow.com/q/24564684
accepted answer: http://stackoverflow.com/a/24570708
has answer: http://stackoverflow.com/a/24567146
downvote count: 1
has comment: http://stackoverflow.com/comment/38052148
tagged with: java
tagged with: servlets
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38059413
tagged with: jsp
has comment: http://stackoverflow.com/comment/38058833
has answer: http://stackoverflow.com/a/24570708
favorite count: 0
has body: Have seen many similar problem but decision did not found. Problem: Browser show code of servlet instead of perform this servlet. Here is index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> Link Here is LoginServlet import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("Hello World"); out.flush(); } } web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> LoginServlet LoginServlet LoginServlet /LoginServlet I would appreciate any help.
type: Question
has title: Browser Displays HTML Code from Servlet
possible better answer: http://stackoverflow.com/a/24564726
has answer: http://stackoverflow.com/a/24567452
has answer: http://stackoverflow.com/a/24564726
score: 0
upvote count: 1

http://stackoverflow.com/comment/38021019
comment on: http://stackoverflow.com/a/24548793
type: AnswerComment
has text: ah, some program we wrote, it's a crawler, it just goes around clicking links and whatnot
score: 0
type: Comment

http://stackoverflow.com/q/24587146
has body: This is my code: public class CustomGridAdapter extends BaseAdapter{ Context ctx; String [] items ={"72","58","67","77","90"} ; //Can be images or video or any other content String [] stuff = {"bus to town ","Bus to north","Bus to west","Bus to east","Bus out"}; public CustomGridAdapter(Context c) { ctx = c; } @Override public int getCount() { return items.length; } @Override public Object getItem(int position) { return items[position]; } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView tv = new TextView(ctx); TextView tv2 = new TextView(ctx); tv.setText(String.valueOf(items[position])); tv2.setText(String.valueOf(stuff[position])); return tv; } } Need help trying to figure out how to display tv2 below tv . Any suggestion?
tagged with: android
score: -3
has title: Custom grid view
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24587234
tagged with: java
downvote count: 3
type: Question
tagged with: android-layout
upvote count: 0
accepted answer: http://stackoverflow.com/a/24587234
tagged with: android-gridview
answer count: 1
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/38089753

http://stackoverflow.com/comment/38064544
comment on: http://stackoverflow.com/q/24573492
has text: What is `SqlArrayExtractor`? Your own class or from some library?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24545862
downvote count: 0
has body: How to retrieve the large data using cassandra DB. I am using cassandra 1.1.7. with 32 GB RAM and 1 TB hard disk. Successfully, I can insert the record in to it. While I am trying to retrieve the data Eg: select * from table name (or) select count(*) from tablename; Cassandra server may crashed or shutdown (Table contains 300k rows with 10 columns). It shows error: Adjust the flush_largest_memtables_at_threshold size in yaml or clear cache size And JVM heap-dump error it created the pid-XXX.hprof files in cassandra/bin folder. In cassandra-env.sh, I set: MAX_HEAP_SIZE="27G" HEAP_NEWSIZE="2G" In cassandra.yaml I have set: memtable_total_space_in_mb: 100 Day by day we are inserting 100k above data per table so the cassandra data size may increased 1G per day. So whether I need to increase My RAM size along with it?
favorite count: 0
has title: Cassandra Server Crashes when we try to retrieve Large data
tagged with: cassandra
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24554778
type: Question
has answer: http://stackoverflow.com/a/24559004
score: 3
tagged with: java
answer count: 2

http://stackoverflow.com/q/24481823
has comment: http://stackoverflow.com/comment/37898634
has comment: http://stackoverflow.com/comment/37894667
type: Question
linked to: http://stackoverflow.com/q/16880677
tagged with: performance
has comment: http://stackoverflow.com/comment/38081305
has body: I'm making a scrolling 2D map/tile based game. Each tile (stored as tile[21][11] - 231 tiles total per map) can contain up to 21 values (stored as int[3][7]). While full-screen I see about 8 maps at once. On average, each map takes about 0.03 seconds to draw (found with System.nanoTime). The problem is that as soon as more than 1 map is on the screen, the Swing event polling noticeably slows down. Is there any solution to this? I can't draw the map a single time to save it as an image because it has transparency involving moving actors, so it changes too frequently. Also I don't think I can call a thread in paintComponent to draw the maps without it glitching out, but I'm not positive.
has answer: http://stackoverflow.com/a/24488837
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24488837
favorite count: 0
has title: Java Swing heavy/slow paintComponent - any advice?
has comment: http://stackoverflow.com/comment/37894843
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/37895232
linked to: http://stackoverflow.com/q/23145439
has comment: http://stackoverflow.com/comment/37894938
type: AnsweredQuestion
tagged with: paint
linked to: http://stackoverflow.com/q/2064427
score: 1
linked to: http://stackoverflow.com/q/7423537
tagged with: java
linked to: http://stackoverflow.com/q/3256269
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/37960162
has text: As best I can tell, none of the xml parsers shipped with the jre (sax, stax, or dom) will NOT parse invalid xml (though it has been a few years since I tried this). The only parse I found that would allow these characters (with escaping) was electric xml, which is fairly difficult to track down now.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24517087

http://stackoverflow.com/comment/37973729
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24524920
score: 0
has text: looks like there is a missing jar or an incompatible version of jar being used.

http://stackoverflow.com/q/24517814
possible better answer: http://stackoverflow.com/a/24518240
has title: Maven folder layout: Should I place tests in the EAR or its sub-modules?
answer count: 2
has body: We have an EAR project with several sub-modules (multiple EJBs, Web Projects, Application Clients, etc). The natural scope for unitary tests are their respective sub-modules (since they are supposed to be testing isolated units). In a short amount of time we have introduced non obvious testing dependencies. Projects were mocking functionality from other projects, etc. Soon our architecture evolved to several stand-alone jar files with mocks (web project 1 mocks, ejb 2 mocks, etc); we wire those mocks against the EAR and consume the mocks in the sub-modules ("Skinny War" style). EAR Modules WEB 1 WEB 2 EJB 2 EJB 3 etc Libs Shared library 1 Shared Library 2 Testing dependencies WEB 1 mocks WEB 2 mocks EJB 1 mocks EJB 2 mocks etc WEB1 Uses EJB 1 and EJB 3 Uses Shared Library 1 Testing Consumes EJB 1 and EJB 2 mocks Anyway, the consensus among our team is that mocks are getting out of control. We want to evolve towards Arquillian and testing inside the container (e.g., towards Integration tests). We are also introducing ATTD (initially just functional tests with Drone, but I wish to have a fully functional Thucydidies + JBehave or EasyB setup soon). Tests may depend on resources from multiple sub-modules. ShrinkWrap is there to guarantee that things do not get out of hand. So my question is: Where should I put tests, stories, Arquillian configuration files and so on? I feel like the EAR is the best place to group everything: EAR Modules Test src Java Test 1 Test 2 Resources Configuration Files Stories Story 1 Story 2 This would allow us to have a single unified report, forget about inter-modular dependencies, have a single point of configuration and so on. But I might be wrong (working with per-module granularity have its advantages). So what is considered best practice for Arquillian tests: Should I place my test files in the EAR Project? Should I place integration / acceptance tests in the EAR project and unitary tests in the sub-modules? Or should I put everything in…
downvote count: 0
has answer: http://stackoverflow.com/a/24580572
favorite count: 0
tagged with: maven
tagged with: module
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24518240
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24580572
upvote count: 1
tagged with: integration-testing
type: Question
tagged with: jboss-arquillian

jetty
tags question: http://stackoverflow.com/q/24452909
tag name: jetty
tags question: http://stackoverflow.com/q/24531889
tags question: http://stackoverflow.com/q/24506636
tags question: http://stackoverflow.com/q/24544699
tags question: http://stackoverflow.com/q/24476410
tags question: http://stackoverflow.com/q/24525419
tags question: http://stackoverflow.com/q/24577458
type: Tag
tags question: http://stackoverflow.com/q/24582058
tags question: http://stackoverflow.com/q/24527959
tags question: http://stackoverflow.com/q/24480442

http://stackoverflow.com/comment/37802482
type: QuestionComment
has text: possible duplicate of [Remove URL parameters in GWT](http://stackoverflow.com/questions/20036194/remove-url-parameters-in-gwt)
type: Comment
comment on: http://stackoverflow.com/q/24431996
score: 0

http://stackoverflow.com/q/24481542
upvote count: 1
has title: How to connect string REST with JPA?
has answer: http://stackoverflow.com/a/24485562
has comment: http://stackoverflow.com/comment/37898893
type: Question
has answer: http://stackoverflow.com/a/31100981
accepted answer: http://stackoverflow.com/a/31100981
answer count: 3
has body: I'm following the guide at http://spring.io/guides/gs/accessing-data-rest/ , which is like the hello world for this... GET requests works perfectly, but when trying the POST they suggest (I'm using Rest Client Chrome extension), with json { "firstName" : "Frodo", "lastName" : "Baggins" } I get the following error: { cause: { cause: null message: "Unrecognized token 'firstName': was expecting 'null', 'true', 'false' or NaN at [Source: org.apache.catalina.connector.CoyoteInputStream@29508db1; line: 1, column: 11]" } message: "Could not read JSON: Unrecognized token 'firstName': was expecting 'null', 'true', 'false' or NaN at [Source: org.apache.catalina.connector.CoyoteInputStream@29508db1; line: 1, column: 11]; nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'firstName': was expecting 'null', 'true', 'false' or NaN at [Source: org.apache.catalina.connector.CoyoteInputStream@29508db1; line: 1, column: 11]" } How can I fix this? Why is it happening?
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/40445018
favorite count: 0
tagged with: rest
tagged with: spring
has answer: http://stackoverflow.com/a/31100298
has comment: http://stackoverflow.com/comment/37900036
possible better answer: http://stackoverflow.com/a/24485562
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40444250

apache-spark
tags question: http://stackoverflow.com/q/24526419
tags question: http://stackoverflow.com/q/24540067
tags question: http://stackoverflow.com/q/24450540
tags question: http://stackoverflow.com/q/24534410
tags question: http://stackoverflow.com/q/24463055
tags question: http://stackoverflow.com/q/24554625
tags question: http://stackoverflow.com/q/24451124
tags question: http://stackoverflow.com/q/24560107
tags question: http://stackoverflow.com/q/24471561
tag name: apache-spark
tags question: http://stackoverflow.com/q/24519660
type: Tag

javadb
tags question: http://stackoverflow.com/q/24586043
tag name: javadb
type: Tag

http://stackoverflow.com/q/24474986
answer count: 2
has answer: http://stackoverflow.com/a/24475540
favorite count: 0
score: 8
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/41914564
has body: I've programmed a game for android, everything works fine, but now I want my app to have Google play Games services (leaderboards and achievements). I used the Google example code to log in to the Google services (no errors in the script), but every time I want to connect with my App in debug mode, I get this error: 6-29 11:48:29.391 23779-23779/com.JFKGames.theepicbutton E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.JFKGames.theepicbutton, PID: 23779 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=9001, result=10004, data=null} to activity {com.JFKGames.theepicbutton/com.JFKGames.theepicbutton.MainActivity}: java.lang.IllegalStateException: GoogleApiClient must be connected. at android.app.ActivityThread.deliverResults(ActivityThread.java:3446) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3489) at android.app.ActivityThread.access$1300(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5102) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: GoogleApiClient must be connected. at com.google.android.gms.internal.fq.a(Unknown Source) at com.google.android.gms.games.Games.c(Unknown Source) at com.google.android.gms.games.internal.api.LeaderboardsImpl.submitScore(Unknown Source) at com.google.android.gms.games.internal.api.LeaderboardsImpl.submitScore(Unknown Source) at com.JFKGames.theepicbutton.MainActivity.onActivityResult(MainActivity.java:79) at android.app.Activity.dispatchActivityResult(Activity.java:5446) at and…
downvote count: 0
tagged with: java
upvote count: 8
type: Question
has title: Android: Google play games services connection error ( java.lang.IllegalStateException: GoogleApiClient must be connected.)
tagged with: google-play-services

http://stackoverflow.com/comment/37981206
type: Comment
comment on: http://stackoverflow.com/a/24479997
has text: yes, that's my point. if i use `abs`, then it is like half normally distributed. Anyway, to move the whole distribution rightwards to positives?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26772174
score: 1
has body: mBTAdapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice mdevice = mBTAdapter.getRemoteDevice(PRINTER_MAC_ID); Method m = mdevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class }); mBTSocket = (BluetoothSocket) m.invoke(mdevice, 1); mBTSocket.connect(); Thread.sleep(100); After Socket Connect put thread to sleep ..This worked for me
upvote count: 1
answers question: http://stackoverflow.com/q/24569410
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38015797
comment on: http://stackoverflow.com/q/24546966
has text: @sakhunzai In my case I have same package name also. This link states about Same class name.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24443725
tagged with: java
has comment: http://stackoverflow.com/comment/40053085
has comment: http://stackoverflow.com/comment/40067684
has comment: http://stackoverflow.com/comment/40291585
upvote count: 4
has comment: http://stackoverflow.com/comment/40093562
answer count: 2
has body: On Android I sometimes do the following with an image. It never gets past the bitmapPicture.compress line - it seems to just sit there and hang. The line above where I get the byte count returns 40000. I never see compress done, or any other output after 'compress'. try { final int COMPRESSION_QUALITY = 100; String encodedImage; ByteArrayOutputStream byteArrayBitmapStream = new ByteArrayOutputStream(); Log.e("Error","compress" + bitmapPicture.getByteCount()); bitmapPicture.compress(Bitmap.CompressFormat.PNG, COMPRESSION_QUALITY, byteArrayBitmapStream); Log.e("Error","compress done"); byte[] b = byteArrayBitmapStream.toByteArray(); Log.e("Error","bytear"); encodedImage = Base64.encodeToString(b, Base64.DEFAULT); Log.e("Error","JSONDATA encodedImage Returned"); return encodedImage; } catch (Exception e) { ErrorLogger.AddError(e.getMessage(), 199); Log.e("Error","JSONDATA Error"+e.getMessage()); return null; }
downvote count: 0
has answer: http://stackoverflow.com/a/25719961
has title: call to Bitmap.compress does not return - and NO exception
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40001531
has comment: http://stackoverflow.com/comment/40246374
tagged with: android
has comment: http://stackoverflow.com/comment/39941400
type: UnansweredQuestion
tagged with: bitmap
has answer: http://stackoverflow.com/a/25657103
type: Question
has comment: http://stackoverflow.com/comment/40166393

http://stackoverflow.com/q/24550896
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
downvote count: 0
favorite count: 0
tagged with: android
tagged with: animation
has title: Android - How to choose the right animation class?
score: 2
answer count: 0
has body: Assuming you have some experience with Android animations, you probably know that there are many ways to create an animation in Android, so many that it gets confusing! Currently I'm developing a game that has about 100 different objects on the screen that need to be animated at all times, a task - that as I understand it - may cost lots of CPU. So, my questions are: What is the best Animation class to use in a case like this? What will be the right approach to go about that? NOTE: THE ANIMATED OBJECTS PARAMETERS MUST TO BE CONTROLLED AND CHANGED FROM JAVA AT RUN TIME, SO XML ANIMATION IS NOT A SUITABLE SOLUTION. Any code snippets will be very much appreciated!!

http://stackoverflow.com/comment/37914584
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24492365
has text: other wise i have to pass DataSource instance to the class...i dont know actually how to write test cases.So i m bit stuck here.I dont know which approach is better.It will be g8 if u can guide me.
type: Comment

http://stackoverflow.com/comment/38091305
type: Comment
type: QuestionComment
has text: Pless post relevant code.
score: 0
comment on: http://stackoverflow.com/q/24587991

http://stackoverflow.com/comment/37980192
score: 0
comment on: http://stackoverflow.com/q/24528335
type: Comment
has text: Would it be better if the municipalities will be queried just once, e.g. preloaded?
type: QuestionComment

http://stackoverflow.com/a/24547242
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: if (request.getParameter("value") == "Mobile") { electronicType = "Mobile Phone"; } This is wrong,for comparison in java you need to use .equals So your code should be if (request.getParameter("value").equals("Mobile")) { electronicType = "Mobile Phone"; } == you can use for number or if you want to check if an object is null For example if(object == null) But for Strings you need to use .equals Read the SO post that Sotirios Delimanolis has suggested And in your electronicType use JSP tags like this <%=electronicType%> Or a better way <c:out value="${electronicType}" />
answers question: http://stackoverflow.com/q/24547145
accepted answer of: http://stackoverflow.com/q/24547145

http://stackoverflow.com/comment/37836598
comment on: http://stackoverflow.com/a/24451024
has text: well, thanks for such a great answer, but iam a really newbie in ldap. Can you share any tutorial to use http://docs.spring.io/spring-ldap/docs/2.0.2.RELEASE/reference/#odm also how can i create ou units ? I couldn't create one.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/83513021
type: AnswerComment
type: Comment
has text: Setting click for any part of view in `RecyclerView.ViewHolder` leads to incorrect processing of touch events. For example, if you would like to implement **SnapHelper** for such RecyclerView, `OnClickListener` will override `OnTouchListener` in **SnapHelper** and last one won't receive `MotionEvent.ACTION_DOWN` events.
comment on: http://stackoverflow.com/a/24746411
score: 0

http://stackoverflow.com/a/24507937
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24507885
upvote count: 1
has body: Put a=10 into bracket eq int b=1*(a=10); Java can not resolve 1*a=10 as variable because Operator Precedence and 1*a is expression
type: Answer

http://stackoverflow.com/q/24508547
has answer: http://stackoverflow.com/a/24509035
upvote count: 1
tagged with: poi-hssf
has comment: http://stackoverflow.com/comment/37943503
type: Question
possible better answer: http://stackoverflow.com/a/24508689
answer count: 2
tagged with: jdbc-odbc
downvote count: 0
has comment: http://stackoverflow.com/comment/37943806
accepted answer: http://stackoverflow.com/a/24509035
has comment: http://stackoverflow.com/comment/37943637
has comment: http://stackoverflow.com/comment/37943394
favorite count: 0
has title: Inserting values from Excel to access database using Java
has body: I am using this code to import values from an Excel file to my Access database. Everything is working well except for the fact that the code would read all the cells but won't copy everything into access table. (Eg.-200 rows are read successfully but only 97 are entered into the database and the code stops without any error.)The description which is being entered here is about 100 words per row. public class selector extends javax.swing.JFrame { final JFileChooser fc = new JFileChooser(); File file; static String filename, query2, item; static String[][] itemss = new String[10000][10000]; static double xxx; static datacon dc = new datacon(); public static Statement st; static int i, j, rows = -1, p; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { try { // TODO add your handling code here: fileChose(); } catch (SQLException ex) { Logger.getLogger(selector.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(selector.class.getName()).log(Level.SEVERE, null, ex); } } catch (InvalidFormatException ex) { Logger.getLogger(selector.class.getName()).log(Level.SEVERE, null, ex); } } public static String fileChose() throws InvalidFormatException, SQLException, FileNotFoundException { JFileChooser fc = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("XLS files", "xls", "XLSX files", "xlsx"); fc.setFileFilter(filter); int ret = fc.showOpenDialog(null); if (ret == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); filename = file.getAbsolutePath(); System.out.println(filename); work(); return filename; } else { return null; } } static void work() throws InvalidFormatException, SQLException, FileNotFoundException { try { FileInputStream file = new FileInputStream(new File(filename)); org.apache.poi.ss.usermodel.Workbook workbook = WorkbookFactory.create(file); org.apache.poi.ss.usermodel.Sheet sheet = workbook.getSheetAt(0); Iterator&lt;Row&gt; rowIterator = …
tagged with: swing
tagged with: excel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24508689
score: 1
tagged with: java

http://stackoverflow.com/comment/37899694
has text: Also,as I can see your `high` qualified bio,THANKS really for pointing out.Any more changes needed sir?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24483695

http://stackoverflow.com/a/24507049
type: Answer
upvote count: 13
has body: In your example you have an inner class that is always tied to an instance of the outer class. If, what you want, is just a way of nesting classes for readability rather than instance association, then you want a static inner class. public class A { public static class B { int k; public B(int a) { k=a; } } B sth; public A(B b) { sth = b; } } new A.B(4);
score: 13
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24506971
has comment: http://stackoverflow.com/comment/37940965
answers question: http://stackoverflow.com/q/24506971

http://stackoverflow.com/q/24483233
upvote count: 15
has answer: http://stackoverflow.com/a/65728771
possible better answer: http://stackoverflow.com/a/52345316
has title: Added Maven dependency, Eclipse doesn't see it
has answer: http://stackoverflow.com/a/52345316
downvote count: 0
has answer: http://stackoverflow.com/a/67472517
has answer: http://stackoverflow.com/a/25218023
has body: I add guava 17.0 to my pom.xml, Eclipse automatically rebuilds project. Ran mvn dependency:resolve, maven shows com.google.guava:guava:jar:17.0:compile in the list of resolved files. However when in Eclipse I try to auto-complete com.google.g, it says "No default proposals". I've added dependencies in my pom.xml before, run mvn dependency:resolve and Eclipse picked them up immediately. What's different this time? I've tried the following so far: Tried cleaning the project and letting it automatically rebuild. Clean, auto-rebuild, re-start Eclipse. mvn clean followed by mvn install https://stackoverflow.com/a/6913992/91933 https://stackoverflow.com/a/12978632/91933 https://stackoverflow.com/a/2393810/91933 (although I couldn't get Eclipse to accept $HOME/.m2 as the Maven repository (which it is)). I can see target/&lt;projname&gt;-1.0-SNAPSHOT/WEB-INF/lib/guava-17.0.jar. My configuration: OS: OS X 10.9.3 Maven: 3.1.1 Eclipse: Kepler (with m2e 1.4)
linked to: http://stackoverflow.com/q/6799449
favorite count: 0
has comment: http://stackoverflow.com/comment/37897374
tagged with: maven
answer count: 4
has comment: http://stackoverflow.com/comment/37900364
accepted answer: http://stackoverflow.com/a/25218023
type: AnsweredQuestion
score: 15
has comment: http://stackoverflow.com/comment/38053603
has comment: http://stackoverflow.com/comment/37897321
tagged with: java
linked to: http://stackoverflow.com/q/2393685
tagged with: m2e
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/38026887
score: 0
type: Comment
type: QuestionComment
has text: @TeRRo Think i figured it out. The XML file is about 50,000 lines which might be too much for an Android phone to handle. Could that be a possibility?
comment on: http://stackoverflow.com/q/24550603

http://stackoverflow.com/q/24526438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37976429
tagged with: java
has comment: http://stackoverflow.com/comment/37976474
has comment: http://stackoverflow.com/comment/37976635
has comment: http://stackoverflow.com/comment/37976557
has comment: http://stackoverflow.com/comment/37976771
type: Question
has comment: http://stackoverflow.com/comment/37976603
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/37976363
has title: jar created on windows doesn't work on linux
tagged with: eclipse
has body: I exported a runnable jar from Eclipse on windows 8.1. When I try t tun it on kali linux it gives 'Invalid or corrupt jarfile' I then created the jar using intellij, but it give the same error on kali linux. Jar works fine on my windows system created by either method. I am using oracle jdk 6 to export the jar. On kali linux I have openjdk installed. Oupout of unzip DocUploder.jar on kali linux Archive: DocUploder.jar End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. note: DocUploder.jar may be a plain executable, not an archive unzip: cannot find zipfile directory in one of DocUploder.jar or DocUploder.jar.zip, and cannot find DocUploder.jar.ZIP, period.
score: 0
has comment: http://stackoverflow.com/comment/37976805
answer count: 1
tagged with: executable-jar
tagged with: jar
has answer: http://stackoverflow.com/a/24526904
has comment: http://stackoverflow.com/comment/37976496
has comment: http://stackoverflow.com/comment/37976435
has comment: http://stackoverflow.com/comment/37976702
accepted answer: http://stackoverflow.com/a/24526904

http://stackoverflow.com/q/24538508
accepted answer: http://stackoverflow.com/a/24538755
tagged with: tablemodel
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37999944
type: Question
answer count: 2
has body: I am using a new class for a TableModel that extends AbstractTableModel, but when i try to add the header row it doesn't show. This is the code: public class StudentTableModel extends AbstractTableModel { private ArrayList&lt;Student&gt; student; private ArrayList&lt;Group&gt; groups; private int tableType=2; public String []coluNamess = { "id","name", "last name", " birth date", "phone","adress", "class" }; public String []coluNamesg = { "id","title", "level","num" }; public String getColumnName(int column ) { if(tableType==1) { return this.coluNamess[column]; } else { return this.coluNamesg[column]; } } public int getColumnCount() { if(tableType==1) { return 7; } else { return 4; } } public int getRowCount() { if(tableType==1) { return student.size(); } else { return groups.size(); } } public String getValueAt(int row, int colu) { if(tableType==1) { Student studentm=student.get(row); switch(colu) { case 0: return Double.toString((double)studentm.getId()); case 1: return studentm.getFname(); case 2: return studentm.getLname(); case 3: return studentm.getB_date(); case 4: return studentm.getPhone(); case 5: return studentm.getAdress(); case 6: return Double.toString((double)studentm.getGroupId()); } } else if(tableType==2) { Group group=groups.get(row); switch(colu) { case 0: return Double.toString((double)group.getId()); case 1: return group.getTitle(); case 2: return group.getLevel(); case 3: return Double.toString((double)group.getTime()); } } return null; } public void setStudent(ArrayList&lt;Student&gt; students) { this.student= students; } public void setGroup(ArrayList&lt;Group&gt; groups) { this.groups= groups; } public void setType(int type) { this.tableType=type; } } The header is not appearing but the content is shown. I don't know where the problem is!!!!
possible better answer: http://stackoverflow.com/a/53625884
has answer: http://stackoverflow.com/a/24538755
has answer: http://stackoverflow.com/a/53625884
tagged with: columnheader
tagged with: header
has title: getColumnName not working correctly
tagged with: swing

http://stackoverflow.com/comment/37837595
comment on: http://stackoverflow.com/q/24451477
score: 0
type: QuestionComment
type: Comment
has text: Your InternalWindowTemplate extends JInternalFrame AND has an instance of JInternalFrame. Are you sure that's what you want?

http://stackoverflow.com/comment/38014415
comment on: http://stackoverflow.com/q/24545819
type: Comment
type: QuestionComment
has text: It do not give any error. Basically using 'eq' taskkill("notepad*") kills notepad program in first instance and taskkill('matlab*') kills matlab program in 2nd instance. Using 'ne', in first instance taskkill("notepad") is not killed except every program including matlab program too. What I need is the matlab program should not be killed like this.
score: 0

http://stackoverflow.com/q/24558093
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24560086
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/49376250
answer count: 2
tagged with: camera
has title: onPreviewFrame not being called
downvote count: 0
has body: I have the following method to open the camera facing the user: CameraOperations.java private Parameters parameters = null; private Camera cam = null; private Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); private static int camNumber = Camera.getNumberOfCameras(); public Camera toggleFaceCamera(){ if(cam == null){ for(int counter = 0; counter &lt; camNumber; counter++){ Camera.getCameraInfo(counter, cameraInfo); if(cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT){ try{ cam = Camera.open(counter); parameters = cam.getParameters(); parameters.setPreviewFormat(16); return cam; }catch(RuntimeException e){return null;} } } }else{cam.release();} return null; } public void onPreviewFrame(byte[] data, Camera cam){ Debug.out("teste"); } Which is called likewise: MainActivity.java surface = (SurfaceView)findViewById(R.id.cameraView); holder = surface.getHolder(); Camera cam = CameraOperations.toggleFaceCamera(); try{ cam.setPreviewDisplay(holder); //cam.setPreviewCallback(CameraOperations.()); }catch(IOException e){ e.printStackTrace(); } cam.startPreview(); and all this works just fine, the camera is displayed correctly Unfortunately onPreviewFrame is not being called. I've tried several things using setPreviewCallback and setPreviewCallbackWithBuffer but honestly I'm not understanding why this won't work since onPreviewFrame should be called with the display of frames... I've read the documentation but I feel a little misguided about how this works, if anyone could make me understand it clearly I would be much thankful! (example I tried) (...) try{ cam = Camera.open(counter); parameters = cam.getParameters(); parameters.setPreviewFormat(16); cam.setPreviewCallback(onPreviewFrame); &lt;---- doens't recognize argument return cam; }catch(RuntimeException e){return null;} (...)
favorite count: 0

http://stackoverflow.com/comment/37972013
has text: It seems it would be simpler to write your own logger implementation.
comment on: http://stackoverflow.com/q/24506600
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24495617
has body: The implementation of printStackTrace() in java.lang.Throwable is hard-coded to send output to System.err so in short, no you can't configure log4j in any way that would cause calls to printStackTrace() to be sent to the file configured in your "file" appender.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24495349
answers question: http://stackoverflow.com/q/24495349

http://stackoverflow.com/comment/37906631
comment on: http://stackoverflow.com/q/24487327
has text: Yes, it will go to previous activity. So in this case, Home page.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24479110
type: Question
tagged with: android
has title: How to change the background color of the tabs in the action bar?
tagged with: tabs
score: 0
tagged with: android-actionbar
has body: How do I change the color of the tabs in the action bar of my application. Tabs: Current code to add the tabs: private void addTabs(ActionBar actionBar) { ActionBar.Tab tab1=actionBar.newTab(); tab1.setText("All"); tab1.setTabListener(this); ActionBar.Tab tab2=actionBar.newTab(); tab2.setText("Technology"); tab2.setTabListener(this); ActionBar.Tab tab3=actionBar.newTab(); tab3.setText("Business"); tab3.setTabListener(this); actionBar.addTab(tab1); actionBar.addTab(tab2); actionBar.addTab(tab3); }
answer count: 1
has answer: http://stackoverflow.com/a/24480407
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/24569433
answer count: 1
downvote count: 0
favorite count: 0
score: 2
has title: Maven Eclipse: Add maven jar project as a reference to an war project
has comment: http://stackoverflow.com/comment/38058431
has comment: http://stackoverflow.com/comment/38058516
has comment: http://stackoverflow.com/comment/38072130
has answer: http://stackoverflow.com/a/24569684
type: UnansweredQuestion
tagged with: maven
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/38102139
type: Question
has comment: http://stackoverflow.com/comment/38057598
has body: I tried to add my custom jar maven project to an war project as dependency, but it still throws an NoClassDefFoundError if I try run it on Apache 7 server in Eclipse. The pom of my .war Project looks like this: 4.0.0 de.dbbase.apps jwt 0.0.2 war <org.springframework.version>4.0.2.RELEASE</org.springframework.version> <ch.qos.logback.version>1.1.1</ch.qos.logback.version> org.apache.tomcat tomcat-servlet-api 8.0.5 provided taglibs standard 1.1.2 jstl jstl 1.2 javax javaee-api 7.0 provided org.springframework spring-core ${org.springframework.version} org.springframework spring-web ${org.springframework.version} org.springframework spring-webmvc ${org.springframework.version} org.springframework spring-context ${org.springframework.version} commons-logging commons-logging org.slf4j slf4j-api 1.7.6 ch.qos.logback logback-core ${ch.qos.logback.version} ch.qos.logback logback-classic ${ch.qos.logback.version} org.mongodb mongo-java-driver 2.11.4 org.springframework.data spring-data-mongodb 1.4.0.RELEASE org.projectlombok lombok 1.12.4 joda-time joda-time 2.3 org.codehaus.jackson jackson-mapper-asl 1.9.13 de.dbbase.libs dbbase-auth 0.0.1 org.apache.maven.plugins maven-compiler-plugin 3.0 1.7 1.7 and pom of my maven jar project: 4.0.0 de.dbbase.libs dbbase-auth 0.0.1 <org.springframework.version>4.0.2.RELEASE</org.springframework.version> <ch.qos.logback.version>1.1.1</ch.qos.logback.version> org.apache.tomcat tomcat-servlet-api 8.0.5 provided taglibs standard 1.1.2 jstl jstl 1.2 javax javaee-api 7.0 provided org.springframework spring-core ${org.springframework.version} org.springframework spring-web ${org.springframework.version} org.springframework spring-webmvc ${org.springframework.version} org.springframework spring-context ${org.springframework.version} commons-logging commons-logging org.slf4j slf4j-api 1.7.6 ch.qos.logback logback-core ${ch.qos.logback.version} ch.qos.logback logback-classic ${ch.qos.logback.version} org.mongodb mongo-java-driver 2.11.4 org.spring…
tagged with: java
has comment: http://stackoverflow.com/comment/38057172
has comment: http://stackoverflow.com/comment/38057170
tagged with: eclipse
upvote count: 2

http://stackoverflow.com/comment/37946205
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24510171
has text: I think your approach is not better than mine
type: Comment

http://stackoverflow.com/q/24468101
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24526796
has comment: http://stackoverflow.com/comment/38009559
type: UnansweredQuestion
tagged with: android
has body: When I run my app, it takes a very long time to load up. When it starts it is pretty laggy. When I am running my code I am getting this message in my logcat: 06-28 03:36:22.969: I/Choreographer(1506): Skipped 453 frames! The application may be doing too much work on its main thread. I am thinking there is some kind of code in my main file that is slowing this whole thing down because it didn't do this for the longest time. Also the fact that its skipping 453 frames means somethings not right. Here is my code, its about 1000 lines so If anyone wants to read through it that would be awesome but if not if I could get lead into the direction of fixing this problem that would be great. public class PlayScreen extends View { // Constructor public PlayScreen(Context context) { super(context); /** * Instantiate all variables. */ playerBounds = new RectF(); rowBlock = new RectF(); rowBlock2 = new RectF(); startPlaying = new RectF(); continuePlaying = new RectF(); rowGlow = new RectF(); rowGlow2 = new RectF(); menuBox = new RectF(); continueplayingBounds = new RectF(); meteorBounds = new RectF(); pointLossBounds = new RectF(); pointGainBounds = new RectF(); speedBounds = new RectF(); titleBounds = new RectF(); playBounds = new RectF(); doublePointsBounds = new RectF(); bulletBounds = new RectF(); ghostWallBounds = new RectF(); wideGapsBounds = new RectF(); ///// Colors ///// colorGreen = new Paint(); colorBlack = new Paint(); colorWhite = new Paint(); colorBlue = new Paint(); colorYellow = new Paint(); colorRed = new Paint(); colorCyan = new Paint(); colorMagenta = new Paint(); colorOrange = new Paint(); glowGreen = new Paint(); glowWhite = new Paint(); glowBlue = new Paint(); glowYellow = new Paint(); glowRed = new Paint(); glowCyan = new Paint(); glowMagenta = new Paint(); glowOrange = new Paint(); glowBlack = new Paint(); translucentGrey = new Paint(); transparent = new Paint(); boostPaint = new Paint(); countPaint = new Paint(); align = null; // Set my basic color's color…
type: Question
has title: Java - Android app skipping 400+ frames
tagged with: java
has answer: http://stackoverflow.com/a/24468161
tagged with: frames

http://stackoverflow.com/q/24492218
tagged with: java
tagged with: bukkit
score: -1
type: Question
has comment: http://stackoverflow.com/comment/89076207
answer count: 2
has answer: http://stackoverflow.com/a/24494292
has comment: http://stackoverflow.com/comment/37915422
favorite count: 0
has title: Bukkit cannot get mob name that killed player
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37914303
upvote count: 1
has comment: http://stackoverflow.com/comment/88481114
has answer: http://stackoverflow.com/a/24492996
has body: Okay so I am trying to get the mob name if the player gets killed by a zombie (example) but I am always getting a NullPointerException on that. I am sure I have messed up something in the code, but I really have a headache right now, and I can't find where is the problem. Stack Trace: Here is the code: package me.parat26.listeners; import me.parat26.utils.SettingsManager; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent; public class PlayerDeathCauses implements Listener { SettingsManager config = SettingsManager.getInstance(); @EventHandler public void checkDeathCauses(EntityDeathEvent e) { Player p = (Player) e.getEntity(); String victim = p.getDisplayName(); EntityDamageEvent entityDamageCause = p.getLastDamageCause(); DamageCause damage = entityDamageCause.getCause(); String mob = e.getEntity().getType().getName(); if (damage == DamageCause.DROWNING) { String death = config.parse("death.drowned").replace("&lt;player&gt;", victim); ((PlayerDeathEvent) e).setDeathMessage(death); } else if (damage == DamageCause.ENTITY_ATTACK) { String death = config.parse("death.mob").replace("&lt;player&gt;", victim).replace("&lt;mob&gt;", mob); ((PlayerDeathEvent) e).setDeathMessage(death); } else if (damage == DamageCause.ENTITY_EXPLOSION) { String death = config.parse("death.mob-explosion").replace("&lt;player&gt;", victim).replace("&lt;mob&gt;", mob); ((PlayerDeathEvent) e).setDeathMessage(death); } else if (damage == DamageCause.FALL) { String death = config.parse("death.fall").replace("&lt;player&gt;", victim); ((PlayerDeathEvent) e).setDeathMessage(death); } else if (damage == DamageCause.FALLING_BLOCK) { String death = config.parse("death.falling-block").replace("&lt;player&gt;", victim); ((PlayerDeathEvent) e).…

http://stackoverflow.com/q/24470109
favorite count: 0
has comment: http://stackoverflow.com/comment/40709413
linked to: http://stackoverflow.com/q/15087224
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2441760
linked to: http://stackoverflow.com/q/23604744
has body: I have this confusion regarding the classpath and sourcepath.I have referred to theselinks too but i aint getting it right. REFERENCES-- Differences between classpath and sourcepath options of javac -sourcepath vs -classpath Regarding automatic recompilation, I can't spot the difference between javac's -classpath and -sourcepath options Does it mean if we dont edit the source file,both classpath and sourcepath wouldnt be recompiled? Specifically,this line troubled me! Note that classes found through the classpath are subject to automatic recompilation if their sources are found. Can anyone explain this in simple language with SIMPLE EXAMPLES?It would be of great help!
has answer: http://stackoverflow.com/a/24470156
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37872316
downvote count: 1
type: Question
has title: difference between classpath and sourcepath?
has comment: http://stackoverflow.com/comment/39079014
has comment: http://stackoverflow.com/comment/39076799
has comment: http://stackoverflow.com/comment/39087902
answer count: 2
has answer: http://stackoverflow.com/a/24470546
has comment: http://stackoverflow.com/comment/37872695
score: 2

http://stackoverflow.com/comment/37822605
score: 2
has text: Also moving the image setting code inside try with a null check for BufImage maybe be a good idea.
comment on: http://stackoverflow.com/a/24443259
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24581756
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24581631
has body: This issue is probably best answered on a case by case basis, since "different purpose than the intended one" is a little bit vague to offer a complete suggestion on. In your case, it may come down to a matter of taste. Personally, unless your already exists exception needs are related to the persistence layer, I would advise against reusing the exception from that package since it is easy to make a new exception and will not confuse any future developers or code that may infer the exception is being passed on from the underlying implementation.

regex
tags question: http://stackoverflow.com/q/24510420
tags question: http://stackoverflow.com/q/24447738
tags question: http://stackoverflow.com/q/24433206
tags question: http://stackoverflow.com/q/24432977
tags question: http://stackoverflow.com/q/24570807
tags question: http://stackoverflow.com/q/24557824
tags question: http://stackoverflow.com/q/24450483
tags question: http://stackoverflow.com/q/24538991
tags question: http://stackoverflow.com/q/24483332
tags question: http://stackoverflow.com/q/24523260
tag name: regex
tags question: http://stackoverflow.com/q/24541500
tags question: http://stackoverflow.com/q/24583673
tags question: http://stackoverflow.com/q/24583956
tags question: http://stackoverflow.com/q/24519259
tags question: http://stackoverflow.com/q/24524548
tags question: http://stackoverflow.com/q/24503917
tags question: http://stackoverflow.com/q/24512203
tags question: http://stackoverflow.com/q/24554065
tags question: http://stackoverflow.com/q/24450196
tags question: http://stackoverflow.com/q/24587090
tags question: http://stackoverflow.com/q/24438240
tags question: http://stackoverflow.com/q/24482146
tags question: http://stackoverflow.com/q/24541920
tags question: http://stackoverflow.com/q/24444305
tags question: http://stackoverflow.com/q/24571772
tags question: http://stackoverflow.com/q/24439095
tags question: http://stackoverflow.com/q/24474126
tags question: http://stackoverflow.com/q/24553541
tags question: http://stackoverflow.com/q/24465320
tags question: http://stackoverflow.com/q/24571792
tags question: http://stackoverflow.com/q/24547538
tags question: http://stackoverflow.com/q/24459375
tags question: http://stackoverflow.com/q/24537356
tags question: http://stackoverflow.com/q/24507095
tags question: http://stackoverflow.com/q/24487501
tags question: http://stackoverflow.com/q/24527437
tags question: http://stackoverflow.com/q/24432259
tags question: http://stackoverflow.com/q/24480852
tags question: http://stackoverflow.com/q/24473835
tags question: http://stackoverflow.com/q/24463089
tags question: http://stackoverflow.com/q/24453868
tags question: http://stackoverflow.com/q/24468286
tags question: http://stackoverflow.com/q/24550092
tags question: http://stackoverflow.com/q/24499820
tags question: http://stackoverflow.com/q/24434642
tags question: http://stackoverflow.com/q/24521892
tags question: http://stackoverflow.com/q/24568525
tags question: http://stackoverflow.com/q/24476791
tags question: http://stackoverflow.com/q/24554319
tags question: http://stackoverflow.com/q/24438714
tags question: http://stackoverflow.com/q/24541956
tags question: http://stackoverflow.com/q/24491764
tags question: http://stackoverflow.com/q/24531400
tags question: http://stackoverflow.com/q/24445224
tags question: http://stackoverflow.com/q/24451086
tags question: http://stackoverflow.com/q/24489610
tags question: http://stackoverflow.com/q/24447432
tags question: http://stackoverflow.com/q/24473977
tags question: http://stackoverflow.com/q/24482186
tags question: http://stackoverflow.com/q/24466565
tags question: http://stackoverflow.com/q/24576739
type: Tag
tags question: http://stackoverflow.com/q/24509627
tags question: http://stackoverflow.com/q/24458929

http://stackoverflow.com/comment/37962017
has text: Thanks for your thoughts (and I also recommend those books, as well as Uncle Bob: Clean Code). Anyway, I'm not sure if I'm able to implement your suggestion in technical terms. Could you please show a dependency graph (or structural tree like mine above) between the EAR, its modules and the "util / traversal dependency"? Also I'm not sure if I understand the part where tests reports (say surefire) only depends on the EAR when the tests are in the sub-modules. How can I achieve that? Finally, if "components" must test themselves are you suggesting that we stick with mocks?
type: Comment
comment on: http://stackoverflow.com/a/24518240
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37965707
type: QuestionComment
has text: That's odd. Looking at the [documentation](http://tomcat.apache.org/tomcat-7.0-doc/config/http.html) I can only suggest to try the `disableUploadTimeout` and the `socket.soTimeout` options (documentation says the latter is the same as `connectionTimeout` but I doubt that). But I think I'm missing something (maybe obvious to others) here.
comment on: http://stackoverflow.com/q/24518179
score: 0
type: Comment

http://stackoverflow.com/comment/38050917
score: 2
comment on: http://stackoverflow.com/q/24565996
has text: Use a `TreeMap`, not a `HashMap`. It has methods for this kind of thing.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24578141
tagged with: bouncycastle
linked to: http://stackoverflow.com/q/16857723
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38074583
has comment: http://stackoverflow.com/comment/38074444
has comment: http://stackoverflow.com/comment/38074616
type: Question
has comment: http://stackoverflow.com/comment/38073443
has comment: http://stackoverflow.com/comment/38073367
has comment: http://stackoverflow.com/comment/38074412
has comment: http://stackoverflow.com/comment/38073736
has body: I'm working on a Java cross-platform client application that would use PBEWITHSHA256AND128BITAES-CBC-BC from Bouncy Castle API encryption to store sensitive information in local files. The following code : public static void main(String[] args) throws NoSuchAlgorithmException { Security.addProvider(new BouncyCastleProvider()); for (Provider provider : Security.getProviders()) { for (Provider.Service service : provider.getServices()) { System.out.println(provider.getName() + ": " + service.getAlgorithm()); } } SecretKeyFactory.getInstance("PBEWITHSHA256AND128BITAES-CBC-BC"); } gives me the following exception : SUN: NativePRNG SUN: SHA1PRNG SUN: SHA1withDSA [...] BC: PBEWITHSHAAND192BITAES-CBC-BC BC: PBEWITHSHAAND256BITAES-CBC-BC BC: PBEWITHSHA256AND128BITAES-CBC-BC BC: PBEWITHSHA256AND192BITAES-CBC-BC BC: PBEWITHSHA256AND256BITAES-CBC-BC BC: DESMAC [...] Exception in thread "main" java.security.NoSuchAlgorithmException: PBEWITHSHA256AND128BITAES-CBC-BC SecretKeyFactory not available at javax.crypto.SecretKeyFactory.&lt;init&gt;(DashoA13*..) at javax.crypto.SecretKeyFactory.getInstance(DashoA13*..) at TestBouncyCastle.main(TestBouncyCastle.java:47) That's strange since PBEWITHSHA256AND128BITAES-CBC-BC is listed as an available service. On the Bouncy Castle wiki, there is this note : Note: to make full use of the provider you must install the unlimited policy files in the JVM you are using - these can be downloaded from http://java.sun.com. If I understand correctly, I need to install a file in the client JRE. And I would like to avoid providing a JRE with the application. Is there a way around? Thanks!
has comment: http://stackoverflow.com/comment/38073327
downvote count: 0
has title: NoSuchAlgorithmException PBEWITHSHA256AND128BITAES
favorite count: 0

http://stackoverflow.com/q/24470922
has comment: http://stackoverflow.com/comment/37878298
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37874664
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24484331
type: Question
has title: Database is not updated even after data post from Android App was successful
has body: I have an android app that I am programming to post an array of data to a php file in local server. The data is in the format as bellow. Name1->Quantity1 Name2->Qunatity2 I am trying to send it as json array but the problem is that whenever I am sending the data it shows that it is successful in posting that data. However i am not able to see any change of database that was suppose to be as a result of data that was sent form the android app. I will be thankful if someone guides or solves this problem of mine. please help me in this. Bellow are the classes i am using to send and receive data This is the class which is sending the data public class Thirdscreen extends Activity { private static String url = "http://10.0.2.2/bootstrap-dist/postingdata.php"; public ArrayList&lt;QantityModelProduct&gt; quantitymodel=new ArrayList&lt;QantityModelProduct&gt;(); // Progress Dialog private ProgressDialog pDialog; // Json parser object JSONParser jsonParser = new JSONParser(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.thirdscreen); QantityModelProduct qmp; TextView showCartContent = (TextView) findViewById(R.id.showCart); TextView showCarttotal = (TextView) findViewById(R.id.showtotal); Button btn = (Button) findViewById(R.id.subtractQuantity); final Controller aController = (Controller) getApplicationContext(); int cartSize = aController.getCart().getCartSize(); String showString = ""; int total = 0; for (int i = 0; i &lt; cartSize; i++) { String pName = aController.getCart().getProducts(i) .getProductName(); int pPrice = aController.getCart().getProducts(i).getProductPrice(); int quantity = aController.getCart().getProducts(i) .getProductQuantity(); int dataProQuantityStore = aController.getCart() .getProducts(i).getDatabaseProductQuantity(); String pDisc = aController.getCart().getProducts(i) .getProductDesc(); total = total + (pPrice * quantity); showString += "\n\nProduct Name : " + pName + "\n…

http://stackoverflow.com/q/24428748
upvote count: 1
has title: Why autoboxing is not supporting in collection.toArray() in java
has body: Is there no any short cut to do this nicely? That ugly two loops (One loop to read the pmList and second loop to add to the markupArray) is the only option (Instead of ArrayUtils). ArrayList&lt;Double&gt; pmList = new ArrayList&lt;Double&gt;(); pmList.add(0.1); // adding through a loop in real time. pmList.add(0.1); pmList.add(0.1); pmList.add(0.1); double[] markupArray = new double[pmList.size()]; arkupArray = pmList.toArray(markupArray); // This says The method toArray(T[]) in the type ArrayList&lt;Double&gt; is not applicable for the arguments (double[])
tagged with: collections
type: Question
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24428826
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24428922
has answer: http://stackoverflow.com/a/24428810
has answer: http://stackoverflow.com/a/24429213
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24428847

http://stackoverflow.com/a/24448519
upvote count: 1
answers question: http://stackoverflow.com/q/24448372
score: 1
has body: If you import a maven project you can select to change the naming templates. so you can solve the problem duplicate artifact names in your projects.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37832016
accepted answer of: http://stackoverflow.com/q/24448372

http://stackoverflow.com/comment/37834877
score: 0
comment on: http://stackoverflow.com/q/24450191
has text: Please post your stacktrace of exception
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24566213
type: UnansweredQuestion
has body: I used the below code where I've printed the modified GMT date in String &amp; in Date format, it's giving me two different values. Date initial = new Date(); DateFormat dateFormatter = DateFormat.getInstance(); dateFormatter.setTimeZone (TimeZone.getTimeZone("UTC")); String gmtS = dateFormatter.format(initial); Date gmt = dateFormatter.parse(gmtS); System.out.println("Data type is Date = " + gmt); System.out.println("Data type is String "+gmtS); Output gtm where value id of type Date = Thu Jul 03 23:15:00 EDT 2014 gmtS where value id of type String = 7/4/14 3:15 AM But I want to see the value (7/4/14 3:15 AM) as a Date type. Any help is really appreciated.
has answer: http://stackoverflow.com/a/24566285
tagged with: java
has title: Convert current date & time to equivalent GMT date & time
downvote count: 2
linked to: http://stackoverflow.com/q/308683
type: Question
score: -2
has comment: http://stackoverflow.com/comment/38054949
answer count: 2
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/5236052
has answer: http://stackoverflow.com/a/54564652

http://stackoverflow.com/comment/37824908
has text: I would not suggest such a thing. It could break your package structure.
comment on: http://stackoverflow.com/q/24444565
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37823961
type: QuestionComment
has text: Check my answer here: http://stackoverflow.com/a/21898031/1785412
comment on: http://stackoverflow.com/q/24444028
score: 0
type: Comment

http://stackoverflow.com/comment/38013001
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24545589
has text: Good point about making class final. However if all fields are `private` subclasses cannot change the state of super class anyway. And (if it is relevant) making class final prevents us from mocking the class for tests and from creating proxies using libraries like CGLib or Javassist that can be a serious blocker. So, I personally think twice before making class `final`.
type: AnswerComment

http://stackoverflow.com/comment/48103049
score: 0
type: Comment
type: QuestionComment
has text: @ADTC sure, you may also upvote this if you find this question helpful.
comment on: http://stackoverflow.com/q/24433751

http://stackoverflow.com/comment/45405292
type: Comment
type: QuestionComment
has text: @jbaliuka I haven't worked on that for a while. If I get the chance to try it out I will comment here. Thank you for your help.
comment on: http://stackoverflow.com/q/24513055
score: 0

http://stackoverflow.com/a/24509031
has body: Take() call is always blocking till elements become available.. if you don't want to block then user poll() poll() Retrieves and removes the head of this queue, or returns null if this queue is empty. reference : http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/LinkedBlockingQueue.html#poll()
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24437736
downvote count: 0

http://stackoverflow.com/a/24493641
type: Answer
answers question: http://stackoverflow.com/q/24493495
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24493495
score: 3
has body: The AsyncAppender is implemented with a BlockingQueue. The Logger will add a logging event to the queue and a single worker Thread will take from the queue and handle logging. If your code guarantees the order of these chronologically (through locking or some other mechanism), then they are guaranteed to be ordered in the logs as well.
has comment: http://stackoverflow.com/comment/37917714
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/37917625

http://stackoverflow.com/q/24448002
has title: When click on Hyperlink in JavaFX, a relevant URL should open in browser
tagged with: java
tagged with: javafx
score: 6
has body: I am developing an application in which I have some links added to the Listview, and these links will keep on adding at runtime on some condition. What I can't find is a way to to open a url when clicking on a particular link. This is the code for adding links into list view if (counter == 1) { Task task2 = new Task<Void>() { @Override public Void call() throws Exception { Platform.runLater(new Runnable() { public void run() { link = new Hyperlink(val); link.setStyle("-fx-border-style: none;"); items.add(link); listview.setItems(items); } }); return null; } }; Thread th = new Thread(task2); th.setDaemon(true); th.start(); Thread.sleep(1000); } I know I need to use something like this to open a url in browser when click on link: getHostServices().showDocument(link.getText()); I don't know how to listen/track the click event for different links.
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/73528613
tagged with: desktop-application
accepted answer: http://stackoverflow.com/a/24450989
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/52719989
favorite count: 0
has answer: http://stackoverflow.com/a/36821920
upvote count: 6
has comment: http://stackoverflow.com/comment/129902585
possible better answer: http://stackoverflow.com/a/36821920
has answer: http://stackoverflow.com/a/24450989
tagged with: javafx-2

http://stackoverflow.com/comment/37913919
type: QuestionComment
has text: @mohamProgrammer, then please add that as an answer and accept it after a couple of days, so that the question doesn't remain without an accepted answer.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24489639

http://stackoverflow.com/comment/47401566
type: Comment
type: QuestionComment
has text: nop, had to rethink the problem and keep working with one single war :(
comment on: http://stackoverflow.com/q/24557779
score: 0

http://stackoverflow.com/q/24556487
duplicate of: http://stackoverflow.com/q/602636
linked to: http://stackoverflow.com/q/20040015
tagged with: iterator
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/24556829
favorite count: 0
has comment: http://stackoverflow.com/comment/38032590
has comment: http://stackoverflow.com/comment/38032830
has title: It does not throw exception ConcurrentModificationException
has answer: http://stackoverflow.com/a/24556745
upvote count: 10
accepted answer: http://stackoverflow.com/a/24556745
linked to: http://stackoverflow.com/q/602636
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/24980651
has answer: http://stackoverflow.com/a/24556760
tagged with: java
possible better answer: http://stackoverflow.com/a/24556829
has comment: http://stackoverflow.com/comment/133855678
has answer: http://stackoverflow.com/a/24556666
type: Question
has body: I have the below code and I would expect it to throw a ConcurrentModificationException, but it runs successfully. Why does this happen? public void fun(){ List &lt;Integer&gt;lis = new ArrayList&lt;Integer&gt;(); lis.add(1); lis.add(2); for(Integer st:lis){ lis.remove(1); System.out.println(lis.size()); } } public static void main(String[] args) { test t = new test(); t.fun(); }
has answer: http://stackoverflow.com/a/24556739
has answer: http://stackoverflow.com/a/24556578
score: 10
has answer: http://stackoverflow.com/a/24556923

webdriver
tags question: http://stackoverflow.com/q/24511876
tags question: http://stackoverflow.com/q/24510094
tags question: http://stackoverflow.com/q/24430829
tags question: http://stackoverflow.com/q/24458230
tags question: http://stackoverflow.com/q/24503216
tags question: http://stackoverflow.com/q/24468922
type: Tag
tags question: http://stackoverflow.com/q/24499847
tags question: http://stackoverflow.com/q/24495684
tag name: webdriver
tags question: http://stackoverflow.com/q/24452843

http://stackoverflow.com/q/24516444
type: Question
has answer: http://stackoverflow.com/a/24525926
tagged with: filter
has comment: http://stackoverflow.com/comment/37974175
upvote count: 1
answer count: 1
tagged with: jersey-2.0
downvote count: 0
has body: I need to make Jersey refuse requests with incorrect content-length. I'm checking the content-length with a ContainerRequestFilter filter, like so: public class ContentLengthRequiredRequestFilter implements ContainerRequestFilter { private static Logger LOG = LoggerFactory.getLogger(ContentLengthRequiredRequestFilter.class); @Override public void filter(ContainerRequestContext requestContext) throws IOException { if (requestContext.getMethod() == javax.ws.rs.HttpMethod.POST || requestContext.getMethod() == javax.ws.rs.HttpMethod.PUT) { int givenContentLength = requestContext.getLength(); if (givenContentLength == -1) { // no content-length given, but it is is required for PUT and POST requests requestContext.abortWith(Response.status(Response.Status.LENGTH_REQUIRED).entity("No content-length provided.").build()); } else { // now check if the given content-length is actually correct. // since I only have a reference to an entity stream, it seems to be that // reading the entire stream and then resetting it is not a good solution. // Should I be checking this somewhere else, perhaps somewhere the entity is already available or where I can get the total size of the body without causing the stream to be read twice? Or is there a better way to get the body size here? } } } } As you can see in the code block comment, should I be checking this somewhere else, perhaps somewhere the entity is already available or where I can get the total size of the body without causing the stream to be read twice? Or is there a better way to get the body size there? Thank you!!
favorite count: 0
has title: Best way to make Jersey 2.x refuse requests with incorrect Content-Length?
tagged with: rest
tagged with: content-length
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24525926

http://stackoverflow.com/comment/37824393
type: QuestionComment
comment on: http://stackoverflow.com/q/24444209
score: 0
has text: Yes I can read the path from environment variables.
type: Comment

http://stackoverflow.com/comment/37988245
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24529525
has text: The SQL generated is database-specific.

http://stackoverflow.com/a/24539350
answers question: http://stackoverflow.com/q/24539261
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: You can use a List instead which is ordered List&lt;String&gt; superSet = Arrays.asList("a,b,c,d,e".split(",")); List&lt;String&gt; subSet = Arrays.asList("b", "e"); superSet.containsAll(subSet); List&lt;Integer&gt; indexes = subSet.stream().forEach(superSet::indexOf) .collect(Collectors.toList()); or String[] array = { "a", "b", "c", "d", "e"}; int[] indexes = new int[] { 1, 4 }; List&lt;String&gt; lookup = Arrays.stream(indexes).forEach(i -&gt; array[i]) .collect(Collectors.toList());
has comment: http://stackoverflow.com/comment/38002562

http://stackoverflow.com/a/31360671
answers question: http://stackoverflow.com/q/24545576
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: tl;dr Remove all unused modules which have a dependency on the support library from your settings.gradle. Long version: In our case we had declared the support library as a dependency for all of our modules (one app module and multiple library modules) in a common.gradle file which is imported by every module. However there was one library module which wasn't declared as a dependency for any other module and therefore wasn't build. In every few syncs Android Studio would pick that exact module as the one where to look for the support library (that's why it appeared to happen randomly for us). As this module was never used it never got build which in turn caused the jar file not being in the intermediates folder of the module. Removing this library module from settings.gradle and syncing again fixed the problem for us.

http://stackoverflow.com/comment/38086326
type: Comment
type: QuestionComment
score: 0
has text: Its a java.util datatype.
comment on: http://stackoverflow.com/q/24585346

http://stackoverflow.com/comment/38039322
type: AnswerComment
score: 0
type: Comment
has text: Ok man, it solved my case, the problem was "java.lang.String cannot be converted to JSONObject" and I pull it off, thank you for your help, if could have a look at my other question - http://stackoverflow.com/questions/24559923/unable-to-add-window-android-dialog-box it is about the same code
comment on: http://stackoverflow.com/a/24539558

http://stackoverflow.com/q/24488825
has title: How to open new stage and close previous stage between classes
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/50193964
downvote count: 0
tagged with: java
tagged with: stage
has answer: http://stackoverflow.com/a/24489308
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/40212870
accepted answer: http://stackoverflow.com/a/40212870
possible better answer: http://stackoverflow.com/a/48722399
has comment: http://stackoverflow.com/comment/37907866
has answer: http://stackoverflow.com/a/48722399
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/38159691
has body: I try to open new stage and close previous stage between classes but i couldn't success in javafx. maybe if we use singleton pattern , it can run successfully. when you press button , first window will close and second window open. Here is code; First class: public class First extends Application { public Stage primaryStage2,primaryStage3; Second v=new Second(); @Override public void start(Stage primaryStage) { Button btn = new Button(); btn.setText("Press"); this.primaryStage3=primaryStage; btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { v.open(); } }); StackPane root = new StackPane(); root.getChildren().add(btn); Scene scene = new Scene(root, 300, 250); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } Second class : public class Second { Stage primaryStage2; First a=new First(); public void open(){ primaryStage2=new Stage(); StackPane root = new StackPane(); Scene scene = new Scene(root, 300, 250); primaryStage2.setScene(scene); a.primaryStage3.close(); primaryStage2.show(); } }
tagged with: javafx-2
favorite count: 0
answer count: 4

http://stackoverflow.com/comment/37952156
score: 0
type: Comment
has text: Also set up your webviewclient: `wv.setWebViewClient(new MyWebViewClient ());` Also see this thread: http://stackoverflow.com/questions/17182860/webview-is-not-loading-html5-video-in-android
comment on: http://stackoverflow.com/a/24513248
type: AnswerComment

http://stackoverflow.com/a/24470173
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24470052
downvote count: 0
has body: The only way you can add Fragment A to the back stack is before you commit the transaction which replaces Fragment A with Fragment Z. You can not add it later on after Fragment Z is already added. Before calling commit() on the transaction which inserts Fragment Z, call addToBackStack(null) on the the transaction. Then you will not have to override onBackPressed().

bigdecimal
tags question: http://stackoverflow.com/q/24539889
tags question: http://stackoverflow.com/q/24571166
type: Tag
tag name: bigdecimal
tags question: http://stackoverflow.com/q/24557708

http://stackoverflow.com/a/24526347
score: 1
has body: You can also add (depending on you id column name): @Column(name = "COUNTRY_ID") private Long countryId;
upvote count: 1
answers question: http://stackoverflow.com/q/24526216
type: Answer
downvote count: 0

http://stackoverflow.com/q/24513981
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37953215
has body: So far, I tried to export the table contents to excel. It is working fine. But, I need to export the same content to pdf. So I tried response.setHeader("Content-Type", "application/pdf"); in content type. But, it is not working. I am getting the pdf file is corrupted and couldn't open it. Can someone help me to resolve this? Here is my code. JSP: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Export to Excel - Demo Sr. No. Text Data Number Data <% for (int i = 0; i < 10; i++) { %> <%=i + 1%> This is text data <%=i%> <%=i * i%> <% } %> some text Export to Excel Servlet: import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Sample */ public class Sample extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Sample() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("Inside doGet"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("Inside doPost"); actionExportToExcel(request, response); } public void actionExportToExcel(HttpServletRequest request, HttpServletResponse response) throws IOException { String datatoexport = request.getParameter("datatoexport"); response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=PayHistory.pdf"); response.setHeade…
score: 1
tagged with: java
has title: Exporting html contents to pdf is not working
upvote count: 1
tagged with: export-to-pdf
type: Question
has comment: http://stackoverflow.com/comment/37953460
has answer: http://stackoverflow.com/a/26243960
has comment: http://stackoverflow.com/comment/41166840
tagged with: servlets
has comment: http://stackoverflow.com/comment/41864370
downvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/37953304
favorite count: 0

http://stackoverflow.com/q/24545184
has comment: http://stackoverflow.com/comment/38026120
type: Question
has comment: http://stackoverflow.com/comment/38012034
tagged with: java
has comment: http://stackoverflow.com/comment/38012668
has comment: http://stackoverflow.com/comment/38012167
linked to: http://stackoverflow.com/q/588004
has comment: http://stackoverflow.com/comment/38012017
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38012095
has comment: http://stackoverflow.com/comment/38012019
linked to: http://stackoverflow.com/q/1651671
has comment: http://stackoverflow.com/comment/38012068
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38035371
duplicate of: http://stackoverflow.com/q/1651671
has comment: http://stackoverflow.com/comment/38012193
has body: So, I made this lines of code to return 10% of the value in the parameter. For example, if the value being given is 7, the code should return 0.7. But it is returning 0.7000000000000001. Any thoughts why? The code is below: public double calculateDiscount(double price){ double discount; discount = price*0.10; return discount; } I'm using eclipse IDE, and using the debug, I didn't find anything weird, the multiplication is simply returning that huge number. PS.: I know that I can return only two decimal cases, but I want to know whats going on. PPS.: Using /10 instead of *0.10 works just fine. But, as I said, I want to know why.
has answer: http://stackoverflow.com/a/24545241
tagged with: multiplication
has title: Multiplication bug in java?
linked to: http://stackoverflow.com/q/6459335

http://stackoverflow.com/q/24473289
has comment: http://stackoverflow.com/comment/37879005
has body: Java - Window Selection/Focus Is there anyway of doing this in Java? The client i was using was written is pascal I believe I does stuff like this
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37879076
has title: Java Window Selection or Focus
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37879048
upvote count: 0
score: -2
answer count: 1
has answer: http://stackoverflow.com/a/24478256
has comment: http://stackoverflow.com/comment/37878319
favorite count: 0
has comment: http://stackoverflow.com/comment/37878321

http://stackoverflow.com/comment/38040465
has text: It's only an example of real class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24560508

http://stackoverflow.com/comment/38017142
score: 0
type: Comment
has text: post is safe, I would rather serialize the form though
type: AnswerComment
comment on: http://stackoverflow.com/a/24548074

http://stackoverflow.com/comment/38032009
type: Comment
type: QuestionComment
score: 2
has text: You've just asked an answer.
comment on: http://stackoverflow.com/q/24556202

http://stackoverflow.com/q/24501329
type: Question
has comment: http://stackoverflow.com/comment/38046608
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/24575044
tagged with: java
accepted answer: http://stackoverflow.com/a/24575044
score: 8
tagged with: spring-jms
type: AnsweredQuestion
downvote count: 0
tagged with: jms
has body: We just upgraded to Spring 4 and JMS 2.0. We are using a CachingConnectionFactory and a JmsTemplate to publish messages and noticed that when publishing to a destination, the first attempt works and then further attempts to publish to the same destination cause the following exception: Caused by: javax.jms.IllegalStateException: The producer is closed Everything worked fine with Spring 3.2 and JMS 1.1 so I did some digging to see what the problem was and it seems the issue is in the CachedMessageProducer class. Normally this class re-implements all of the methods in the MessageProducer interface. Specifically there is a close() method that is re-implemented and will only reset properties but keep the producer alive (since it is a caching factory) after a message is sent using the JmsTemplate. However, there is a new method in Spring 4 called getProxyIfNecessary that determines whether or not JMS 2.0 is being used and when it detects JMS 2.0 it creates a Jms2MessageProducerInvocationHandler proxy. The invoke method of this proxy is delegating all calls to the original MessageProducer object, and seems to be bypassing method calls in the CachedMessageProducer. The end result is that the close method gets called on the original MessageProducer object (which we don't want since it should be cached). This means that future attempts to publish give the exception that the producer has been closed. Has anyone else had this issue before? I'm not sure if I'm doing something wrong or if this is a bug with the new JMS 2.0 support in Spring.
favorite count: 0
has title: Spring 4 CachingConnectionFactory with JMS 2.0 doesn't properly cache Producers
upvote count: 8

http://stackoverflow.com/comment/37972835
comment on: http://stackoverflow.com/q/24519668
type: QuestionComment
type: Comment
has text: What do you mean by `owner window moves in case it is maximized` ? I am not sure if its the case because of Linux, but I am sure in windows and Mac, `Modality.WINDOW_MODAL` will block the parent window. Please refer [here for more information](http://docs.oracle.com/javafx/2/api/javafx/stage/Stage.html)
score: 0

http://stackoverflow.com/q/24456833
type: Question
score: 0
has body: I try to change jtextfield border after 5 seconds. But doesnt work. My code: // Here vaildate a field and set border to red if (ApplicationNameField.getText().equals("")) { Border newBorder = BorderFactory.createLineBorder(Color.RED, 1); ApplicationNameField.setBorder(newBorder); ErrorCode.setText("Error field cant be empty"); } if (ApplicationHostField.getText().equals("")) { Border newBorder = BorderFactory.createLineBorder(Color.RED, 1); ApplicationHostField.setBorder(newBorder); ErrorCode.setText("Error field cant be empty"); } // here i would change border to start normal color (color black) try { TimeUnit.SECONDS.sleep(5); Border newBorder = BorderFactory.createLineBorder(Color.BLACK, 1); ApplicationNameField.setBorder(newBorder); Border newBorder2 = BorderFactory.createLineBorder(Color.BLACK, 1); ApplicationHostField.setBorder(newBorder2); } catch (InterruptedException ex) { System.out.print(ex.getMessage()); } After this code my JTextFields borders are black and is not colored by red color. Also i tried with: Thread.sleep(5000); But effect is the same. Anyone could help?
possible better answer: http://stackoverflow.com/a/24457279
answer count: 3
has comment: http://stackoverflow.com/comment/37847603
has answer: http://stackoverflow.com/a/24456914
accepted answer: http://stackoverflow.com/a/24456914
tagged with: swing
has answer: http://stackoverflow.com/a/24457279
has answer: http://stackoverflow.com/a/24457200
type: AnsweredQuestion
tagged with: java
has title: How can i change jtextfield border after 5 seconds?

http://stackoverflow.com/q/24585733
type: UnansweredQuestion
tagged with: java
type: Question
has title: Vaadin with Instagram API
tagged with: vaadin
has comment: http://stackoverflow.com/comment/53285066
has answer: http://stackoverflow.com/a/24585922
score: 0
answer count: 1
has body: To use my app, the user must log in to their instagram account and give my app permission to access their information. Once this is done, a URL with a code attached to the back will be returned (e.g. www.google.com/code=123456789). The code is the exchanged for an access token. My question is: Can my app automatically get the code from the url and use it instead of the user having to copy and paste it in? Thank you for reading! Code: TextField code = new TextField("Enter Code: "); Button button = new Button("Click here to authenticate"); String callbackUrl = "http://reveal-it.appspot.com/oauthtest"; String clientID = "XXX"; String clientSecret = "XXX"; Token EMPTY_TOKEN = null; InstagramService service = new InstagramAuthService().apiKey(clientId) .apiSecret(clientSecret) .callback(callbackUrl) .build(); String authorizationUrl = service.getAuthorizationUrl(EMPTY_TOKEN); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { getUI().getPage().open(authorizationUrl, "_blank"); next(); } }); public void next(){ String verifierCode = code.getValue(); Verifier verifier = new Verifier(verifierCode); Token accessToken = service.getAccessToken(EMPTY_TOKEN, verifier); Instagram instagram = new Instagram(accessToken); UserInfo userInfo = instagram.getCurrentUserInfo(); } Step 1: Authenticate User Step 2: Get URL with code attached at the back that user has to copy and paste into textfield (This is a test url that prints the code)
tagged with: instagram

http://stackoverflow.com/comment/38979845
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25058227
type: AnswerComment
has text: I got this from [here](http://www.java2s.com/Code/CSharp/Network/GetMacAddress.htm)

http://stackoverflow.com/comment/137497341
score: 1
has text: For those using newer versions of Java/SpringBoot, import is `jakarta.annotation.Nonnull`
comment on: http://stackoverflow.com/a/27942889
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37855990
has text: great to use this, so i can continue my practice!
type: Comment
comment on: http://stackoverflow.com/a/24460739
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37945609
type: AnswerComment
has text: I've implemented this method and now I'm getting "There was an error running endpoints command get-client-lib: Read timed out'.
type: Comment
comment on: http://stackoverflow.com/a/24497921
score: 0

http://stackoverflow.com/q/24491764
type: Question
has comment: http://stackoverflow.com/comment/37913172
accepted answer: http://stackoverflow.com/a/24491807
has title: java regular expression [A-Z]{6}-[A-Z]{4}-[A-Z]{4}
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24491975
has comment: http://stackoverflow.com/comment/37913224
has answer: http://stackoverflow.com/a/24491807
possible better answer: http://stackoverflow.com/a/24491975
tagged with: regex
type: AnsweredQuestion
has body: I'm trying to write a regular expression in Java for this: "/[A-Z]{6}-[A-Z]{4}-[A-Z]{4}/" But it is not working. For example "AASAAA-AAAA-AAAA".matches("/[A-Z]{6}-[A-Z]{4}-[A-Z]{4}/") returns false. What is the correct way?
tagged with: java
has comment: http://stackoverflow.com/comment/37914771

http://stackoverflow.com/comment/37988518
type: AnswerComment
comment on: http://stackoverflow.com/a/24531795
score: 0
type: Comment
has text: The second does not need the cast?

http://stackoverflow.com/comment/37896120
has text: Is there any reason you would just use `MyInterface` as the parameter?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24482592

http://stackoverflow.com/q/24553068
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38055190
type: UnansweredQuestion
has title: How to test internationalisation in Android with JUnit
tagged with: android
upvote count: 1
tagged with: internationalization
answer count: 0
has body: I am writing a multi-language android app and I would like to test if the labels and others texts are correct. For example, in the English version the button will have the label "Download", in Germany "Nachladen", in Czech "Stahnout". My test code work fine for the language which is set in the testing device, but how do I programmatically run the test for every language on one device? import android.content.Intent; import android.test.ActivityUnitTestCase; import android.widget.Button; public class MenuActivityTest extends ActivityUnitTestCase&lt;MenuActivity&gt; { private Intent launchIntent; private MenuActivity activity; public MenuActivityTest() { super(MenuActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); launchIntent = new Intent(getInstrumentation().getTargetContext(), MenuActivity.class); } public void testSettingsButtonText() { startActivity(launchIntent, null, null); activity = getActivity(); final String expected = activity .getText(R.string.menu_button_text_settings).toString(); final Button button = (Button) activity .findViewById(R.id.menu_button_settings); final String actual = button.getText().toString(); assertEquals("Button text for Settings is wrong", expected, actual); } }
has comment: http://stackoverflow.com/comment/38104697
tagged with: java
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/38178443
linked to: http://stackoverflow.com/q/2900023
has comment: http://stackoverflow.com/comment/38138845
tagged with: junit
downvote count: 0

ascii
tags question: http://stackoverflow.com/q/24547462
tags question: http://stackoverflow.com/q/24588068
tags question: http://stackoverflow.com/q/24495916
type: Tag
tag name: ascii

http://stackoverflow.com/comment/37907412
has text: But as per the question, your requirement was to allow only input of 1s and 0s : **what I want to do is limit the input of the user in the jTextField only to 1s and 0s.**
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24488689
type: AnswerComment

http://stackoverflow.com/a/42236663
type: Answer
has body: tl;dr Implicit The getter/setter method naming conventions implicitly identify properties when the class is considered to be a JavaBean. Explicit Alternatively, you can identify those properties explicitly by defining a partner class that implements the BeanInfo interface. In Java 9 and later, you may use annotations to more conveniently implement BeanInfo. Details The JavaBeans spec was originally meant to be "a reusable software component that can be manipulated visually in a builder tool" such as drag-and-drop IDE form-building tools. That never really worked out. Instead, people commonly use the JavaBeans approach as a way of identifying properties. For example, the BeanItemContainer in Vaadin 7. At a minimum, a JavaBean must: Be serializable Have a no-args constructor Have getter/setter methods (“mutators”) matching a naming convention You can define a JavaBean either implicitly or explicitly. JavaBean naming conventions The implicit way to define a JavaBean is through naming conventions. Any methods starting with get, set, or is are detected by reflection/introspection and considered to identify a property. The imaginary property may or may not indeed be backed by a member variable on the class. If a Person class has getEyeColor and setEyeColor methods, then as a JavaBean we perceive a read-write “eyeColor” property. A getter without a setter makes the property read-only. BeanInfo interface The explicit way to define a JavaBean is to create another class alongside you intended JavaBean class. The other class implements the BeanInfo interface. Most likely the other class is actually a subclass of the SimpleBeanInfo class. That SimpleBeanInfo class implements the BeanInfo interface in a negative manner, denying info. You override the methods for the pieces of info you want to identify aspects of your JavaBean class. You can use the BeanInfo partner class to identify the properties (instead of using the getter/setter naming convention). And you can identify other…
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24529737
downvote count: 0

http://stackoverflow.com/q/24549267
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24550392
favorite count: 0
has answer: http://stackoverflow.com/a/24549775
has comment: http://stackoverflow.com/comment/38019736
has comment: http://stackoverflow.com/comment/38019539
tagged with: pdf-generation
has title: How to calculate the height of an element?
possible better answer: http://stackoverflow.com/a/24549775
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38019654
has body: I am generating pdf files by XML data. I calculate the height of a paragraph element as : float paraWidth = 0.0f; for (Object o : el.getChunks()) { paraWidth += ((Chunk) o).getWidthPoint(); } float paraHeight = paraWidth/PageSize.A4.getWidth(); But this method does not works correctly. Can you give me an idea?
accepted answer: http://stackoverflow.com/a/24550392
downvote count: 2
tagged with: itext
type: Question
score: -2
tagged with: java

http://stackoverflow.com/comment/37982463
type: AnswerComment
comment on: http://stackoverflow.com/a/24529212
score: 0
type: Comment
has text: if the List element is Object ,this code will put net.sf.ezmorph.bean.MorphDynaBean into list. you can create a new bean named data to put firstName lastName, in that way ,you need change code into `Map classMap = new HashMap(); classMap.put("data", Data.class); RequestAction re = (RequestAction) JSONObject.toBean(jsonObject,RequestAction.class);`

http://stackoverflow.com/comment/37812109
has text: Also what compiler are you using?
type: QuestionComment
comment on: http://stackoverflow.com/q/24436871
type: Comment
score: 1

http://stackoverflow.com/comment/38010082
type: Comment
comment on: http://stackoverflow.com/a/24543902
has text: Yeah, i was liking the buffered image because then I would kind of have all of graphical information of an Actor encapsulated (and therefore easy to gran and use for other things like button icons or something). I suppose a better solution would be to have another method call render with an image context on the fly if I need it. Thanks for the answer :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38040121
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24559433
has text: @ajb, You interpreted it corrected, I did mention it as `CONTINUE`, which is also known as Constant value in Java! :D
type: Comment

http://stackoverflow.com/comment/38051486
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24565475
has text: Honestly, every time I search google for a good java 2d game programming tutorial, I always end up with one showing me to use JPanel. Maybe I'm just using the wrong keywords, but anyways, what is a good way to push a bufferedImage to the JFrame, or is that even possible?

http://stackoverflow.com/q/24558451
possible better answer: http://stackoverflow.com/a/24570759
type: Question
accepted answer: http://stackoverflow.com/a/24570355
tagged with: drools
tagged with: java
has comment: http://stackoverflow.com/comment/38058601
has comment: http://stackoverflow.com/comment/38058908
upvote count: 4
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38060197
favorite count: 0
has comment: http://stackoverflow.com/comment/38058232
has answer: http://stackoverflow.com/a/24570355
has answer: http://stackoverflow.com/a/24570759
has title: Can't run hello world on drools - dlr files are not picked from classpath by KieContainer
has comment: http://stackoverflow.com/comment/38045456
score: 4
type: AnsweredQuestion
has body: Following documentation: 6.1. The Basics I created a simple class Applicant which should be checked with drl file loaded from the class path by KieContainer. From the doc: "At this point it is possible to create a KieContainer that reads the files to be built, from the classpath. KieServices kieServices = KieServices.Factory.get(); KieContainer kContainer = kieServices.getKieClasspathContainer(); The above code snippet compiles all the DRL files found on the classpath and put the result of this compilation, a KieModule, in the KieContainer. If there are no errors, we are now ready to create our session from the KieContainer and execute against some data:.." The problem is that the drl (rules files) are not loaded into the project by the KieContainer, and not applied to my test object. Test method: first two lines are from the older version just to check that the file is actually on the class path. And it does find the rules file. The rules files is located under: src/main/resources/bla/checkLicense.drl - correctly under resources. KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource("bla/checkLicense.drl"), ResourceType.DRL); KieServices kieServices = KieServices.Factory.get(); KieContainer kContainer = kieServices.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession(); Applicant applicant = new Applicant("Mr John Smith",16); System.out.println(applicant.toString()); assertTrue(applicant.isValid()); kSession.insert(applicant); kSession.fireAllRules(); System.out.printf(applicant.toString()); assertFalse(applicant.isValid()); The output: [main] INFO org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found kmodule: file:/Users/&lt;MyUserName&gt;/Drools/target/classes/META-INF/kmodule.xml [main] WARN org.drools.compiler.kie.builder.impl.ClasspathKieProject - Unable to find pom.properties in /Users/&lt;MyUserName&gt;/Drools/target/classes [main] INFO org.drools.compiler…
has comment: http://stackoverflow.com/comment/38060159

http://stackoverflow.com/comment/37955876
score: 0
comment on: http://stackoverflow.com/q/24504193
has text: Well i can not follow your explanation sorry. I dont understand what you are doing. But i was already afraid that you were experimenting while the phone was connected to your pc. Well do not do that. You are asking for troubles.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24567407
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
score: 6
downvote count: 0
has body: Getting the above said exception while posting a json to Spring Controller. It seems Jackson Mapper is not able to deserialize the json. CategoryDTO is annotated with: @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id", scope = CategoryDTO.class) JSON : [ { "categories":[ { "@id":27048, "name":"Sportbeha's", "description":null, "parent":{ "@id":22416, "name":"Fitness", "description":null, "parent":{ "@id":21727, "name":"Collectie", "description":null } } }, { "@id":27050, "name":"Sportbeha's", "description":null, "parent":{ "@id":24474, "name":"Voetbal", "description":null, "parent":21727 } } ] }, { "categories":[ { "@id":27048, "name":"Sportbeha's", "description":null, "parent":{ "@id":22416, "name":"Fitness", "description":null, "parent":{ "@id":21727, "name":"Collectie", "description":null } } }, { "@id":27050, "name":"Sportbeha's", "description":null, "parent":{ "@id":24474, "name":"Voetbal", "description":null, "parent":21727 } } ] } ] Java CODE : @JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL) @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id", scope = CategoryDTO.class) @JsonIgnoreProperties(ignoreUnknown = true) public class CategoryDTO implements Serializable{ private Long id; private String name; private String description; private CategoryDTO parent; @JsonIgnore public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public CategoryDTO getParent() { return parent; } public void setParent(CategoryDTO parent) { this.parent = parent; } } **Spring Controller :** @RequestMapping(value = "/categories", method = RequestMethod.POST, consumes = "application/json;charset=UTF-8", produces = "application/json;charset=UTF-8") pu…
tagged with: jackson
favorite count: 0
type: Question
has title: Jackson Mapper Not Deserializing JSON - (Could not read JSON: Already had POJO for id (java.lang.Integer))
has comment: http://stackoverflow.com/comment/38057047
tagged with: spring
upvote count: 6
has answer: http://stackoverflow.com/a/24577692

http://stackoverflow.com/comment/38089365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24586947
score: 1
has text: Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead [use layout managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html), or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).

http://stackoverflow.com/q/24434060
upvote count: 1
answer count: 1
tagged with: ejb
has body: I have tried to execute application which uses EJB and I've gotten this exception: javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446346 Maybe; nested exception is: org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace---------- org.omg.CORBA.MARSHAL: WARNING: 00810010: Error from readValue on ValueHandler in CDRInputStream vmcid: OMG minor code: 10 completed: Maybe at com.sun.proxy.$Proxy154.valuehandlerReadError(Unknown Source) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:912) at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1005) at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:518) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:383) at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:450) at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:171) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatchToServant(ServerRequestDispatcherImpl.java:528) at com.sun.corba.ee.impl.protocol.ServerRequestDispatcherImpl.dispatch(ServerRequestDispatcherImpl.java:199) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequestRequest(MessageMediatorImpl.java:1549) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:1425) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleInput(MessageMediatorImpl.java:930) at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:213) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.handleRequest(MessageMediatorImpl.java:694) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.dispatch(MessageMediatorImpl.java:496) at com.sun.corba.ee.impl.protocol.MessageMediatorImpl.doWork(MessageMediatorImpl.java:2222) at com.sun…
type: UnansweredQuestion
tagged with: glassfish
linked to: http://stackoverflow.com/q/23291520
downvote count: 0
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/23628150
type: Question
has title: What is the meaning of this ejb exception?
has answer: http://stackoverflow.com/a/24439288
tagged with: java

http://stackoverflow.com/comment/37875999
comment on: http://stackoverflow.com/q/24472020
type: Comment
type: QuestionComment
has text: Do you have any specific compiler settings that say to use Java 6? (there's some Eclipse settings like this, not sure about Studio)
score: 0

http://stackoverflow.com/comment/37853071
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24459832
has text: Must ask, is your font in your classpath? are you sure?
type: Comment

http://stackoverflow.com/comment/37962405
comment on: http://stackoverflow.com/q/24518052
type: Comment
type: QuestionComment
score: 2
has text: This looks like some kind of placeholder that would be referenced in the code later. Are you sure this variable isn't being used/modified somewhere else in the code? Perhaps to use as a template to create the actual statement?

http://stackoverflow.com/a/24570750
has body: This can be solved in many ways: 1. As I mentioned in my comment, Pass the current instance of ChequeGUI to the constructor of PrintChequeGUI and use that instance instead of creating new one in PrintChequeGUI PrintChequeGUI pcg = new PrintChequeGUI(this); and in PrintChequeGUI class public PrintChequeGUI(ChequeGUI gui) throws SQLException { (but i think its not a good approach) 2. For Better option, Pass the selected instance of Cheque to PrintChequeGUI as constructor argument. For this you need to create a TableModel with instance of Cheque. Sample is given below: package com.test; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; public class ChequeGUI extends JFrame { JTable guiTable = new JTable(); ChequeTableModel model; public ChequeGUI() throws SQLException { guiTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { // guiTable.getTableHeader().getDefaultRenderer(); int row = guiTable.getSelectedRow(); Cheque c = model.getChequeByRow(row); try { PrintChequeGUI pcg = new PrintChequeGUI(c); pcg.setTitle("Print Cheque"); pcg.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); } } }); model = new ChequeTableModel(); guiTable.setModel(model); add(new JScrollPane(guiTable)); model.loadData(); } public class ChequeTableModel extends AbstractTableModel { List<Cheque> dataModel; String[] columns = { "Cheque Number", "Payee Name", "Cheque Amount", "Cheque Date" }; public ChequeTableModel() { super(); dataModel = new ArrayList<Cheque>(); } @Override public int getColumnCount() { return columns.length; } @Override public String getColumnName(int column) { return columns[column]; } @Override public int getRowCount() { return dataModel.size(); } @Override public Object getValueAt…
has comment: http://stackoverflow.com/comment/38060550
answers question: http://stackoverflow.com/q/24567082
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24567082
has comment: http://stackoverflow.com/comment/38060663

http://stackoverflow.com/q/24527473
has comment: http://stackoverflow.com/comment/37978728
has answer: http://stackoverflow.com/a/24527609
type: Question
has answer: http://stackoverflow.com/a/24527637
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24527681
score: 0
has answer: http://stackoverflow.com/a/24527567
tagged with: java
tagged with: adt
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37978701
has answer: http://stackoverflow.com/a/24527708
has title: Edittext, on submit need to show on another window in android
has body: In android,i want to get a string from user using EditText and on click of submit button the string need to be show on another page/pane. here is my fragment.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;EditText android:id="@+id/msg" android:hint="@string/entertheip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Button1" /&gt; &lt;TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/thetext" android:visibility="invisible" /&gt; &lt;/LinearLayout&gt; and corresponding java class is this public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); Button bu = (Button)findViewById(R.id.button1); bu.setOnClickListener(new View.OnClickListener() { private TextView tv = (TextView)findViewById(R.id.tv); @Override public void onClick(View v) { // to view the ip in another page try{ EditText et = (EditText)findViewById(R.id.msg); String t = et.getText().toString(); tv.setText(t); }catch(NullPointerException e){ e.printStackTrace(); } } }); } } But i am getting the Edit Text and Button only, the text is not showing in another page. Kindly help in this.

http://stackoverflow.com/q/24433270
score: 0
answer count: 1
tagged with: junit
has body: When I try to run my unit tests and e.g. add System.in.read() and I run them via Intellij, the console to which I normally can type does not accept any input... As if Junit was redirecting stdin somehow... I basically want the test to wait for my key press - is there an alternative way to do this or reset stdin?
has title: Junit - cannot read from std in
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24459845
tagged with: java
type: Question

http://stackoverflow.com/comment/37842182
has text: I tried with just the `authenticate()` action and it worked as expected. What does your `routes` file look like for that section?
comment on: http://stackoverflow.com/q/24451631
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37921151
type: Comment
has text: *Why that may be I haven't a clue* - Maybe an education scenario, where they want to avoid having to deal with students being confused because incrementing an `Integer` has no effect?
comment on: http://stackoverflow.com/q/24481516
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37980281
score: 0
type: Comment
type: QuestionComment
has text: Where is the quetion? Can you please elaborate in more details.
comment on: http://stackoverflow.com/q/24528335

http://stackoverflow.com/a/24533176
type: Answer
score: 2
upvote count: 2
has body: RIGHT. It is doable but this is a bit of a roundabout way. First, include this class into your code (From this StackOverflow Question) import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.util.prefs.Preferences; public class WinRegistry { public static final int HKEY_CURRENT_USER = 0x80000001; public static final int HKEY_LOCAL_MACHINE = 0x80000002; public static final int REG_SUCCESS = 0; public static final int REG_NOTFOUND = 2; public static final int REG_ACCESSDENIED = 5; private static final int KEY_ALL_ACCESS = 0xf003f; private static final int KEY_READ = 0x20019; private static Preferences userRoot = Preferences.userRoot(); private static Preferences systemRoot = Preferences.systemRoot(); private static Class&lt;? extends Preferences&gt; userClass = userRoot.getClass(); private static Method regOpenKey = null; private static Method regCloseKey = null; private static Method regQueryValueEx = null; private static Method regEnumValue = null; private static Method regQueryInfoKey = null; private static Method regEnumKeyEx = null; private static Method regCreateKeyEx = null; private static Method regSetValueEx = null; private static Method regDeleteKey = null; private static Method regDeleteValue = null; static { try { regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey", new Class[] { int.class, byte[].class, int.class }); regOpenKey.setAccessible(true); regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey", new Class[] { int.class }); regCloseKey.setAccessible(true); regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx", new Class[] { int.class, byte[].class }); regQueryValueEx.setAccessible(true); regEnumValue = userClass.getDeclaredMethod("WindowsRegEnumValue", new Class[] { int.class, int.class, int.class }); regEnumValue.setAccessible(true); regQueryInfoKey = userClass.getDeclaredMeth…
has comment: http://stackoverflow.com/comment/37989420
accepted answer of: http://stackoverflow.com/q/24532819
answers question: http://stackoverflow.com/q/24532819
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38030794
type: QuestionComment
comment on: http://stackoverflow.com/q/24512662
has text: The error its on YouTube().getVideos(String), do you know what to do?
type: Comment
score: 0

http://stackoverflow.com/a/29541677
type: Answer
answers question: http://stackoverflow.com/q/24455107
score: 2
upvote count: 2
has body: Using @Primary annotation with your bean(one of them from the two) can solve the issue.The Question however still remains as to why the @Resource annotation for Spring is unable to distinguish based on Autowiring. Reference "Autowiring two beans implementing same interface - how to set default bean to autowire?"
downvote count: 0

http://stackoverflow.com/comment/37802665
comment on: http://stackoverflow.com/q/24428394
score: 0
type: Comment
type: QuestionComment
has text: But let's say you would have to use multiple methods of the list, like.. add,remove,sort,etc.. would you encapsulate them all?

http://stackoverflow.com/comment/38079337
score: 0
has text: Possibly, but in that case I don't fully understand the question. I read it as "What is extends for?" But possibly its more nuanced than that. Is this composition vs extention?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24581337

http://stackoverflow.com/comment/38063370
comment on: http://stackoverflow.com/q/24571705
score: 0
type: Comment
type: QuestionComment
has text: Instead of the default you can configure the `TransportHandlingSockJsService` by explictly specifing which `handlers` yuo want to use. However I would consider it a work-around. All the mvc code is doing detection for jackson and here is a class which assumes that it is on the classpath. I suggest you register a bug/enhancement for spring-websockets in [jira](http://jira.spring.io).

http://stackoverflow.com/q/24558632
type: Question
has comment: http://stackoverflow.com/comment/38036946
has comment: http://stackoverflow.com/comment/38036940
tagged with: clone
tagged with: java
has comment: http://stackoverflow.com/comment/38036909
has body: why do i am getting clone method not visible of object class class a7 implements Cloneable { int id; float f; } class test { public static void main(String[] args) throws CloneNotSupportedException { a7 x=new a7(); // x.clone(); //here i am getting the error } } though clone method is protected and it is accessible by subclasses and and the one in the same package and we know that every class by default are subclasses of object class
has comment: http://stackoverflow.com/comment/38036876
answer count: 1
has comment: http://stackoverflow.com/comment/38036818
has comment: http://stackoverflow.com/comment/38036900
score: 0
has comment: http://stackoverflow.com/comment/38036921
has title: Clone method not visible
has answer: http://stackoverflow.com/a/24558717
type: UnansweredQuestion

http://stackoverflow.com/a/24467203
has comment: http://stackoverflow.com/comment/37866793
has body: List&lt;Integer&gt; achievedPoints = new ArrayList&lt;&gt;(allPlayers.values()); Collections.sort(achievedPoints); /*- from few points to many points */ int requiredScore = achievedPoints.get(achievedPoints.size()); Map&lt;String, Integer&gt; playersInNextRound = new HashMap&lt;&gt;(); for (Map.Entry&lt;String, Integer&gt; player : allPlayers.entrySet()) { if (player.getValue() &gt;= requiredScore) { playersInNextRound.put(player.getKey(), player.getValue()); } }
answers question: http://stackoverflow.com/q/24467137
score: 0
type: Answer

http://stackoverflow.com/q/24550641
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/24550755
type: Question
tagged with: jakarta-ee
answer count: 2
score: 0
has title: Spring : Responding to a REST-ful API call
has comment: http://stackoverflow.com/comment/38024725
linked to: http://stackoverflow.com/q/20067057
tagged with: rest
has comment: http://stackoverflow.com/comment/38022884
type: UnansweredQuestion
has body: I am trying to implement REST API endpoints in y application. @Controller public class HerokuController { @RequestMapping(value = "/heroku/resources/", method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity&lt;JSONObject&gt; provision(@RequestBody JSONObject body){ System.out.println("called! \n"); JSONObject response = new JSONObject(); response.put("id", 555); response.put("message", "Provision successful!"); return new ResponseEntity&lt;JSONObject&gt;(response,HttpStatus.OK); } So I wrote this class containing a method which mapping is (heroku/ressources). But when I try to call it, I get a 404 error because /WEB-INF/heroku/resources.jsp not found. However, I don't even want to get a view but a HTTP response. Can anyone tell me which configuration file should we generally modify to tell Spring that this controller doesn't want to send back a view but a HTTP response? The method is however called if I change it to this : @RequestMapping(value = "/heroku/resources/", method = RequestMethod.POST) public ModelAndView provision(final HttpServletRequest request){ System.out.println("called! \n"); JSONObject response = new JSONObject(); response.put("id", 555); response.put("message", "Provision successful!"); final Map&lt;String, Object&gt; result = new HashMap&lt;String, Object&gt;(); return new ModelAndView("jsonView",result); } So changing the return type to "ModelAndView". thanks.
tagged with: spring
has answer: http://stackoverflow.com/a/24553326

http://stackoverflow.com/a/24459669
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37935021
has comment: http://stackoverflow.com/comment/37878378
has body: What you're after cannot be implemented with your current webservice style. First, JAXB will not inject the default value into the message, if the element is not present in the original message sent. From the JAXB manual element defaults do not kick in when the element is absent, so unfortunately we can't change this behavior. As a workaround, you could change your webservice style to WRAPPED. With this style, you can encapsulate your webservice parameters in a single parent type (a simple RequestWrapper if you will). Given that flexibility, your clients can supply a single parent type that may or may not contain both parameters. Your wrapper should look something like: @XmlRootElement public class YourWrapper { String company; @XmlElement(name="limitTop",required="false",defaultValue="100") int limitTop; //getters and setters } Also, @RequestWrapper(targetNamespace="http://you.com/ws/types", className="com.you.YourWrapper") @WebMethod(operationName = "getCustomers") @WebResult(name = "customer") public Customer[] getCustomers(@WebParam(name = "company") String company, @WebParam(name = "limitTop") int limitTop){ //Logic of getting customer be here } Given the above, JAXB will be able to ignore the absence of the value and possibly set the default after the unmarshalling
accepted answer of: http://stackoverflow.com/q/24441730
upvote count: 2
answers question: http://stackoverflow.com/q/24441730

http://stackoverflow.com/q/24582814
score: 1
tagged with: java
has body: I have the java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE. While deploying my application on google app engine, I have searched for solutions and found that i should add: -vm C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe to eclipse.ini file to force eclipse to use JDK not JRE, I have confirmed from windows >> prefrences >> java >>> installed JRE that it points to the JDK not the JRE ... I tried uninstalling the whole jdk and installing it again ... and I still have the problem .... eclipse.ini file is: -vm C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20140116-2212 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m and from Help >> About Eclipse >>>Installation details >>>configuration: I have this: -startup F:\programs\some\eclipse-jee-kepler-SR2-win32\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.appendVmargs -vm C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe -product org.eclipse.epp.package.jee.product -vm C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll eclipse.home.location=file:/F:/programs/some/eclipse-jee-kepler-SR2-win32/eclipse/ eclipse.launcher=F:\programs\some\eclipse-jee-kepler-SR2-win32\eclipse\eclipse.exe eclipse.launcher.name=Eclipse eclipse.p2.data.area=@config.dir/../p2/ JAVA_HOME variable value: C:\Program Files\Java\jdk1.7.0_02\bin
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/42213020
has comment: http://stackoverflow.com/comment/38092321
accepted answer: http://stackoverflow.com/a/24606034
tagged with: eclipse
has comment: http://stackoverflow.com/comment/38089553
answer count: 2
downvote count: 0
has title: Google app engine deployment : JDK not JRE
favorite count: 0
linked to: http://stackoverflow.com/q/13938995
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24606034
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/42213020
has comment: http://stackoverflow.com/comment/38082416

http://stackoverflow.com/comment/38032501
score: 0
type: QuestionComment
type: Comment
has text: Very correct logic @Michelle,I'm with you.This `enum` model is very close to the real world `coin-tossing problem`,including nulls too!
comment on: http://stackoverflow.com/q/24556082

http://stackoverflow.com/q/24446109
accepted answer: http://stackoverflow.com/a/24448072
has title: Augmented Reality applications using Java API
tagged with: android
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: augmented-reality
has body: I am currently new to augmented reality programming and i would like to ask a question regarding AR app. I have downloaded "Augmented Reality" app from the play store . Using Augmented Reality app, I could be able to view some 3D model objects such as front view, back view, left and right side views. I have taken a print out of Universal tracker sheet so with the help of Universal tracker, I could be able to view some 3D model objects. For an example, car or bike can be placed on a universal tracker (printed sheet) and then the objects can be viewed in a graphical views. I can understand that with the help of "Augmented Reality" concept, the objects can be viewed in a 3D graphic model with their actual size that is integrated in real time environment. I could also be able to understand that Universal tracker is a software and should capture the objects then with the help of some software those objects can be rendered and viewed as a 3D model. When I researched about Augmented Reality technology, could be able to see many open source library and engines such as AR-Tool kit, Mixare so on. By using Wikitude SDK can achieve this. I know that AR provides API for interacting with a camera and it supports OpenGl graphics so as a Java/Android developer how can I begin with or develop an AR applications for Android? I referred to Wikitude SDK with Android and Java. Wikitude SDK As far, I know that AR tool kit is written in Java. As a Java Android Developer, how to work with Wikitude SDK to develop such apps as I mentioned above here? Is there any sample apps or tutorial based on Android with Java?
type: Question
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24448072

http://stackoverflow.com/comment/37837766
comment on: http://stackoverflow.com/q/24451609
has text: http://stackoverflow.com/questions/14531235/in-java-is-it-more-efficient-to-use-byte-or-short-instead-of-int-and-float-inst
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/37798775
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24430521
type: QuestionComment
has text: Please edit your question with your code.

http://stackoverflow.com/comment/38014763
comment on: http://stackoverflow.com/q/24546595
has text: It isn't clear what the you are trying to do here? Perhaps you are want a function field in the return results? Or you are trying to query on dates that only differ by a certain number of seconds?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37807660
type: QuestionComment
comment on: http://stackoverflow.com/q/24434579
has text: That is the limit for the overall request, not for the single file size: http://stackoverflow.com/a/16934584/1654265
score: 0
type: Comment

http://stackoverflow.com/comment/37978474
comment on: http://stackoverflow.com/a/24525836
has text: I'm stamping my form? I iterate through the pages I will show, if it should only show 3 pages, then I'll try to stamp only the 3 pages en not the whole 10. What do you mean with I'm filling first and not last? Codeline of this?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37895545
has text: @zx81: out of curiosity: what if you want to capture the boundary (say you are interested in the delimiter at the end of the word).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24482216
type: Comment

http://stackoverflow.com/comment/37913564
has text: `matches` doesn't need `^` `$` flags because it checks if regex matches **entire** String by default.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24491975
type: AnswerComment

http://stackoverflow.com/a/24506323
type: Answer
answers question: http://stackoverflow.com/q/24493130
has body: Got it resolved, simple mistake, failed to call super() =/
score: 0

http://stackoverflow.com/comment/37948742
type: QuestionComment
comment on: http://stackoverflow.com/q/24511278
has text: Is your search list always only 2 elements?
score: 0
type: Comment

prepared-statement
tags question: http://stackoverflow.com/q/24559911
tags question: http://stackoverflow.com/q/24518052
tags question: http://stackoverflow.com/q/24520340
type: Tag
tags question: http://stackoverflow.com/q/24528337
tags question: http://stackoverflow.com/q/24504101
tags question: http://stackoverflow.com/q/24510114
tag name: prepared-statement

http://stackoverflow.com/a/24561999
accepted answer of: http://stackoverflow.com/q/24561449
type: Answer
has comment: http://stackoverflow.com/comment/38043453
upvote count: 1
has comment: http://stackoverflow.com/comment/38043469
has body: I made a similar example just so you can get the basic jest of it, try copy pasting this in a new class called "LabelPlay" and it should work fine. import java.awt.EventQueue; import java.util.Random; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class LabelPlay { private JFrame frame; private JLabel label; private Random rand; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LabelPlay window = new LabelPlay(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public LabelPlay() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 659, 518); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); label = new JLabel("YEEEHAH!"); label.setBounds(101, 62, 54, 21); frame.getContentPane().add(label); JButton btnAction = new JButton("Action!"); rand = new Random(); btnAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int a = rand.nextInt(90)+10; int b = rand.nextInt(90)+10; int c = rand.nextInt(640)+10; int d = rand.nextInt(500)+10; label.setBounds(a, b, c, d); } }); btnAction.setBounds(524, 427, 89, 23); frame.getContentPane().add(btnAction); } } If you want this to happen in a loop at certain times, you can just put it in a loop and use Thread.sleep(amount of miliseconds) in the loop before you run the code.
has comment: http://stackoverflow.com/comment/38043426
answers question: http://stackoverflow.com/q/24561449
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38043493
score: 1

http://stackoverflow.com/a/24441038
has body: The intValue() method will only keep the lowest 32 bits that will fit in an int, discarding information if necessary. Converts this BigInteger to an int. This conversion is analogous to a narrowing primitive conversion from long to int as defined in section 5.1.3 of The Java™ Language Specification: if this BigInteger is too big to fit in an int, only the low-order 32 bits are returned. Note that this conversion can lose information about the overall magnitude of the BigInteger value as well as return a result with the opposite sign. The intValueExact() method will throw an exception in this case rather than give you a different value. Converts this BigInteger to an int, checking for lost information. If the value of this BigInteger is out of the range of the int type, then an ArithmeticException is thrown.
answers question: http://stackoverflow.com/q/24441015
type: Answer
upvote count: 15
downvote count: 0
score: 15

http://stackoverflow.com/a/24477489
has comment: http://stackoverflow.com/comment/37886500
score: 1
answers question: http://stackoverflow.com/q/24477338
has body: Add this above mysql-dataSource As first "Arg" is the scope, and without it, the rest of your arguments are out of position, and are probably causing your issue. For more information Jetty/Howto/Configure JNDI Datasource Edit : Have you add scope provided for the specific version of Jetty ?
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/24482074
has comment: http://stackoverflow.com/comment/38011122
upvote count: 3
score: 3
has body: Creating an ArrayList like this really doesn't make sense, and goes completely against the purpose of a language centered around objects. Create a Product class, give it a name, price, and size field, and then create an ArrayList of Product objects. To get the sum of the prices, you could iterate over every Product in the ArrayList and add its price: Sidenote: Storing monetary values as a double is horrible idea. I only did it to show you how to get started. FINAL EDIT You need to create a class called Product with the following code: public class Product { public String name, size; public double price; public Product(String name, String size, double price){ this.name = name; this.size = size; this.price = price; } } In your Main Class: public static void main(String[] args){ ArrayList&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); products.add(new Product("Shorts", "Small", 5.45); products.add(new Product("Shirt", "Large", 15.15); products.add(new Product("Hat", "Small", 10.25); //Calculate total price. double price = 0.00; for(Product p : products){ price += p.price; } System.out.println("Total cost: " + price); }
answers question: http://stackoverflow.com/q/24482003
downvote count: 0
has comment: http://stackoverflow.com/comment/38011019
has comment: http://stackoverflow.com/comment/38010976
has comment: http://stackoverflow.com/comment/37996524
has comment: http://stackoverflow.com/comment/37928975
has comment: http://stackoverflow.com/comment/37996340
type: Answer
has comment: http://stackoverflow.com/comment/37895971
has comment: http://stackoverflow.com/comment/38011064

http://stackoverflow.com/comment/38079991
comment on: http://stackoverflow.com/a/24580846
has text: True. That's why I like to add my own method 'beenInterrupted` that will check and stay checked if `interrupted` has ever been called.
score: 0
type: AnswerComment
type: Comment

velocity
tags question: http://stackoverflow.com/q/24442295
tags question: http://stackoverflow.com/q/24462292
tags question: http://stackoverflow.com/q/24490102
tags question: http://stackoverflow.com/q/24548914
type: Tag
tags question: http://stackoverflow.com/q/24456773
tags question: http://stackoverflow.com/q/24441100
tag name: velocity

http://stackoverflow.com/q/24445721
tagged with: spring
score: 2
tagged with: transactions
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24446039
has body: I have a very weird error working with Spring JPA transactions. The thread is locked around 16 minutes and then continues without any problem. Here is the situation: @Transactional(propagation = Propagation.REQUIRES_NEW) public class A { public String encrypt(String str){ LOG.debug("encrypting..."); // just data base read operations } public String encrypt(String str, String str2){ // read and write database operations. } public String foo(...){ // read and write database operations. } public String bar(...){ // read and write database operations. } } @Transactional(propagation = Propagation.REQUIRES_NEW) public class B { public String doSomething(...){ LOG.debug("calling encrypt method..."); String chain1 = this.a.encrypt("whatever"); LOG.debug("calling encrypt method..."); String chain2 = this.a.encrypt("again"); LOG.debug("calling encrypt method..."); String chain3 = this.a.encrypt("and again"); ... } } Taking a look to the log file I see that it takes 16 minutes from log "calling encrypt method" to "encripting". So, have activated JTA logs and this is what I see: 15:09:04.317 DEBUG e.i.n.p.d.TipoMensajeDaoDelegate [45] - obteniendo mensaje para tipo operacion 0104 y protocolo 03 15:09:04.318 DEBUG o.s.orm.jpa.JpaTransactionManager [332] - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@4e6b01e9] for JPA transaction 15:09:04.319 DEBUG o.s.orm.jpa.JpaTransactionManager [471] - Participating in existing transaction 15:09:04.320 DEBUG o.s.orm.jpa.JpaTransactionManager [332] - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@4e6b01e9] for JPA transaction 15:09:04.321 DEBUG o.s.orm.jpa.JpaTransactionManager [471] - Participating in existing transaction 15:09:04.324 DEBUG e.i.n.c.p.p.b.B [485] - calling encrypt method... 15:09:04.325 DEBUG o.s.orm.jpa.JpaTransactionManager [332] - Found thread-bound EntityManager [org.hibernate.ejb.EntityManagerImpl@4e6b01e9] for JPA transaction 15:09:04.326 DEBUG o.s.orm.jpa.JpaTransactionMan…
type: Question
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/87830686
has comment: http://stackoverflow.com/comment/118224303
linked to: http://stackoverflow.com/q/10736862
answer count: 1
favorite count: 0
has title: Thread lock after opening new EntityManager
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/37866089
score: 0
type: Comment
type: QuestionComment
has text: Oops, "the key is to **do** any long-running tasks in a background thread..."
comment on: http://stackoverflow.com/q/24466620

http://stackoverflow.com/comment/38731489
score: 0
comment on: http://stackoverflow.com/q/24448597
has text: @Sergey Yes, my code is working now. I've uploaded my code to [Github](https://github.com/yushulx/JavaTwain).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24573109
tagged with: executable-jar
tagged with: jar
has comment: http://stackoverflow.com/comment/38063620
type: Question
has answer: http://stackoverflow.com/a/24573365
has title: Modification in a Jar file
has answer: http://stackoverflow.com/a/24573745
has comment: http://stackoverflow.com/comment/38064133
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/2279451
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14821715
has answer: http://stackoverflow.com/a/24573183
has body: I have a jar file which consists of some java files, class files of those java files and some properties files. Now I need to make some modifications in those java files. I can extract the jar using 7 zip, can do the required changes in the java files and then saves it, but what about the class files? I have did some search regarding, but did not found any solution that works for me. Can anyone suggest me the steps needs to be followed to achieve this.

cxf
tags question: http://stackoverflow.com/q/24447280
tags question: http://stackoverflow.com/q/24513430
tags question: http://stackoverflow.com/q/24433234
type: Tag
tags question: http://stackoverflow.com/q/24508753
tags question: http://stackoverflow.com/q/24430313
tags question: http://stackoverflow.com/q/24439525
tags question: http://stackoverflow.com/q/24553832
tags question: http://stackoverflow.com/q/24577316
tags question: http://stackoverflow.com/q/24497494
tags question: http://stackoverflow.com/q/24469256
tags question: http://stackoverflow.com/q/24484121
tags question: http://stackoverflow.com/q/24528729
tags question: http://stackoverflow.com/q/24545702
tag name: cxf
tags question: http://stackoverflow.com/q/24513442
tags question: http://stackoverflow.com/q/24475134
tags question: http://stackoverflow.com/q/24563583
tags question: http://stackoverflow.com/q/24452890
tags question: http://stackoverflow.com/q/24485993
tags question: http://stackoverflow.com/q/24447695
tags question: http://stackoverflow.com/q/24519044
tags question: http://stackoverflow.com/q/24430845

http://stackoverflow.com/comment/37979126
comment on: http://stackoverflow.com/a/24508534
type: AnswerComment
score: 0
type: Comment
has text: thanks is their any open source tool or easy way I can do this like you

http://stackoverflow.com/comment/38099935
has text: `I could call another class that in turn calls X.doSomething(); but this class would only exist because of the name clash, which seems very messy` +1 for attitude of clean code. But for me it seems like this is a situation you should do a tradeoff. Simply do this, and throw a nice long comment about why you had to do it (probably with a link to this question).
comment on: http://stackoverflow.com/q/24572214
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/24434156
answers question: http://stackoverflow.com/q/24433078
has comment: http://stackoverflow.com/comment/37989104
has comment: http://stackoverflow.com/comment/37991229
has comment: http://stackoverflow.com/comment/37988543
type: AcceptedAnswer
downvote count: 0
has body: According to the javadoc of AbstractAuthenticationFilterConfigurer (for Spring-Security 3.2.x), Spring security normally does this automatically for you redirecting to "/login?error" If you want to redirect to another page and you are using login form authentication, you can do that by adding http.formLogin().failureUrl("/SngErrorHandler") in the configure(HttpSecurity http) method of your WebSecurityConfigurerAdapter. This has to be adapted if you are using other authentication methods.
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24433078
score: 2

http://stackoverflow.com/a/24582670
type: Answer
has body: You can use regex to test if the string matches a certain pattern. The regex could be this: ^Chapter \\d+: .* ^ means it has to start with this string \\d+ means it has to be one or more digits in that place .* any more characters for 0 or more times And then the function would be this (using the String#matches) public static boolean validChapter (String s) { return s.matches("^Chapter \\d+: .*"); } Here are some tests: public static void main(String[] args) { String str1 = "Chapter 1: Home"; String str2 = "Chapter 2: Revenge"; String str3 = "Chapter 3c: Return"; String str4 = "Chapter 1:Return"; System.out.println(validChapter(str1)); // true System.out.println(validChapter(str2)); // true System.out.println(validChapter(str3)); // false System.out.println(validChapter(str4)); // false }
accepted answer of: http://stackoverflow.com/q/24582547
answers question: http://stackoverflow.com/q/24582547
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/38012987
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24545654
score: 0
has text: Your question is still unclear. Your question includes 5 types, without describing the type hierarchy. I'm sure you could demonstrate the problem with a short but complete program which would be significantly clearer.

http://stackoverflow.com/comment/37814011
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24438030
has text: Can you remove the `view.removeAllViews();` line and see how it goes?

http://stackoverflow.com/q/24446783
tagged with: spring
has comment: http://stackoverflow.com/comment/55557131
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36843366
tagged with: spring-4
tagged with: cookies
tagged with: java
has body: I'm writing an messenger with JavaFX and Spring4 on client-site and Spring4 on server-site. I secured the server with spring-security 3.2. Now my Problem: I have a loginpage on the client witch sends the login information to spring-security and receive the JSESSIONID cookie. This works fine but when I try to send the JSESSIONID with my request I become an org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class org.messenger.rest.JSONConversationResult] and content type [text/html;charset=UTF-8] Server Inizializer public class SpringMvcInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[] {ApplicationConfig.class}; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] {WebConfig.class}; } @Override protected String[] getServletMappings() { return new String[] {"/"}; } } Server SecurityInizializer public class SpringSecurityInitializer extends AbstractSecurityWebApplicationInitializer { } Server SecurityConfig @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private DriverManagerDataSource dataSource; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { String authQuery = "select userid, authority from user where userid = ?"; String userQuery = "select userid, pw, enabled from user where userid = ?"; auth.jdbcAuthentication().dataSource(dataSource) .passwordEncoder(passwordEncoder()) .usersByUsernameQuery(userQuery) .authoritiesByUsernameQuery(authQuery); } @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/register").permitAll() .antMatchers("/getconvs", "/getcontacts").hasRole("USER") .and() .formLogin() .and() .csrf().disable(); } @Bean public AuthenticationEntryPoint authenticationEntryP…
type: Question
answer count: 1
downvote count: 0
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/36843366
favorite count: 0
upvote count: 8
has title: How to send received jsessionid via spring 4 resttemplate
score: 8

http://stackoverflow.com/comment/37882120
comment on: http://stackoverflow.com/a/24475218
type: AnswerComment
score: 0
has text: Okay then, I see, there's some hack on it. But, in Arrays.sort there's now the same hack for making it work on `O(n)`: [this code](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/DualPivotQuicksort.java#DualPivotQuicksort.sort%28char%5B%5D%2Cint%2Cint%29)(really, there's counting sort, which takes `O(n)` on such a structures) is used for [sorting](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/Arrays.java#Arrays.sort%28char%5B%5D%29) `char[]` arrays.
type: Comment

http://stackoverflow.com/a/25177274
score: 2
downvote count: 0
has body: Many questions here. 1 - Using fx:root allows you to customize FXMLLoader, you can change the way you instanciate components: How to create multiple javafx controllers with different fxml files? But, with SceneBuilder 2 it does not work well at all! The "canonic" way with Scene Builder 2 (worked fine with 1) seems to NOT use fx:root. 2 - It depends on your pattern chosen in 1. Could be a custom java component in FXML with an explicit import, or using fxml:include. Either FXML first then controller. Or abstract component (and controller as fx:root) then FXML. 3 - SceneBuilder 2 has many troubles with classloaders as each custom component is loaded with a distinct class loader which means you'll run a lot with class not found like exceptions. One way to fix it is to fork SceneBuilder to force it using only one classloader for all custom components: Custom Components in Scenebuilder 2.0 Or wait for a fix. Or not using fx:root and prefering fx:include. Or not using Scene Builder at all which is for many a valid solution.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24499984
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24499984
type: Answer

http://stackoverflow.com/comment/55788126
type: QuestionComment
comment on: http://stackoverflow.com/q/24464349
has text: Hi, can someone share the complete code for encode and decode? I'm having difficulty translating the example code from C# to Android Java
score: 0
type: Comment

http://stackoverflow.com/comment/38012068
has text: @IngoBürk Google indeed.
comment on: http://stackoverflow.com/q/24545184
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38028479
has text: Than either all "javac is not recognised" questions should be closed as off-topic or the most useful of these question can be un-off-topiced and made into a canonical.
comment on: http://stackoverflow.com/q/24553930
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24518408
type: UnansweredQuestion
tagged with: apache-storm
has title: Moving data to HDFS with Storm
tagged with: java
linked to: http://stackoverflow.com/q/16000840
type: Question
score: 0
has body: Need some help to understand how HDFS and Storm are integrated. Storm can process incoming stream of data using many nodes. My data is, let's say, log entries from different machines. So how do I store that all? Ideally I'd like to store logs from one machine to a one or many files dedicated to that machine. However does does it work? Will I be able to append to the same file in HDFS from many different Storm nodes? PS: I still working on getting all this running so I can't test this physically... but it does bother me.
answer count: 1
tagged with: hdfs
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/24520067

http://stackoverflow.com/q/24497511
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24498252
has body: I'd like to write an Android Application which automatically decrypts my Whatsapp Database, so I followed this tutorial and translated it into Java. But then I noticed that there is no openssl binary on Android so I asked google how to decrypt aes manually but I could not find something useful. So basically I got this shell command openssl enc -aes-256-cbc -d -nosalt -nopad -bufsize 16384 -in msgstore.db.crypt7.nohdr -K $k -iv $iv &gt; msgstore.db with $k being a 64 digit hex-string. But when I tried to use it as the key for the aes decryption I get an InvalidKeyException with the message "Unsupported key size: 64 bytes". When I execute this command at my computer I works perfectly. I am currently using this java code to decrypt the database and it fails at cipher.init: public void decryptDatabase(String k, String iv) throws InvalidKeyException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchPaddingException, IOException { File extStore = Environment.getExternalStorageDirectory(); FileInputStream fis = new FileInputStream(extStore + "/WhatsApp/Databases/msgstore.db.crypt7.nohdr"); FileOutputStream fos = new FileOutputStream(extStore + "/Decrypted.db"); SecretKeySpec sks = new SecretKeySpec(k.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, sks, new IvParameterSpec(iv.getBytes())); CipherInputStream cis = new CipherInputStream(fis, cipher); int b; byte[] d = new byte[8]; while ((b = cis.read(d)) != -1) { fos.write(d, 0, b); } fos.flush(); fos.close(); cis.close(); } Please help me if you can :) Thanks in advance, Citron
has comment: http://stackoverflow.com/comment/46310634
has title: Whatsapp database decryption on Android
has comment: http://stackoverflow.com/comment/37924040
has comment: http://stackoverflow.com/comment/37924267
downvote count: 0
answer count: 1
tagged with: whatsapp
favorite count: 0
has comment: http://stackoverflow.com/comment/37924182
accepted answer: http://stackoverflow.com/a/24498252
tagged with: encryption
tagged with: android
has comment: http://stackoverflow.com/comment/48176930
has comment: http://stackoverflow.com/comment/37924227
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/38022266
type: Comment
type: QuestionComment
score: 0
has text: @TeRRo my device doesn't even show on the DDMS
comment on: http://stackoverflow.com/q/24550603

http://stackoverflow.com/a/24446910
answers question: http://stackoverflow.com/q/24445096
type: Answer
score: 0
upvote count: 1
has body: Note that the object mapper is relatively expensive to create. It is thread safe and designed to be reused. So instead of creating your own context you can consider customizing the Jackson JAX-RS provider per request without creating a new mapper instance. There are couple ways you can achieve that. You can annotate your resource method with the Jackson specific annotations. Example: @JacksonFeatures(serializationEnable = { SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS }) public void foo() {} But that doesn't allow to pass the request parameters to the object mapper. Another option is to create an instance of ObjectWriterModifier/ObjectReaderModifier and register it via thread local injection via ObjectWriterInjector/ObjectReaderInjector. See example. You can also try to combine a per-request scope context provider and the thread local modification.
downvote count: 1
has comment: http://stackoverflow.com/comment/37927600

http://stackoverflow.com/comment/37992511
comment on: http://stackoverflow.com/q/24530251
score: 0
has text: It probably is not the cause, then.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24537122
has body: So I am trying to create an android app that will generate a random number based on 2 numbers submitted by the end user. I have the following code which works until you click on the generate button: MainActivity.java public class MainActivity extends Activity { EditText nu1; EditText nu2; TextView number; Button button1; Random randomGenerator = new Random(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button1 = (Button) findViewById(R.id.button1); button1.setOnClickListener(new Button.OnClickListener() { public void onClick(View v){ int min = Integer.parseInt(nu1.getText().toString()); int max = Integer.parseInt(nu2.getText().toString()); number.setText("Random Number: " + randomGenerator(min, max)); } }); AdView adView = (AdView)this.findViewById(R.id.adView1); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } public static int randomGenerator(int min, int max) { Random rand = new Random(); int randomNum = rand.nextInt((min - max) + 1) + min; return randomNum; } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <requestFocus /> <TextView android:id="@+id/nu2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/editText2" android:layout_alignRight="@+id/editText2" android:layout_below="@+id/editText1" android:layout_marginTop="18dp" android:text="@string/no2" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center" /> <TextView android:id="@+id/nu1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/editText1" android:layout_alignParentTop="true" android:layout_alignRight="@+id/editText1" android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/number" android:layout_width="wrap_co…
has answer: http://stackoverflow.com/a/24537196
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/37996681
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/24537196
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37996752
has title: Using user created variables to create a random number Android
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/a/24535760
score: 0
answers question: http://stackoverflow.com/q/24535139
type: Answer
has body: You can use a Regex to detect form-feed (page break) characters. Try something like this: File fileDir = new File("DIRECTORY OF FILE"); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8")); String str; Regex pageBreak = new Regex("(^.*)(\f)(.*$)") while ((str = in.readLine()) != null) { Match match = pageBreak.Match(str); bool pageBreakFound = match.Success; if(pageBreakFound){ String textBeforeLineBreak = match.Groups[1].Value; //Group[2] will contain the form feed character //Group[3] will contain the text after the form feed character //Do whatever logic you want now that you know you hit a page boundary } System.out.println(str); } in.close(); The parenthesis around portions of the Regex denote capture groups, which get recorded in the Match object. The \f matches on the form feed character. Edited Apologies, for some reason I read C# instead of Java, but the core concept is the same. Here's the Regex documentation for Java: http://docs.oracle.com/javase/tutorial/essential/regex/

jvm
tags question: http://stackoverflow.com/q/24429777
tags question: http://stackoverflow.com/q/24556366
tags question: http://stackoverflow.com/q/24474008
tags question: http://stackoverflow.com/q/24547350
type: Tag
tags question: http://stackoverflow.com/q/24516024
tags question: http://stackoverflow.com/q/24547950
tags question: http://stackoverflow.com/q/24557989
tags question: http://stackoverflow.com/q/24504549
tags question: http://stackoverflow.com/q/24526583
tag name: jvm
tags question: http://stackoverflow.com/q/24491450
tags question: http://stackoverflow.com/q/24507114
tags question: http://stackoverflow.com/q/24490965
tags question: http://stackoverflow.com/q/24582695
tags question: http://stackoverflow.com/q/24461987
tags question: http://stackoverflow.com/q/24567284
tags question: http://stackoverflow.com/q/24521549
tags question: http://stackoverflow.com/q/24493816

http://stackoverflow.com/q/24541391
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38016253
has body: I followed the tutorial at blogs.teleric.com so I created a table. When I click Edit, change some fields after this click Update and have Exception on the server. In doPost() method I checked fields by System.err.println(request.getParameter("ID")); And so on for all 4 fields and in all of them I have null. But! I also cheked in browser POST request - Request URL:`http://localhost:8080/FinalTask/Doctor?update` - Request Method:POST - ... - Request Payload: {"id":1,"FIO":"IVAN IVANOV IVANOVICH","category":"surgeon","numPatients":1} Why do HttpServletRequest's parameters are empty? &lt;kendo:grid name="Doctor" pageable="true"&gt; &lt;kendo:grid-editable mode="inline" /&gt; &lt;kendo:dataSource pageSize="5"&gt; &lt;kendo:dataSource-transport&gt; &lt;kendo:dataSource-transport-read url="Doctor"&gt;&lt;/kendo:dataSource-transport-read&gt; &lt;kendo:dataSource-transport-update url="Doctor?update" type="POST" contentType="application/json"&gt;&lt;/kendo:dataSource-transport-update&gt; &lt;/kendo:dataSource-transport&gt; &lt;kendo:dataSource-schema&gt; &lt;kendo:dataSource-schema-model id="id"&gt; &lt;kendo:dataSource-schema-model-fields&gt; &lt;kendo:dataSource-schema-model-field name="id" type="number"&gt; &lt;kendo:dataSource-schema-model-field-validation required="true" min="1" /&gt; &lt;/kendo:dataSource-schema-model-field&gt; &lt;kendo:dataSource-schema-model-field name="FIO" type="string"&gt; &lt;kendo:dataSource-schema-model-field-validation required="true"/&gt; &lt;/kendo:dataSource-schema-model-field&gt; &lt;kendo:dataSource-schema-model-field name="category" type="string"&gt; &lt;kendo:dataSource-schema-model-field-validation required="true"/&gt; &lt;/kendo:dataSource-schema-model-field&gt; &lt;kendo:dataSource-schema-model-field name="numPatients" type="number" &gt; &lt;kendo:dataSource-schema-model-field-validation required="true" min="1" /&gt; &lt;/kendo:dataSource-schema-model-field&gt; &lt;/kendo:dataSource-schema-model-fields&gt; &lt;/kendo:dataSource-schem…
has title: jsp kendo ui update table, post request
type: Question
tagged with: kendo-grid
score: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/38031929
tagged with: request

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

http://stackoverflow.com/q/24435328
score: 2
has comment: http://stackoverflow.com/comment/48691930
upvote count: 2
has answer: http://stackoverflow.com/a/32680505
tagged with: calendar
type: Question
tagged with: java
has body: the link to the calendar app is https://github.com/square/android-times-square#usage I'm trying to just simply implement this calendar app into my project, and I've been having the hardest time. I put the code into my main activity xml like it told me &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.example.chexity.MainActivity" tools:ignore="MergeRootFrame" &gt; &lt;com.squareup.timessquare.CalendarPickerView android:id="@+id/calendar_view" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/FrameLayout&gt; and also put the code into my main activity's onCreate package com.example.chexity; import java.util.Calendar; import java.util.Date; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Calendar nextYear = Calendar.getInstance(); nextYear.add(Calendar.YEAR, 1); CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view); Date today = new Date(); calendar.init(today, nextYear.getTime()) .withSelectedDate(today); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatical…
has comment: http://stackoverflow.com/comment/37847074
answer count: 2
tagged with: implementation
downvote count: 0
has comment: http://stackoverflow.com/comment/37812405
favorite count: 0
type: UnansweredQuestion
has title: How to implement time square calendar app
tagged with: android
has answer: http://stackoverflow.com/a/24435386

http://stackoverflow.com/q/24580873
has answer: http://stackoverflow.com/a/24607620
accepted answer: http://stackoverflow.com/a/24607620
has comment: http://stackoverflow.com/comment/38079240
has comment: http://stackoverflow.com/comment/38078430
has body: I want to try and print out a box that looks like: +---+---+ | | + + | | +---+---+ but I am unsure on how to print out the right side. for (int j = 0; j &lt; x; j++) { System.out.print("+---"); } for (int i = 0; i &lt; y; i++) { for (int j = 0; j &lt; x; j++) { if (j == 0) { System.out.println("+ +"); System.out.println("| |"); } } } for (int j = 0; j &lt; x; j++) { System.out.print("+---"); } x represents the width of the box, and y represents the height. This will give me the right output if I have a preset width, but I want to edit the box so I can change the width.
possible better answer: http://stackoverflow.com/a/24581809
has comment: http://stackoverflow.com/comment/38079204
has title: Printing out a box
has comment: http://stackoverflow.com/comment/38079325
has comment: http://stackoverflow.com/comment/38080018
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38079083
tagged with: java
has comment: http://stackoverflow.com/comment/38078433
has answer: http://stackoverflow.com/a/24582114
type: Question
has comment: http://stackoverflow.com/comment/38079173
has comment: http://stackoverflow.com/comment/38080160
has comment: http://stackoverflow.com/comment/38079029
has comment: http://stackoverflow.com/comment/38078774
has answer: http://stackoverflow.com/a/24581809
score: 0
answer count: 3

http://stackoverflow.com/comment/97843702
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24468372
type: Comment
has text: @AshfaqueRifaye if one tx rollback, the previous tx don't rollback. It really depends on when/where you start your tx. A tx may contains an arbitrary number of database operation, and at the end (of the tx) will ALWAYS either "commit" or "rollback". If an exception was thrown during the tx all database operations that where done since the beginning of the tx won't be executed (i.e. the transaction rollback), on the other hand if everything was fine during the tx, it should ends with a "commit" of all database operations than were executed during the tx.

http://stackoverflow.com/comment/38036946
comment on: http://stackoverflow.com/q/24558632
score: 0
has text: By implementing `cloneable`, the `clone` method should be public. But since you don't redefine it, it isn't.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37796933
type: AnswerComment
comment on: http://stackoverflow.com/a/24428810
type: Comment
has text: @gexicide: Boxing requires that `unbox(box(value)) === value`. Boxing is literally defined as putting something inside a boxing type which represents the very same value. A *boxing* of Java arrays that you describe could not fulfill this requirement. What you describe is rather a mapping than a boxing.
score: 0

http://stackoverflow.com/comment/38086067
score: 0
type: AnswerComment
type: Comment
has text: (I mean I know what you wanna say, but you didn't really say it right)
comment on: http://stackoverflow.com/a/24585140

http://stackoverflow.com/q/24493236
accepted answer: http://stackoverflow.com/a/24493945
type: Question
linked to: http://stackoverflow.com/q/5853879
possible better answer: http://stackoverflow.com/a/24493394
has answer: http://stackoverflow.com/a/24493945
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/8008087
tagged with: user-interface
tagged with: paintcomponent
favorite count: 0
has comment: http://stackoverflow.com/comment/37916032
tagged with: jframe
has body: I've tried to paint component to PDF. I've got itextpdf 4.2 and everything works perfectly. But this works only if I make visible the frame that I've tried to render. The similar question that I've found is How to paint an invisible JFrame elsewhere? that has the same issue, but the solution wasn't provided in answer. A little of code. I've created a JFrame and insert main view that I want to render. JFrame jframe = new ShowingFrame(); jframe.setPreferredSize(new Dimension(PDFHelper.getOriginalWidth().intValue(), PDFHelper.getOriginalHeight().intValue())); jframe.setMinimumSize(new Dimension(PDFHelper.getOriginalWidth().intValue(), PDFHelper.getOriginalHeight().intValue())); jframe.add(view); jframe.setUndecorated(true); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setState(Frame.ICONIFIED); jframe.setState(Frame.NORMAL); //jframe.setVisible(true); If I uncomment jframe.setVisible(true) than everything works. But user will see this frame that I want to avoid. So the question is: How to paint hidden control? Inside Swing Component.java class all paint methods first check if the component is visible: public void paint(Graphics g) { if (isShowing()) { // rest of the code... } } I've tried to create inherit class ShowingFrame extends JFrame, that override isShowing and always return true. But this not helps to.
tagged with: swing
has title: Paint hidden Java swing component
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24496045
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24493394
has comment: http://stackoverflow.com/comment/37917058

http://stackoverflow.com/a/24515259
type: Answer
answers question: http://stackoverflow.com/q/24515150
has body: i think you must use different package name and app name.if you upload you app new version.you have to change your App version in Androidmanifest.xml
score: 0

http://stackoverflow.com/comment/37883033
score: 0
type: Comment
type: QuestionComment
has text: @OliCharlesworth instead of calling, I try to create pipeline sort of connections.
comment on: http://stackoverflow.com/q/24475737

http://stackoverflow.com/comment/37996426
type: AnswerComment
comment on: http://stackoverflow.com/a/24528155
score: 0
type: Comment
has text: Thanks to you and the two people in the comments. All your answers have been very helpful.

http://stackoverflow.com/q/24539516
tagged with: android-fragments
linked to: http://stackoverflow.com/q/18343018
has title: Android java Loading fragments lagless
answer count: 2
has answer: http://stackoverflow.com/a/24539827
downvote count: 0
tagged with: load
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24540201
has answer: http://stackoverflow.com/a/24540201
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24539827
upvote count: 2
tagged with: java
tagged with: multithreading
has body: Im using fragments to change the ui if a user is navigating through the menu. My problem is, that every time a fragment is replaced by another, the app freezes for a sec because it is processing on the main thread. I have read about using Threads to process things in the background but if a fragment is replaced by another you cant do it, because it has to be loaded in the main thread. So, is there a way to load fragments in the background to prevent lags if the user navigates through the menu? Hope you guys understand me, I tried my best. Geigerkind Edit: For anyone stumbelling about the same problem: Mo Adel's suggustion and this Link helped me solving the problem Optimizing drawer and activity launching speed
type: Question

http://stackoverflow.com/comment/37896914
comment on: http://stackoverflow.com/q/24482900
type: Comment
type: QuestionComment
has text: @goutam, what is project name?
score: 0

http://stackoverflow.com/comment/37813171
comment on: http://stackoverflow.com/a/24438046
type: AnswerComment
has text: @KickButtowski Yes, and you should've understood what we just explained already in the answer there. **The `i` in your lambda is each consecutive element in the underlying `List`.**
type: Comment
score: 3

http://stackoverflow.com/a/24577198
type: Answer
answers question: http://stackoverflow.com/q/24576997
has comment: http://stackoverflow.com/comment/38123582
downvote count: 0
has body: Your problem is a concept problem. JSF beans cannot autowire Spring beans, nor the other way around. This is because they are managed in different containers. You should integrate Spring with JSF to allow injection, which basically boils down to Spring controlling everything. There are plenty tutorials in the net about doing this. One good tutorial is mkyong's: JSF 2 + Spring 3 Integration Example. Basically, these are the steps (taken from his tutorial): In faces-config.xml file, add Expression Language (EL) resolver: &lt;application&gt; &lt;el-resolver&gt; org.springframework.web.jsf.el.SpringBeanFacesELResolver &lt;/el-resolver&gt; &lt;/application&gt; Instead using JSF annotations, use Spring annotations for JSF managed beans. Example applied to your classes: @Component("userView") @Scope("view") public class UserView extends BaseView implements Serializable { @Autowired private CommonService commonService; private List&lt;USERS&gt; list; @PostConstruct public void init() { list = (List) commonService.hepsiniGetir2(Sertifikalar.class, "name", "Deniz"); } } Note that in this example, I'm using @Scope("view") but Spring doesn't have a view scope by default, the team is still working on it. You have to implement this scope manually. Fortunately, you can use Cagatay's implementation to solve this. Apart of these problems, you have another conceptual problem: the only bean that supports eager=true is @ApplicationScoped since it will work as a @Singleton Spring bean, other managed beans will ignore this attribute at all.
score: 1
upvote count: 1

http://stackoverflow.com/comment/37902883
score: 0
comment on: http://stackoverflow.com/q/24485819
type: Comment
type: QuestionComment
has text: You've stated you need to use the support library for your project. You cannot use getFragmentManager(), you'll have to use getSupportFragmentManager() and your activity with the fragment in it has to extend FragmentActivity from the support library :)

http://stackoverflow.com/a/24487513
has body: If it is installed, ask windows where it is @echo off setlocal enableextensions disabledelayedexpansion rem Where to find java information in registry set "javaKey=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" rem Get current java version set "javaVersion=" for /f "tokens=3" %%v in ('reg query "%javaKey%" /v "CurrentVersion" 2^&gt;nul') do set "javaVersion=%%v" rem Test if a java version has been found if not defined javaVersion ( echo Java version not found goto endProcess ) rem Get java home for current java version set "javaDir=" for /f "tokens=2,*" %%d in ('reg query "%javaKey%\%javaVersion%" /v "JavaHome" 2^&gt;nul') do set "javaDir=%%e" if not defined javaDir ( echo Java directory not found ) else ( echo JAVA_HOME : %javaDir% ) :endProcess endlocal
has comment: http://stackoverflow.com/comment/37988332
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37981204
has comment: http://stackoverflow.com/comment/37905371
answers question: http://stackoverflow.com/q/24486834
type: Answer
has comment: http://stackoverflow.com/comment/37905230
has comment: http://stackoverflow.com/comment/57791668
accepted answer of: http://stackoverflow.com/q/24486834
score: 3

java-8
tags question: http://stackoverflow.com/q/24583737
tags question: http://stackoverflow.com/q/24574293
tags question: http://stackoverflow.com/q/24565278
tags question: http://stackoverflow.com/q/24491243
tags question: http://stackoverflow.com/q/24464432
tags question: http://stackoverflow.com/q/24437954
tags question: http://stackoverflow.com/q/24458961
tags question: http://stackoverflow.com/q/24455349
tags question: http://stackoverflow.com/q/24479960
tags question: http://stackoverflow.com/q/24577328
tags question: http://stackoverflow.com/q/24516994
tags question: http://stackoverflow.com/q/24586583
tags question: http://stackoverflow.com/q/24511052
tags question: http://stackoverflow.com/q/24547673
tags question: http://stackoverflow.com/q/24562975
tags question: http://stackoverflow.com/q/24466451
tags question: http://stackoverflow.com/q/24541786
tags question: http://stackoverflow.com/q/24575507
tags question: http://stackoverflow.com/q/24458799
tags question: http://stackoverflow.com/q/24493337
tags question: http://stackoverflow.com/q/24579276
tags question: http://stackoverflow.com/q/24463224
tags question: http://stackoverflow.com/q/24553761
tags question: http://stackoverflow.com/q/24436871
tags question: http://stackoverflow.com/q/24432639
tags question: http://stackoverflow.com/q/24563707
tag name: java-8
tags question: http://stackoverflow.com/q/24466277
tags question: http://stackoverflow.com/q/24580370
tags question: http://stackoverflow.com/q/24487805
tags question: http://stackoverflow.com/q/24472312
tags question: http://stackoverflow.com/q/24474838
tags question: http://stackoverflow.com/q/24438291
tags question: http://stackoverflow.com/q/24543014
tags question: http://stackoverflow.com/q/24495579
tags question: http://stackoverflow.com/q/24471102
type: Tag
tags question: http://stackoverflow.com/q/24495774
tags question: http://stackoverflow.com/q/24562824
tags question: http://stackoverflow.com/q/24491260
tags question: http://stackoverflow.com/q/24516990
tags question: http://stackoverflow.com/q/24468339

http://stackoverflow.com/comment/37949037
type: QuestionComment
comment on: http://stackoverflow.com/q/24511697
has text: What is your min SDK version, and what version of Android is your device running?
score: 1
type: Comment

http://stackoverflow.com/comment/38130833
score: 0
has text: why dont u store the names from the resultset in some list and later iterate the list and call the method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24585884

http://stackoverflow.com/q/24483332
has title: java - cannot split string on newline from JSON
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
has body: I'm writing a simple java program to read JSON file and extract certain information out of it. However, the String's split function does not split the string on new line OR \n character. Following is my JSON file - sample.json { "seleniumLog": [ { "commandName": "sendKeys", "args": [ "[[\"testUSER\",\"xpath\\u003d//UIAApplication[1]/UIAWindow[2]/UIATextField[1]\"]]" ], "result": "fail", "subLogs": [ { "commandName": "getCurrentWindowHandle", "args": [ "{}" ], "result": "Not implemented in this context, try switching into or out of a web view (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 6 milliseconds\nBuild info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'\nSystem info: host: 'testUSER-SIRs-MacBook-Pro.local', ip: '127.0.0.1', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.5', java.version: '1.6.0_65'\nSession ID: aced75a4-2bd9-4147-8346-1973371d2f97\nDriver info: com.infostretch.automation.ui.webdriver.QAFExtendedWebDriver\nCapabilities [{platform=MAC, app=/Users/testUSER/IAirwaysPG.app, javascriptEnabled=true, browserName=, desired={\"app\":\"/Users/testUSER/IAirwaysPG.app\",\"platformVersion\":\"7.1\",\"deviceName\":\"iPhone Simulator\",\"platformName\":\"iOS\",\"browserName\":\"\"}, locationContextEnabled=false, version=, platformVersion=7.1, databaseEnabled=false, cssSelectorsEnabled=true, platformName=ios, deviceName=iPhone Simulator, browser_name=, webStorageEnabled=false, warnings={}, takesScreenshot=true}]", "subLogs": [] } ] } ], "checkPoints": [ { "message": "Browser: ", "type": "Info", "screenshot": "", "subCheckPoints": [] }, { "message": "sendKeys [\"testUSER\",\"xpath\\u003d//UIAApplication[1]/UIAWindow[2]/UIATextField[1]\"] into {1}", "type": "TestStepFail", "subCheckPoints": [ { "message": "Not implemented in this context, try switching into or out of a web view (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 6 millisec…
type: Question
tagged with: split
downvote count: 2
has comment: http://stackoverflow.com/comment/37920452
has answer: http://stackoverflow.com/a/24483431
upvote count: 1
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37897628
favorite count: 0
type: UnansweredQuestion
tagged with: regex

http://stackoverflow.com/comment/37921962
score: 0
type: Comment
type: QuestionComment
has text: You need to decode the Base64 before you can parse it as XML. Your co-worker's program probably does that already, but you haven't built that functionality in. Re: "Does java have any certain variable for base64?", IIRC there's an Apache Commons package which handles Base64.
comment on: http://stackoverflow.com/q/24496405

http://stackoverflow.com/comment/38036622
has text: There is Apache Commons Codec but it has no UU codec...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24558511

http://stackoverflow.com/a/24431830
answers question: http://stackoverflow.com/q/24431609
upvote count: 1
has comment: http://stackoverflow.com/comment/37803128
has comment: http://stackoverflow.com/comment/37801448
has comment: http://stackoverflow.com/comment/37803178
has comment: http://stackoverflow.com/comment/37801180
downvote count: 0
has body: i is always lower than j bacause i anj doesn't change for (int n = i; i &lt; j; n++) so you have an endless loop.
has comment: http://stackoverflow.com/comment/37801261
type: Answer
score: 1

http://stackoverflow.com/comment/37941591
type: QuestionComment
comment on: http://stackoverflow.com/q/24506667
has text: Thanks!!! @Jaiwo99 I don't want to set to any specific language, I just want HttpServletResponse's default locale comes from client, not comes from linux's configuration. Do you have any idea?
score: 0
type: Comment

http://stackoverflow.com/q/24436607
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24436912
accepted answer: http://stackoverflow.com/a/24436912
linked to: http://stackoverflow.com/q/12826016
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3315681
score: 1
tagged with: java
tagged with: swing
has title: Java BoxLayout + JTextArea Wrapping
type: Question
has body: I've got this little notifications JPanel: The idea being you can scroll through the notifications, each notification has its own white box. The green border is the JPanel wrapped in a JScrollPane, the orange border boxes are JTextAreas wrapped in JScrollPanes. I'm trying to loop through the code below and create each box the right size, but the boxes are expanding like in the image even with a horizontal glue (I'm using boxLayout on the JPanel (green box)). The code: for (int i = 1; i &lt;= notifications.size(); i++) { ArrayList s = notifications.get(i); // Gets the text data Dashboard.notificationsArea.add(new JScrollPane(new JTextArea((s.get(1).toString() + "\n" + s.get(0).toString())))); // Creates the white boxes Dashboard.notificationsArea.add(Box.createVerticalStrut(5)); s.clear(); } Dashboard.notificationsArea.add(Box.createVerticalGlue()); // Adds glue to fill up space (not working?) for (int ii = 0; ii &lt; Dashboard.notificationsArea.getComponents().length; ii++) { if (Dashboard.notificationsArea.getComponent(ii) instanceof JScrollPane) { // Style white box ((JScrollPane)Dashboard.notificationsArea.getComponent(ii)).setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Settings.SITE_ORANGE)); ((JTextArea) ((JScrollPane)Dashboard.notificationsArea.getComponent(ii)).getViewport().getView()).setLineWrap(true); ((JTextArea) ((JScrollPane)Dashboard.notificationsArea.getComponent(ii)).getViewport().getView()).setEditable(false); ((JTextArea) ((JScrollPane)Dashboard.notificationsArea.getComponent(ii)).getViewport().getView()).setWrapStyleWord(true); } } Dashboard.notificationsArea.revalidate(); } How can I make the white boxes snap to the correct size?

http://stackoverflow.com/comment/38070942
has text: What would you do with this information?
score: 0
comment on: http://stackoverflow.com/q/24576945
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24427597
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/24431588
has title: Merging two databases in Android
tagged with: database
score: 0
answer count: 1
tagged with: restore
has body: In my app I have implemented options to backup and restore the database to a SDcard. When I restore the database, I must have the currently saved data included with the backed up data. How to make this possible? This is how I am restoring database. Restore: try { File sd = Environment.getExternalStorageDirectory(); File data = Environment.getDataDirectory(); if (sd.canWrite()) { String currentDBPath= "//data//" + "PackageName" + "//databases//" + "DatabaseName"; String backupDBPath = "/BackupFolder/DatabaseName"; File backupDB= new File(data, currentDBPath); File currentDB = new File(sd, backupDBPath); FileChannel src = new FileInputStream(currentDB).getChannel(); FileChannel dest = new FileOutputStream(backupDB).getChannel(); dst.transferFrom(src, 0, src.size()); src.close(); dst.close(); Toast.makeText(getBaseContext(), backupDB.toString(), Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG) .show(); }
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/q/24437179
tagged with: r.java-file
answer count: 2
has answer: http://stackoverflow.com/a/24437232
possible better answer: http://stackoverflow.com/a/24437232
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24437622
has title: Generate R.java and resource folders for java project
tagged with: java
type: Question
has body: Is there a way to create/generate R.java and resource folders in a non-Android project, such as in Java?
accepted answer: http://stackoverflow.com/a/24437622
score: 0
has comment: http://stackoverflow.com/comment/37811819

http://stackoverflow.com/comment/37887888
has text: Well, appears to be serious issue.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24478186

http://stackoverflow.com/q/24557128
has title: how to ask user to input again and again after every invalid input
tagged with: java
has body: so my own valid dates only are from 1520 to 3999 and im new to this site and im new to java please help i want to know what did i do wrong or what to do in this code. int x; Scanner in = new Scanner (System.in); do { System.out.print ("Enter a date "); x = in.nextInt(); } while (x&lt;1520&amp;&amp;x&gt;3999); { System.out.println ("Invalid Gregorian Calendar date."); System.out.print ("Please Input a valid Gregorian Calendar date: "); } }}
has answer: http://stackoverflow.com/a/24557192
type: Question
accepted answer: http://stackoverflow.com/a/24557181
downvote count: 0
possible better answer: http://stackoverflow.com/a/24557192
favorite count: 0
has answer: http://stackoverflow.com/a/24557252
answer count: 4
has answer: http://stackoverflow.com/a/24557193
score: 1
has answer: http://stackoverflow.com/a/24557181
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/24445751
has body: You can add security constraint like this in web.xml to disable https for few pages <web-resource-collection> pageswithouthttps No Description /nohttps/*.jsp </web-resource-collection> No Description NONE <web-resource-collection> httpspages No Description *.jsp </web-resource-collection> No Description CONFIDENTIAL
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24444633
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24444633
type: Answer
has comment: http://stackoverflow.com/comment/37835370
score: 1
downvote count: 0

http://stackoverflow.com/comment/38088974
type: QuestionComment
comment on: http://stackoverflow.com/q/24586308
has text: I guess I found out that the problem is not in the actual defining the floats, as many people suggested, but in the getHeight() method. I edited the question once again to give the source code of this method, and it uses another loop because the hashmap.get() is not working for a custom class I made. Maybe I should change that class to make the get() method work?
score: 0
type: Comment

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

http://stackoverflow.com/a/24430072
has body: KEEP TRACK OF CALLER AND PASSED ARGUMENT Well probably not the best solution but you can use ArrayList ( Or probably something else to follow up this idea ) to keep track of caller and argument. For Example you can change your addArgument method to addArgument(caller,argument); and after that inside argument you can add both this object to your class level variable ArrayList&lt;Object[]&gt;. But it will be your duty to check whether there should not be duplication in ArrayList. You can also create separate class to do the same.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24429619
score: 1
upvote count: 1

http://stackoverflow.com/a/24482015
has comment: http://stackoverflow.com/comment/37895084
type: Answer
has comment: http://stackoverflow.com/comment/38119780
score: 2
answers question: http://stackoverflow.com/q/24481887
upvote count: 2
has comment: http://stackoverflow.com/comment/37938690
has body: I've had some trouble in the past getting sound to work in Java. Here is a good way to load .wav soundclips. private Clip clip; public Sound(String fileName) { try { File file = new File(fileName); if (file.exists()) { AudioInputStream sound = AudioSystem.getAudioInputStream(file); clip = AudioSystem.getClip(); clip.open(sound); } else { throw new RuntimeException("Sound: file not found: " + fileName); } } catch (UnsupportedAudioFileException e) { e.printStackTrace(); throw new RuntimeException("Sound: Unsupported Audio File: " + e); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Sound: Input/Output Error: " + e); } } public void play() { clip.setFramePosition(0); clip.start(); } public void loop() { clip.loop(Clip.LOOP_CONTINUOUSLY); } public void stop() { clip.stop(); } I find that this works great! You can add more exceptions if you'd like as well, like LineUnavailableException, and MalformedURLException. To create a sound clip you make something as such: private Sound sound = new Sound("/sounds/sound.wav"); then doing sound.play();
has comment: http://stackoverflow.com/comment/38080646
has comment: http://stackoverflow.com/comment/38070871
has comment: http://stackoverflow.com/comment/38052069
downvote count: 0
has comment: http://stackoverflow.com/comment/38113015
has comment: http://stackoverflow.com/comment/37952211

http://stackoverflow.com/q/24507626
tagged with: jodatime
score: 0
accepted answer: http://stackoverflow.com/a/24508570
has comment: http://stackoverflow.com/comment/37942169
answer count: 1
has answer: http://stackoverflow.com/a/24508570
has title: How do I make an Image appear for a specified amount of time when a button is Clicked? In eclipse
tagged with: android
has body: Just wondering how I can make a button click make an image view appear for like half a sec then disappear, until the button is clicked again. I'm using joda-time Here's what I have. I'm new to java if you couldn't already tell. public void onClick(View v) { // TODO Auto-generated method stub dur = 1; if (barrelblast != 0) sp.play(barrelblast, 1, 1, 0, 0, 1); Vibrator vibe = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibe.vibrate (90); if (dur != 0) smoke.setVisibility(View.VISIBLE); Duration.standardSeconds(1);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37941934
tagged with: imageview
tagged with: java
has comment: http://stackoverflow.com/comment/37942942
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37942972
type: Question

http://stackoverflow.com/comment/37863840
type: AnswerComment
comment on: http://stackoverflow.com/a/24465614
has text: i've tried changing those and it still can't work.. :\ could it be problem with my database?
score: 0
type: Comment

http://stackoverflow.com/a/24487675
type: Answer
has body: At the moment the date string isn't quoted, so it's in valid anyway, but the colons will be interpreted by the parser as bind variable markers; specifically it'll be looking for bind variables :54 and :00. The quick answer is to put the date string into quotes. But that date format is unlikely to match what your database (session) is expecting, so you'd need to format the date into a string it can use and provide the format as well to avoid ambiguity. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); query.append(", dt_ =&gt; to_date('" + sdf.format(date) + "', 'YYYY-MM-DD HH24:MI:SS')"); You also don't need the call, so get rid of that. That would produce a string like this (with added line breaks and indentation to make it a little easier to see): declare arr_pn owa_util.vc_arr; begin arr_pn(1):='12345'; arr_pn(2):='678970'; arr_pn(3):='5675675'; LOC_MAINCLIENT.set_client_relations(id_account_ =&gt; 123, phone_number_list_ =&gt; arr_pn, dt_ =&gt; to_date('2013-03-24 21:54:00', 'YYYY-MM-DD HH24:MI:SS')); end; Assuming your package procedure is declared as: procedure set_client_relations(id_account_ number, phone_number_list_ owa_util.vc_arr, dt_ date); ... this this should run. Whether it does what you actually want is a different matter, of course. You may also need to do something with the time zone if the database doesn't match your locale. The proper way to do it is to use a prepared statement, provide all the values as bind variables, and pass the correct data types - passing the date as a date rather than as a string representation. That's a little more complicated for an array but certainly do-able. You've said this is legacy code and you have to use this, but you should still investigate switching to bind variables.
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24484709
answers question: http://stackoverflow.com/q/24484709
upvote count: 1

http://stackoverflow.com/comment/37807992
has text: On pressing CTRL-Z the file 'clients.txt' is cleared, ie all the records are erased, after it pressing the enter it outputs "Invalid input."
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24434960

http://stackoverflow.com/q/24524984
possible better answer: http://stackoverflow.com/a/24525103
has comment: http://stackoverflow.com/comment/37973924
has body: I am new to Java. I have written a code to count the occurrence of a particular word from a file. The word to be counted is asked from the user. I wrote two codes. The first code runs properly and the count is correct. Whereas in the second code, the count is less. I am unable to figure out the reason for this. Can someone help me find the flaw in the second code? Paragraph that is read from the file and the two codes are provided below. Paragraph : In word processing and desktop publishing, a hard return or paragraph break indicates a new paragraph, to be distinguished from the soft return at the end of a line internal to a paragraph. This distinction allows word wrap to automatically re-flow text as it is edited, without losing paragraph breaks. The software may apply vertical whitespace or indenting at paragraph breaks, depending on the selected style. How such documented are actually stored depends on the file format. For example, HTML uses the tag as a paragraph container. In plaintext files, there are two common formats. Pre-formatted text will have a newline at the end of every physical line, and two newlines at the end of a paragraph, creating a blank line. An alternative is to only put newlines at the end of each paragraph, and leave word wrapping up to the application that displays or processes the text (if it is even necessary). Code 1 : Gives correct output package prac3; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Scanner; public class FromFile { private String word; FromFile() { } int Count(String word1) throws IOException { this.word = word1; String abc; int count = 0, total = 0; try { BufferedReader in = new BufferedReader( new FileReader( "C:\\Documents and Settings\\Administrator.EGOVPC79\\Desktop\\file.txt")); while ((abc = in.readLine()) != null) { String abc1 = abc; Scanner s = new Scanner(abc1); while (s.hasNext()) { total++; if (s.next().equals(wor…
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37973769
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24525183
tagged with: java
has title: Word Count in Java giving wrong output
downvote count: 5
score: -4
has answer: http://stackoverflow.com/a/24525103
accepted answer: http://stackoverflow.com/a/24525183
type: AnsweredQuestion

http://stackoverflow.com/comment/38024226
type: AnswerComment
has text: What exactly are you trying to achieve then? Should the program wait or not?
type: Comment
comment on: http://stackoverflow.com/a/24540007
score: 0

http://stackoverflow.com/a/24492106
answers question: http://stackoverflow.com/q/24491976
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37913922
type: Answer
downvote count: 0
has body: You have to reverse the order of the for loops and replace the \n with \t to separate two tables for (int j = 1; j &lt;= 10; j++) { for (int i = 2; i &lt;= number; i++) { System.out.printf("%d X %d = %d\t", i, j, (i * j)); } System.out.println(); } Sample output when number = 5 2 X 1 = 2 3 X 1 = 3 4 X 1 = 4 5 X 1 = 5 2 X 2 = 4 3 X 2 = 6 4 X 2 = 8 5 X 2 = 10 2 X 3 = 6 3 X 3 = 9 4 X 3 = 12 5 X 3 = 15 2 X 4 = 8 3 X 4 = 12 4 X 4 = 16 5 X 4 = 20 2 X 5 = 10 3 X 5 = 15 4 X 5 = 20 5 X 5 = 25 2 X 6 = 12 3 X 6 = 18 4 X 6 = 24 5 X 6 = 30 2 X 7 = 14 3 X 7 = 21 4 X 7 = 28 5 X 7 = 35 2 X 8 = 16 3 X 8 = 24 4 X 8 = 32 5 X 8 = 40 2 X 9 = 18 3 X 9 = 27 4 X 9 = 36 5 X 9 = 45 2 X 10 = 20 3 X 10 = 30 4 X 10 = 40 5 X 10 = 50

http://stackoverflow.com/comment/37950969
comment on: http://stackoverflow.com/q/24510742
score: 0
has text: I want to run all tests in a package and its sub-package on Continuous Integration servers, and I don't know what packages and tests adopters will choose to set up. But I can't run all of them, because tests in a certain package are not supposed to be kicked off on that box. Anything that requires someone manually creating a list of tests is thus not ideal (unless such a list can consist entirely of exclusions).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24568456
tagged with: java
tagged with: comparator
answer count: 2
has body: I'm having trouble applying sorting mechanism through my application. Reason was sometimes sort are not accurate and also the comparator thing in java still not clear for me, but i have used sort here and there. Now, current problem is as follows. I have HashMap&lt;String, ModelX.ContactModel&gt; unsortedModelContacts = new HashMap&lt;String,ModelX.ContactModel&gt;(contacts.size()); After that I fached contactlist and using for loop I have put the values as follows: unsortedModelContacts.put(stringvalue, modelContact); //object having name , and other details How can I sort the unsortedModelContacts sorting modelContact.getName property?
upvote count: 0
has answer: http://stackoverflow.com/a/24568990
tagged with: sorting
favorite count: 0
has title: How to Sort HashMap <String ,Object> using Object Value
has comment: http://stackoverflow.com/comment/38056229
has comment: http://stackoverflow.com/comment/38055583
has comment: http://stackoverflow.com/comment/38055505
has comment: http://stackoverflow.com/comment/38055507
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24569373
has comment: http://stackoverflow.com/comment/38056249
type: Question
tagged with: spring-mvc
score: -2

http://stackoverflow.com/comment/37928748
type: Comment
has text: An equivalents parameters should probably exists for Majorra, and only 2 parameters are specifique to MyFaces not All
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24466551

http://stackoverflow.com/q/24473604
has comment: http://stackoverflow.com/comment/37878886
favorite count: 0
has comment: http://stackoverflow.com/comment/37878938
tagged with: memory-management
answer count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/41143607
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/37879360
score: 1
tagged with: java
type: Question
tagged with: forceclose
downvote count: 0
has title: Force close after clear memory and resume app
has body: When I test my app, after close app and clean memory(in my case, CleanMaster app) and then reopen it again, it force close. I try search for cause but can't find solvable solution. It work all fine if not clean memory. I wonder if anything need to be saved and restore after these incident. I'm quite newby for Android. here is log 06-29 11:59:19.479 22283-22283/com.thaifasttel D/WebView﹕ onTrimMemory: 20 06-29 11:59:33.985 22524-22524/com.thaifasttel D/jdwp﹕ sendBufferedRequest : len=0x39 06-29 11:59:33.993 22524-22524/com.thaifasttel W/asset﹕ AssetManager--&gt;addDefaultAssets CIP path not exsit! 06-29 11:59:34.050 22524-22524/com.thaifasttel D/dalvikvm﹕ newInstance failed: no &lt;init&gt;() 06-29 11:59:34.052 22524-22524/com.thaifasttel D/AndroidRuntime﹕ Shutting down VM 06-29 11:59:34.052 22524-22524/com.thaifasttel W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40d6f9a8) 06-29 11:59:34.060 22524-22524/com.thaifasttel E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.thaifasttel/com.thaifasttel.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.thaifasttel.MainActivity$PlaceholderFragment: make sure class name exists, is public, and has an empty constructor that is public at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) at android.app.ActivityThread.access$600(ActivityThread.java:162) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5371) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.interna…

http://stackoverflow.com/q/24538459
has body: I'm trying to print an array of objects in my app, but it is returning empty. This is the log that I'm getting: 07-02 15:02:44.179 16933-17469/com.representemais I/RM﹕ [] I'm using volley to get the data from an API, and I need to print that data using an object array. I need to see in the log the objects that's inside the array, what I don't know is how can I print the objects. Why it is returning null? This is the Sync Class: public class Sincronizar { private Context context; public Sincronizar(Context ctx) { this.context = ctx; } public void start() { try { ClientesRest mClientesRest = new ClientesRest(this.context); Log.i("RM", "P1"); mClientesRest.getClientes(new ClientesRest.ClientesRestListener() { public void clientesReceived(List&lt;ClienteModel&gt; clientes) { // Here modify to do whatever you need to do with clientes Log.i("RM", "P:2"); Log.i("RM", String.valueOf(clientes)); Log.i("RM", "P:3"); } }); } catch (Exception e) { Log.i("RM", String.valueOf(e.getStackTrace())); } } public Integer total() { return 100; } } This is the ClientRest: public class ClientesRest extends Servidor { private String recursoRest = "clientes"; List&lt;ClienteModel&gt; arrayClientes = new ArrayList&lt;ClienteModel&gt;(); private RequestQueue mRequestQueue ; private Context context; public ClientesRest(Context ctx) { this.context = ctx; } public interface ClientesRestListener { public void clientesReceived(List&lt;ClienteModel&gt; clientes); } public final void getClientes(final ClientesRestListener listener) { String url = this.URL_WS + recursoRest; mRequestQueue = Volley.newRequestQueue(this.context); JsonObjectRequest mJsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { List&lt;ClienteModel&gt; clientes = null; try { clientes = parseJSON(response); } catch (JSONException e) { Log.i("RM", String.valueOf(e.getStackTrace())); } listener.clientesReceived(clie…
has title: How to print an arraylist in Android
has comment: http://stackoverflow.com/comment/37999537
upvote count: 1
linked to: http://stackoverflow.com/q/24559923
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38000166
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37999717
has comment: http://stackoverflow.com/comment/37999417
type: Question
has answer: http://stackoverflow.com/a/24539558
has comment: http://stackoverflow.com/comment/37999210
answer count: 1
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/24539558
favorite count: 0
has comment: http://stackoverflow.com/comment/37999460
has comment: http://stackoverflow.com/comment/38000534
tagged with: android-volley
has comment: http://stackoverflow.com/comment/37999369
tagged with: android

http://stackoverflow.com/a/24484488
upvote count: 3
answers question: http://stackoverflow.com/q/24484361
score: 3
has body: The files are sorted in the natural order of your operating system. It may be the creation order. If you want the list to be sorted, you can call File[] files = Arrays.sort(dir.listFiles()) For another sort order, feel free to use your own Comparator. Regards.
downvote count: 0
type: Answer

http://stackoverflow.com/q/24447695
tagged with: cxf
tagged with: java
tagged with: jax-ws
tagged with: jaxb
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2362302
score: 4
has answer: http://stackoverflow.com/a/24507383
has body: I am using a cxf webservice which uses local transport and accessing the webservice from java application. Webservice is reading a file and sending through webservice call. I am using the byte size as 512. Suppose the file size is 1200. First two attempt of retrieving the file is success and for the last chunk i am getting org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content. Here chunk represents 512 bytes. I am converting bytes to string and returning from web service.In the last chunk only 16 byte value is filled and remaining are filled with zeros. Any help will be appreciated. I am using cxf webservice 2.7.5, jdk1.7 ,Redhat Linux. Stack trace: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content at [row,col {unknown-source}]: [2,1] at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:808) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:629) at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157) at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:103) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:800) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1592) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1490) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1309) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.c…
favorite count: 0
has answer: http://stackoverflow.com/a/28308829
type: UnansweredQuestion
tagged with: web-services
upvote count: 4
has title: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character (NULL, unicode 0) encountered: not valid in any content
linked to: http://stackoverflow.com/q/14193944
downvote count: 0

http://stackoverflow.com/comment/38034437
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24552937
has text: I found the reason for not renewing the classes. The codebase which I was working had classes folder in WEB_INF, already compiled. This prevents netbeans to override the WEB-INF with newly compiled classes. This is a silly mistake, please excuse me, anyway thanks for your attention. Keep in mind that classes are always in WEB-INF while JSPs may be in work/Catalina/. and keep your WEB-INF clean :)
score: 0

http://stackoverflow.com/q/24523994
has comment: http://stackoverflow.com/comment/37972272
downvote count: 5
has answer: http://stackoverflow.com/a/24524036
tagged with: eclipse
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37971994
tagged with: android
accepted answer: http://stackoverflow.com/a/24524036
has body: I need to add a value in EditText.But I doesn't need to show the output with the help of TextView.
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37972248
type: AnsweredQuestion
score: -5
has title: Showing the string in XML edit text
tagged with: java
has comment: http://stackoverflow.com/comment/37972259
type: Question

http://stackoverflow.com/comment/38026137
comment on: http://stackoverflow.com/q/24552723
type: QuestionComment
has text: @Cyber it's tagged Java too and C - just edit the tags ;-)
score: 0
type: Comment

http://stackoverflow.com/comment/38204346
type: AnswerComment
has text: 2x-3x the size of what? Another PNG? Or a JPEG?
type: Comment
comment on: http://stackoverflow.com/a/24570100
score: 1

http://stackoverflow.com/comment/37897504
type: QuestionComment
comment on: http://stackoverflow.com/q/24482792
has text: Do you understand how that site expects the session token to be returned? When you login to a site the login page usually sets an encrypted cookie that you must send on every subsequent request. You read the response data but didn't do anything with it.
score: 0
type: Comment

http://stackoverflow.com/q/24510626
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38146118
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37954639
tagged with: java
type: Question
has body: http://asprise.com/product/jia/html_javascript_scan_from_scanners.php Need to use this and scan the document. Downloaded the program and run this code, it always says the error classNotfoundException: com.asprise.jia.ui.JiaApplet I Placed the .java file in this structure root folder -Applet.html -com --asprise ---jia ----ui -----JiaApplet.java Please help me on this
tagged with: scanning
has comment: http://stackoverflow.com/comment/38071270
has title: Java HTML Web Scan
score: 0

nullpointerexception
tags question: http://stackoverflow.com/q/24533053
tags question: http://stackoverflow.com/q/24480328
tags question: http://stackoverflow.com/q/24481982
tags question: http://stackoverflow.com/q/24524619
tags question: http://stackoverflow.com/q/24439007
tags question: http://stackoverflow.com/q/24573480
tags question: http://stackoverflow.com/q/24496686
tags question: http://stackoverflow.com/q/24428367
tags question: http://stackoverflow.com/q/24538957
tags question: http://stackoverflow.com/q/24455922
tags question: http://stackoverflow.com/q/24545363
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/24493118
tags question: http://stackoverflow.com/q/24568927
tags question: http://stackoverflow.com/q/24531565
tags question: http://stackoverflow.com/q/24520620
tags question: http://stackoverflow.com/q/24463524
tags question: http://stackoverflow.com/q/24534215
tags question: http://stackoverflow.com/q/24489176
tags question: http://stackoverflow.com/q/24585414
tags question: http://stackoverflow.com/q/24579087
tags question: http://stackoverflow.com/q/24554489
tags question: http://stackoverflow.com/q/24566343
tags question: http://stackoverflow.com/q/24579231
tags question: http://stackoverflow.com/q/24573564
tags question: http://stackoverflow.com/q/24562866
tags question: http://stackoverflow.com/q/24498569
tags question: http://stackoverflow.com/q/24585545
tags question: http://stackoverflow.com/q/24577599
tags question: http://stackoverflow.com/q/24427560
tags question: http://stackoverflow.com/q/24504385
tags question: http://stackoverflow.com/q/24546803
tags question: http://stackoverflow.com/q/24575763
tags question: http://stackoverflow.com/q/24466381
tags question: http://stackoverflow.com/q/24486832

http://stackoverflow.com/comment/37814097
type: Comment
has text: I updated the question with my specific use case. That is definitely a possibility, I guess I just hoped it would be easier and Java would pick up on functions that are registered through JNI. Right now I'm dealing with this by creating a stub file which contains hookLib1() until hookLib1000() to support updates for the year to come, which is less than ideal.
type: AnswerComment
comment on: http://stackoverflow.com/a/24437377
score: 0

http://stackoverflow.com/q/24484022
has body: I use Kryo to write Objects into byte arrays. It works fine. But when the byte arrays are converted into the Objects, it throws, com.esotericsoftware.kryo.KryoException: Buffer underflow. exception. This is my deserialization: Kryo k=new Kryo(); Input input=new Input(byteArrayOfObject); Object o=k.readObject(input,ObjectClass.class); Furthermore, always the object type cannot be defined in my application. At the final process, the class conversion happens. Therefore, How can I solve above deserialization error Is there a way to create Object without giving the class into readObject(...,ClassName) ?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28788328
tagged with: java
has answer: http://stackoverflow.com/a/79267480
upvote count: 18
has answer: http://stackoverflow.com/a/36992517
tagged with: kryo
type: Question
has comment: http://stackoverflow.com/comment/64484299
downvote count: 0
score: 18
tagged with: serialization
has answer: http://stackoverflow.com/a/48103574
has title: Kryo Deserialization fails with "KryoException: Buffer underflow"
tagged with: io
answer count: 4

http://stackoverflow.com/q/24575780
has comment: http://stackoverflow.com/comment/38069143
has comment: http://stackoverflow.com/comment/38068899
accepted answer: http://stackoverflow.com/a/24628800
has comment: http://stackoverflow.com/comment/38069907
score: 0
has comment: http://stackoverflow.com/comment/38069097
answer count: 1
has answer: http://stackoverflow.com/a/24628800
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38069621
has comment: http://stackoverflow.com/comment/38069464
has body: I want to create to SQL database tables named Customer and Orders SQL : CREATE TABLE Customer ( customer_id INT NOT NULL AUTO_INCREMENT, customer_name VARCHAR(255) UNIQUE, PRIMARY KEY (customer_id) ); CREATE TABLE Orders ( order_id INT NOT NULL AUTO_INCREMENT, customer_name VARCHAR(255), order_date DATETIME, PRIMARY KEY(order_id), FOREIGN KEY (customer_name) REFERENCES Customer(customer_name) ON UPDATE CASCADE ON DELETE CASCADE ); Afterwards I want to insert an Orders object with a reference to the Customer object. Java &amp; Hibernate: Transaction tx = session.beginTransaction(); Customer cu = (Customer) session.load(Customer.class, 1); Date d = new Date(); Orders od = new Orders(cu, d); od.setCustomer(cu); Set&lt;Orders&gt; hs = new HashSet&lt;Orders&gt;(); hs.add(od); cu.setOrderses(hs); session.save(cu); session.save(od); tx.commit(); The insert returns an exception : Cannot add or update a child row: a foreign key constraint fails I am doing everything exactly as in the Hibernate Tutorials. What am I doing wrong ? Java classes public class Customer implements java.io.Serializable { private Integer customerId; private String customerName; private Set&lt;Orders&gt; orderses = new HashSet&lt;Orders&gt;(0); public Customer() { } public Customer(String customerName, Set&lt;Orders&gt; orderses) { this.customerName = customerName; this.orderses = orderses; } public Integer getCustomerId() { return this.customerId; } public void setCustomerId(Integer customerId) { this.customerId = customerId; } public String getCustomerName() { return this.customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public Set&lt;Orders&gt; getOrderses() { return this.orderses; } public void setOrderses(Set&lt;Orders&gt; orderses) { this.orderses = orderses; } } public class Orders implements java.io.Serializable { private Integer orderId; private Customer customer; private Date orderDate; public Orders() { } public Orders(Customer customer, D…
has comment: http://stackoverflow.com/comment/38069773
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has title: Hibernate Foreign Key Constraint fails
has comment: http://stackoverflow.com/comment/38069025

http://stackoverflow.com/q/24472020
answer count: 6
has answer: http://stackoverflow.com/a/24472123
favorite count: 0
tagged with: android
score: 132
tagged with: macos
tagged with: android-studio
downvote count: 0
has answer: http://stackoverflow.com/a/24680375
has answer: http://stackoverflow.com/a/24475898
accepted answer: http://stackoverflow.com/a/24475898
has answer: http://stackoverflow.com/a/36391038
has comment: http://stackoverflow.com/comment/37875999
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27513917
has body: I was trying to look how my app looks in material design and I would like to use the new cards lib. My Problem is, that it's giving me this error within my gradle file and I need to fix that. Error:compileSdkVersion android-L requires compiling with JDK 7 I downloaded jdk-7u60-macosx-x64.dmgand installed it. java -versionin Terminal is showing me that 1.7 is installed: java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode) well ls -l `which java` is giving me: /usr/bin/java -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java .../current/... doesn't have a .../home. I found the .../home here: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home And set the path to the "SDK location" Preferences in Android Studio under "JDK location". But it's not working -- it seems that it still can't find JDK 7. I'm using Mac OSX 10.9.3 and Android Studio (Beta) 0.8.1.
tagged with: java
upvote count: 132
type: Question
possible better answer: http://stackoverflow.com/a/24680375
has answer: http://stackoverflow.com/a/29986974
has title: Android Studio needs JDK 7 for Android-L mac

http://stackoverflow.com/q/24472935
score: -1
has comment: http://stackoverflow.com/comment/37890777
favorite count: 0
has comment: http://stackoverflow.com/comment/37877675
type: Question
has comment: http://stackoverflow.com/comment/37877706
tagged with: swing
accepted answer: http://stackoverflow.com/a/24472956
answer count: 1
has comment: http://stackoverflow.com/comment/37877600
has comment: http://stackoverflow.com/comment/37877561
has title: How does java limit text fields?
has comment: http://stackoverflow.com/comment/37877742
duplicate of: http://stackoverflow.com/q/10136794
has comment: http://stackoverflow.com/comment/37877662
tagged with: java
tagged with: jtextfield
tagged with: eclipse
downvote count: 1
has body: EDIT: I didn't ask for the syntax on how to set the number of characters. I can find that easily in a simple search. Please read and understand before downvoting someone. I was asking how to find where this is in the source code based ont he code below. I found it on my own using the "Reference" feature, which directed me to the other classes which called the JTextFieldLimit class. END EDIT. I'm trying to edit the source code for an app someone built for me. The login field is limited to 15 characters but I need to increase this. After some googling, the closest I've come so far is the code inside the JTextFieldLimit class, which is as follows: package app; import javax.swing.text.*; //import javax.swing.text.*; public class JTextFieldLimit extends PlainDocument { private int limit; // optional uppercase conversion private boolean toUppercase = false; JTextFieldLimit(int limit) { super(); this.limit = limit; } JTextFieldLimit(int limit, boolean upper) { super(); this.limit = limit; toUppercase = upper; } public void insertString (int offset, String str, AttributeSet attr) throws BadLocationException { if (str == null) return; if ((getLength() + str.length()) &lt;= limit) { if (toUppercase) str = str.toUpperCase(); super.insertString(offset, str, attr); } } } Where do I go from here?
has comment: http://stackoverflow.com/comment/37877598
upvote count: 0
has comment: http://stackoverflow.com/comment/37878271
has answer: http://stackoverflow.com/a/24472956
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10136794
tagged with: macos

http://stackoverflow.com/q/24459375
has comment: http://stackoverflow.com/comment/37854475
downvote count: 0
tagged with: string
tagged with: tdd
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/37852225
answer count: 1
tagged with: regex
has answer: http://stackoverflow.com/a/24459455
favorite count: 0
has body: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \ ): private final String doGetHtmlStringPartThree = " \d / \d "; Double escaped to be accepted: private final String doGetHtmlStringPartThree = " \\d / \\d "; Test private final String doGetHtmlStringPartOne = " " + " "; private final String doGetHtmlStringPartTwo = " " + " " + " " + " <input type=\"hidden\" name=\"fractionBoolean\"" + " value=\""; private final String doGetHtmlStringPartThree = " [0-9] / \\d "; private final String doGetHtmlStringPartFour = " " + " " + " " + " " + " "; @Test public void testBooleanFractionTrue() throws IOException, ServletException { mockDoGet(); assertEquals(expectedDoGetHtmlString("1 / 1 + 1 / 1", true), stringWriter.getBuffer().toString().trim()); } public String expectedDoGetHtmlString(String assignment, Boolean fractionBoolean) { return doGetHtmlStringPartOne + assignment + doGetHtmlStringPartTwo + "" + fractionBoolean + "" + "\" />" + "\n" + doGetHtmlStringPartThree + "\n" + doGetHtmlStringPartFour; } Regex does not work: Question How to test a String in a servlet using regex?
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: Test string in Servlet using regex
accepted answer: http://stackoverflow.com/a/24459455
tagged with: servlets
type: Question

http://stackoverflow.com/comment/38065693
has text: The FOV in my example was set by hand/code and not calculated. And your FOV seems to be ... wait shoudn't that be `Math.sin(objectRadius / dist2Object)`?
comment on: http://stackoverflow.com/a/24573741
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24536131
has answer: http://stackoverflow.com/a/24536296
has answer: http://stackoverflow.com/a/24536132
has comment: http://stackoverflow.com/comment/37994707
has comment: http://stackoverflow.com/comment/38006011
downvote count: 0
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37994704
tagged with: synchronization
has comment: http://stackoverflow.com/comment/37994705
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading
has title: Does synchronization in java protect modified class fields?
has comment: http://stackoverflow.com/comment/37994706
has comment: http://stackoverflow.com/comment/37999213
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24536381
has body: I saw this on Java's synchronization tutorial: public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public synchronized void decrement() { c--; } public synchronized int value() { return c; } } The tutorial says that subsequent calls by different threads block, like so: A: increment(); B: increment(); &lt;-- has to wait for A to finish ...but say two threads interleave like so: A: increment(): load c -> 0; B: decrement(): load c -> 0; A: increment(): increment c -> 1; B: decrement(): decrement c -> -1; A: increment(): save c -> 1; B: decrement(): save c -> -1; Finally: c == -1; Neither has to wait, in my understanding of the tutorial; so is c protected from memory inconsistency? Due to popular demand: the tutorial
has comment: http://stackoverflow.com/comment/38002990
type: Question

http://stackoverflow.com/a/64079612
answers question: http://stackoverflow.com/q/24584198
score: 0
has body: This question is old, but an answer seems appropriate today (since this is new-ish) The Java Platform Module System (Java 9+) supports this idea directly with the jlink tool. It's actually one of the specific, stated, goals of the system. And, to make it even better, a properly modularized software product will include only the necessary parts of the JRE and libraries, thereby remaining relatively small.
type: Answer

http://stackoverflow.com/comment/85914222
has text: That is correct. This holds for all classes that were defined by an anonymous class loader.
comment on: http://stackoverflow.com/a/26217053
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24516038
accepted answer of: http://stackoverflow.com/q/24441568
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: Okay, I found the answer. I was probably trying to write to a folder that doesn't exist in Bluestacks. This is what does work: String base = Environment.getExternalStorageDirectory().getAbsolutePath() + "/bstfolder/BstSharedFolder/"; And that folder can then be accessed in Windows from C:\ProgramData\BlueStacks\UserData\SharedFolder
type: Answer
answers question: http://stackoverflow.com/q/24441568
score: 2

http://stackoverflow.com/comment/55111276
has text: @LuyandaSiko I regret that I'm finding your question ambiguous so I'm not entirely sure of the problem you're trying to solve. Regardless, my sense is that it's sufficiently distinct that it ought to be a separate question rather than a follow up.
comment on: http://stackoverflow.com/a/24574989
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38056098
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24568755
type: Comment
has text: @Henry The string is there because I had to pass the data to an intent, and converted it to a string. I converted it back to a byte array, and it works for all the others except the JPEG

http://stackoverflow.com/comment/53712496
type: Comment
has text: When i am using this code RichTextItem body = (RichTextItem)doc.getFirstItem("Body"); i am getting body as null . dont know why?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24489114

http://stackoverflow.com/q/24463523
has comment: http://stackoverflow.com/comment/37859844
upvote count: 0
score: -5
tagged with: java
has title: Cannot run "HelloWorld" on macintosh
has comment: http://stackoverflow.com/comment/37859856
has comment: http://stackoverflow.com/comment/37859847
type: Question
has answer: http://stackoverflow.com/a/24463557
has comment: http://stackoverflow.com/comment/37877344
has comment: http://stackoverflow.com/comment/37860403
has comment: http://stackoverflow.com/comment/37860389
has comment: http://stackoverflow.com/comment/37859854
answer count: 1
has comment: http://stackoverflow.com/comment/37859835
favorite count: 0
downvote count: 5
type: UnansweredQuestion
has body: On Macintosh OS 10.7.5, I'm able to successfully compile the following code: class HelloWorld { public static void man(String [] args) { system.out.println("Hello, world"); } } However, when i use the command "java HelloWorld," as my textbook instructs me to do, I am returned the following error: "Could not find or load main class helloworld" So, What's going on here? Obviously, I'm absolutely brand new to java, and to programming in general.
has comment: http://stackoverflow.com/comment/37860387
has comment: http://stackoverflow.com/comment/37859991

http://stackoverflow.com/comment/37892790
type: Comment
type: QuestionComment
has text: When I add RichFaces jars I'm getting this errors while compiling: [2014-06-30 12:32:33,257] Artifact RichTest3:ejb exploded: Error during artifact deployment. See server log for details. [2014-06-30 12:32:33,257] Artifact RichTest3:ejb exploded: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"RichTest3_ejb_exploded.rar\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"RichTest3_ejb_exploded.rar\".STRUCTURE: Failed to process phase STRUCTURE of deployment \"RichTest3_ejb_exploded.rar\""}}
comment on: http://stackoverflow.com/q/24468940
score: 0

http://stackoverflow.com/q/24554342
favorite count: 0
has answer: http://stackoverflow.com/a/24554486
accepted answer: http://stackoverflow.com/a/24554486
upvote count: 26
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has body: Consider the following snippet: URLConnection connection = target.openConnection(); connection.setConnectTimeout(5000); // 5 sec connection.setReadTimeout(10000); // 10 sec Does the connection.setReadTimeout sets the maximum time available for STARTING read data or is it the maximum time available for COMPLETING read data? My understaning is that with that, java has 10 seconds to start reading the next byte of data from the connection. There is no timeout for finishing read all data from the connection as we do not know how big the strean may be. Is it correct?
has title: understanding URLConnection.setReadTimeout()
score: 26
tagged with: timeout
has answer: http://stackoverflow.com/a/24554531
possible better answer: http://stackoverflow.com/a/24554490
has answer: http://stackoverflow.com/a/24554490
has comment: http://stackoverflow.com/comment/93887336
answer count: 3
tagged with: urlconnection

http://stackoverflow.com/comment/37952116
type: AnswerComment
comment on: http://stackoverflow.com/a/24489185
has text: I change the answer. Try it.
type: Comment
score: 0

http://stackoverflow.com/a/35411325
downvote count: 2
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24557640
has body: In order to do this you can simply create a template class like this: public class TempClass { private List&lt;someClass&gt; listOfClass; public List&lt;someClass&gt; getListOfClass() { return listOfClass; } public void setListOfClass(List&lt;someClass&gt; listOfClass) { this.listOfClass = listOfClass; } } or even more complicated like this: public class TempClass { private List&lt;List&lt;List&lt;someClass&gt;&gt;&gt; listOfList; public List&lt;List&lt;List&lt;someClass&gt;&gt;&gt; getListOfList(){ return listOfList; } public void setListOfList(List&lt;List&lt;List&lt;someClass&gt;&gt;&gt; listOfList) { this.listOfList = listOfList; } } And at the end get this class as a response to the annotation above the method like this: @ApiOperation(response = TempClass.class) you should also specify the return type of the method as the TempClass There is another issue that discussed a same issue here
score: -1

http://stackoverflow.com/comment/37883626
has text: Your code is really confusing. The line `if (att == GL30.GL_DEPTH_ATTACHMENT)` suggests that this function might be called with `att == GL_DEPTH_ATTACHMENT`. In that case, you attach a _texture_ as depth attachment. And it is unclear if the texure you use is depth-renderable. Then you check for the framebuffer status, and _after that_, you attach a _renberbuffer_ as depth buffer, if `b` is true, and never check the staus of the final setup of your framebuffer. Please provide more code (how is this stuff called, how are the texures generates), so that an can follow what is actually going on.
type: QuestionComment
comment on: http://stackoverflow.com/q/24470748
score: 0
type: Comment

http://stackoverflow.com/comment/37806869
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24434466
has text: Some general comments on the code itself: 1) you should be using a database sequence to auto-increment the ID, not doing it in code; 2) When you catch an exception and print the stack trace you must rethrow it (or a `RuntimeException`) if you don't want the code to continue as if nothing happened.

http://stackoverflow.com/q/24527959
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26342110
score: 0
answer count: 2
has body: For running Jetty AJP, I have added etc/jetty-ajp.xml in jetty.conf The class Ajp13SocketConnector is located in jetty-distribution-8.1.15.v20140411/lib/jetty-ajp-8.1.15.v20140411.jar Even i copied this file to ext and restarted and even in all other folders and restarted but i an getting this exception. Following is trace of exception: WARN: oejx.XmlConfiguration:Config error at | 8009 | java.lang.ClassNotFoundException: org.eclipse.jetty.ajp.Ajp13SocketConnector java.lang.reflect.InvocationTargetException. Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.ajp.Ajp13SocketConnector
has title: JETTY: java.lang.ClassNotFoundException: org.eclipse.jetty.ajp.Ajp13SocketConnector
tagged with: jetty
possible better answer: http://stackoverflow.com/a/26342110
tagged with: java
has answer: http://stackoverflow.com/a/25684002
accepted answer: http://stackoverflow.com/a/25684002
type: Question

http://stackoverflow.com/q/24490183
tagged with: java
possible better answer: http://stackoverflow.com/a/24490235
upvote count: 1
type: Question
has body: void is an invalid type for the variable paint is the error i am getting by the way my program is when you click the checkbox the textfield shows the checkbox name in textfield thank you! Using if statement*.......... package irt; import java.applet.Applet; import java.awt.Checkbox; import java.awt.Graphics; import java.awt.Label; import java.awt.TextField; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public class chkBx extends Applet implements ItemListener { TextField t1; Checkbox c1,c2,c3; Label l1; public void init() { l1=new Label("data"); add(l1); t1=new TextField(15); add(t1); c1=new Checkbox("nashik"); add(c1); c2=new Checkbox("pune"); add(c2); c3=new Checkbox("mumbai"); add(c3); c1.addItemListener(this); c2.addItemListener(this); c3.addItemListener(this); } public void itemStateChanged(ItemEvent e) { String msg="state"; public void paint(Graphics g) { t1.setText(msg); g.drawString(msg,50,100); msg="city"+c1.getState(); } } }
has answer: http://stackoverflow.com/a/24490291
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37910094
tagged with: applet
has title: void is an invalid type for the variable paint
favorite count: 0
accepted answer: http://stackoverflow.com/a/24490291
has answer: http://stackoverflow.com/a/24490235
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/38146180
has text: I assume `golbalMMediaPlayer` is a static reference.
type: Comment
comment on: http://stackoverflow.com/a/24597213
score: 0
type: AnswerComment

http://stackoverflow.com/a/24479161
score: 0
accepted answer of: http://stackoverflow.com/q/24478821
answers question: http://stackoverflow.com/q/24478821
has body: To get rid of crash Surround your parsing methods in a try-catch, catching NumberFormatException. If the exception occurs, notify the user they entered an invalid value and do not proceed with the calculation try { Float value = Float.valueOf(text); if (value == null || value == 0f) { answer.setText("Zero"); } } catch (NumberFormatException e) { answer.setText("Invalid input"); }
has comment: http://stackoverflow.com/comment/37912755
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37824999
type: Comment
type: QuestionComment
has text: @laune I added kie-internal import and eclipse is saying `KnowledgeBase` is deprecated.. Can't I use KnowledgeBase api's?
score: 0
comment on: http://stackoverflow.com/q/24427560

http://stackoverflow.com/q/24570005
possible better answer: http://stackoverflow.com/a/24571263
has answer: http://stackoverflow.com/a/24571263
linked to: http://stackoverflow.com/q/15736640
linked to: http://stackoverflow.com/q/17264593
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/38058484
has comment: http://stackoverflow.com/comment/38058931
linked to: http://stackoverflow.com/q/15937377
has comment: http://stackoverflow.com/comment/38058529
has answer: http://stackoverflow.com/a/24570465
tagged with: postgresql
has body: I'm working on a application which should get data from a one table and record a result of processing in another table. All this in more that one thread and on a few computers. So I need to use some synchronize mechanism for that. As far as I need to use more that one computers I have to use some sync mechanism in DB (in my case it's PostgresSQL) instead of use lock in code. I know that postgres provide some lock on table, but i didn't find any docs how to setup it. Possible some standard solution already exist for that?
has title: Table lock in PostgreSQL
accepted answer: http://stackoverflow.com/a/24570465
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12002662
linked to: http://stackoverflow.com/q/13005410
tagged with: java
tagged with: hibernate
tagged with: multithreading
linked to: http://stackoverflow.com/q/14515543
type: Question

http://stackoverflow.com/comment/56508543
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24518487
type: AnswerComment
has text: I don't understand why 2.10.3 is a newer version than 2.9.2 ?

http://stackoverflow.com/a/24518359
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/24518328
score: 11
downvote count: 0
has body: No, you can't do that. Typically you'd do something like: private Test(int x, int y) { this.x = x; this.y = y; } public static Test fromX(int x) { return new Test(x, 0); } public static Test fromY(int y) { return new Test(0, y); } You might want to consider that pattern (public static factory methods which in turn call private constructors) even when you don't have overloading issues - it makes it clear what the meaning of the value you're passing is meant to be.

http://stackoverflow.com/q/24555289
tagged with: swing
tagged with: tablecellrenderer
type: Question
tagged with: java
has title: Changing Cell Color without changing color in other cells (Jtable)
has comment: http://stackoverflow.com/comment/38030643
tagged with: jtable
has body: So say that we have a JTable with 31 columns and 10 rows. And I want to change the color of the 2 Column 4 row to red. And after I do that change another cell color without loosing the color of my previous cell. I have tried the following without success: public class CellR extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { setForeground(Color.white); if(row == TestHotel.v.getRow() &amp;&amp; column == TestHotel.v.getCol()){ // Only for specific cell // c.setFont(/* special font*/); // you may want to address isSelected here too setForeground(Color.BLACK); setBackground(Color.RED); } return this; } If I call the renderer the first time it is working... But if I then want to change another cell color I am loosing the first one.
has comment: http://stackoverflow.com/comment/38030412
answer count: 2
has answer: http://stackoverflow.com/a/24555617
upvote count: 1
has comment: http://stackoverflow.com/comment/38030807
downvote count: 0
accepted answer: http://stackoverflow.com/a/24556135
linked to: http://stackoverflow.com/q/9735007
has comment: http://stackoverflow.com/comment/38030585
favorite count: 0
tagged with: colors
has answer: http://stackoverflow.com/a/24556135
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24555617
score: 1

http://stackoverflow.com/comment/37823594
comment on: http://stackoverflow.com/q/24443601
score: 0
type: Comment
type: QuestionComment
has text: In your example, 75% of the records have changed. If you think this will be the case most times, why spend time in finding whether an update is required or not and then have to update eventually at least 3/4th of the time? Cookies are not meant to be used in such scenarios.

http://stackoverflow.com/q/24445664
has comment: http://stackoverflow.com/comment/37827150
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24447346
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/37828239
has comment: http://stackoverflow.com/comment/37828033
tagged with: mouselistener
tagged with: java
has comment: http://stackoverflow.com/comment/37829223
has title: JLabel MouseEvent not excecuting after compiling my program to a jar
has comment: http://stackoverflow.com/comment/37828572
tagged with: swing
has comment: http://stackoverflow.com/comment/37828843
has body: I am working on a program. In one of my panels there is a JLabel, which you can click and a dialog will open. So far so good, but if I compile my program to a jar and run it, the label is unclickable and all of my events are ignored, no exceptions, nothing. In my IDE, the label and its Events are fine and all components work properly. My problem is: I don't know how to fix this. I don't know if should post some code, but i think its not the code which causes the bug. Some ideas? Here is a abstract form of my code: public class TaskListPanel extends javax.swing.JPanel { private javax.swing.JLabel lblAddTask; /** * Creates new form TaskListPanel */ public TaskListPanel() { initComponents(); } private void initComponents() { lblAddTask.setIcon(new javax.swing.ImageIcon(getClass().getResource("/path/to/my/icon.png"))); // NOI18N lblAddTask.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lblAddTaskMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { lblAddTaskMouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { lblAddTaskMouseExited(evt); } }); } //some more methods private void lblAddTaskMouseEntered(java.awt.event.MouseEvent evt) { lblAddTask.setIcon(new ImageIcon(getClass().getResource("/path/to/my/iconhighlighted.png/"))); } private void lblAddTaskMouseExited(java.awt.event.MouseEvent evt) { lblAddTask.setIcon(new ImageIcon(getClass().getResource("/path/to/my/icon.png/"))); } private void lblAddTaskMouseClicked(java.awt.event.MouseEvent evt) { //mydifferentdialog is a custom dialog, it works fine. mydifferentdialog dialog = new mydifferentdialog(); } } None of my lblAddTask Events are activiated. Is it maybe a problem in my IDE (Netbeans) which causes the bug because it compiles my programm wrong to a jar?
downvote count: 1
has comment: http://stackoverflow.com/comment/37827286
type: Question
has comment: http://stackoverflow.com/comment/37828869
has comment: http://stackoverflow.com/comment/37828546
score: -1
has comment: http://stackoverflow.com/comment/37826910
has comment: http://stackoverflow.com/comment/37828173
upvote count: 0
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/37826861
favorite count: 0
tagged with: jlabel

http://stackoverflow.com/comment/49562058
comment on: http://stackoverflow.com/a/24448709
type: AnswerComment
has text: This broke my eclipse :(
score: 0
type: Comment

http://stackoverflow.com/comment/38461174
comment on: http://stackoverflow.com/q/24533430
has text: @AlexCohn, I've put a pause to that project. Thank You for helping.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38290063
has text: Thanks for your help, it finally downloaded by itself. And, for anyone in the same shoe, it downloads App Engine to the main directory of ".gradle" by default. Extract your files there and locate it in your project.
comment on: http://stackoverflow.com/a/24497921
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/a/24533533
has comment: http://stackoverflow.com/comment/37993862
has comment: http://stackoverflow.com/comment/37989883
score: 1
accepted answer of: http://stackoverflow.com/q/24533208
has body: You can not use Assert.assertEquals to compare List&lt;String[]&gt;. This does not work: List&lt;String[]&gt; expected = new ArrayList&lt;&gt;(); expected.add(new String[]{"foo", "bar"}); expected.add(new String[]{"baz", "qux"}); List&lt;String[]&gt; actual = new ArrayList&lt;&gt;(); actual.add(new String[]{"foo", "bar"}); actual.add(new String[]{"baz", "qux"}); Assert.assertEquals(expected, actual); // Fails! You must do something like this: List&lt;String[]&gt; expected = new ArrayList&lt;&gt;(); expected.add(new String[]{"foo", "bar"}); expected.add(new String[]{"baz", "qux"}); List&lt;String[]&gt; actual = new ArrayList&lt;&gt;(); actual.add(new String[]{"foo", "bar"}); actual.add(new String[]{"baz", "qux"}); assertEquals(expected.size(), actual.size()); for (int i = 0; i &lt; expected.size(); i++) { for (int j = 0; j &lt; expected.get(i).length; j++) { Assert.assertEquals(expected.get(i)[j], actual.get(i)[j]); } }
answers question: http://stackoverflow.com/q/24533208
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37989830
upvote count: 1

http://stackoverflow.com/comment/37945768
comment on: http://stackoverflow.com/q/24509627
has text: @Pshemo the majority of the rules are numeric, but there are some special functions that have letters, but those only go as high as `H`, but no special characters
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24525600
type: Answer
has body: I would use a geo-coding Java API such GeoGoogle. It is open source. With that, you can call: GeoUtils.distanceBetweenInKm(firstAddress.getCoordinate(), secondAddress.getCoordinate());
answers question: http://stackoverflow.com/q/24525438
score: 0

http://stackoverflow.com/q/24536907
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26569517
has answer: http://stackoverflow.com/a/24541760
tagged with: glassfish
has body: How to rectify module deployment error while using GlassFish Server? While trying to run jsf web-application in Netbeans8 I am getting the following error: ant -f C:\\Users\\admin\\Desktop\\WebTime -Dnb.internal.action.name=run -Ddirectory.deployment.supported=true -DforceRedeploy=false -Dnb.wait.for.caches=true -Dbrowser.context=C:\\Users\\admin\\Desktop\\WebTime run init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest: compile: compile-jsps: Starting GlassFish Server GlassFish Server is running. In-place deployment at C:\Users\admin\Desktop\WebTime\build\web GlassFish Server, deploy, Connection refused: connect, false C:\Users\admin\Desktop\WebTime\nbproject\build-impl.xml:1045: The module has not been deployed. See the server log for details. Being new to programming, I need hint to rectify this error. Kindly help me to rectify it.
upvote count: 4
answer count: 3
has title: How to rectify module deployment error while using GlassFish Server?
favorite count: 0
type: UnansweredQuestion
score: 3
tagged with: jsf
tagged with: java
has answer: http://stackoverflow.com/a/38686925

http://stackoverflow.com/comment/37926091
type: QuestionComment
comment on: http://stackoverflow.com/q/24494964
has text: Have you experimented with `hibernate.connection.autocommit` as [described here](http://docs.jboss.org/hibernate/core/4.3/manual/en-US/html/ch03.html#configuration-jdbc-properties)?
score: 0
type: Comment

http://stackoverflow.com/q/24457175
has comment: http://stackoverflow.com/comment/37849122
type: Question
tagged with: casting
tagged with: java-native-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/24457864
has title: Putting JNI primitive types into same array
score: 0
has body: I am trying to write static Java method that with given parameters, searches and invokes Method. This method is supposed to have variable amount of arguments, and must be called from C++. I tried few options, but i cannot get it done. Is this even possible? So far, i can store what types it contains and what position, and i can put jobject and jstring in same array. If this is not possible, is it possible to refer either methodID found from JNI with Java's reflection or somehow pass reference to object in long. Such structure would be ok, since i can cast 64 bit Integer to everything else.
tagged with: android
has comment: http://stackoverflow.com/comment/37849053
has comment: http://stackoverflow.com/comment/37848887
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24457864
tagged with: java

http://stackoverflow.com/a/24559951
upvote count: 1
has comment: http://stackoverflow.com/comment/38039523
downvote count: 0
score: 1
has body: If you don't already have that information, there's no way to "teach" the program... The best you could do with what you have is assume that no users will be over 100 years old (or some similar hack), and say that birth years ending in 00-14 were born in the 21st century, and birth years ending in 15-99 were born in the 20th century. The better solution is just to do the extra work on the "inefficient" separate fields solution and avoid the hack I described above. In addition to ignoring the fact that there are 100+-year-olds out there, it's not a lasting or robust solution. More work on your part is better to create more robust and functional code.
type: Answer
answers question: http://stackoverflow.com/q/24559836

http://stackoverflow.com/q/24445840
has comment: http://stackoverflow.com/comment/38762945
has comment: http://stackoverflow.com/comment/38759673
has comment: http://stackoverflow.com/comment/38960079
upvote count: 2
has comment: http://stackoverflow.com/comment/37828182
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37827209
has comment: http://stackoverflow.com/comment/37828584
tagged with: swing
has comment: http://stackoverflow.com/comment/38794834
has body: Below is a small example for what i describe Well, I have a simple JFrame with a JPanel as its contentPane that i repaint with a SwingWorker every 20 ms with panel.repaint(). Also, I have a JDialog opened that shows its own graphics with opengl (I use a AWTGLCanvas from LWJGL library) that swaps buffers and repaint() every time it does paint its content (faster than the 20ms). The big problem is that in some way repainting my JPanel also affects the JDialog meaning that if i remove the panel.repaint() (which i have done) it works fine! When i have the panel.repaint() the JDialog shows some strange lines like i have cut the graphics in 2 and try to move them together with no success. I dont know if they call it flicker but it may be that problem. public testFrame(){ panel = new JPanel(){ protected void paintComponent(Graphics g){ //do the painting for the JPanel here } } setContentPane(panel); updateTime(); } public void updateTime(){ SwingWorker worker = new SWingWorker(){ @Override protected Object doInBackground() throws Exception { while(stopTimer == false){ Thread.sleep(20); if(isFocused() == true){ timer += 0.2f; panel.repaint(); } } return null; } }; worker.execute(); } And here is my AWTGLCanvas.paint method in my JDialog contentPane @Override public void paintGL() { //do some painting with classic opengl swapBuffers(); //awtglcanvas built-in method, meaning i cant control it repaint(); // it actually runs paintGL() again } Thanks in advance!
has comment: http://stackoverflow.com/comment/37827691
score: 2
has comment: http://stackoverflow.com/comment/37827699
has comment: http://stackoverflow.com/comment/38787895
answer count: 0
has comment: http://stackoverflow.com/comment/38950989
tagged with: java
tagged with: lwjgl
type: Question
has comment: http://stackoverflow.com/comment/37827198
has comment: http://stackoverflow.com/comment/38786610
has comment: http://stackoverflow.com/comment/38759591
has comment: http://stackoverflow.com/comment/39782710
has comment: http://stackoverflow.com/comment/38759234
has comment: http://stackoverflow.com/comment/37827756
has title: Calling repaint for specific JPanel in JFrame repaints also JDialog
downvote count: 0
has comment: http://stackoverflow.com/comment/37830322
has comment: http://stackoverflow.com/comment/37830671
has comment: http://stackoverflow.com/comment/39782643
has comment: http://stackoverflow.com/comment/38766445
has comment: http://stackoverflow.com/comment/39748299
has comment: http://stackoverflow.com/comment/38759415
favorite count: 0
tagged with: repaint

http://stackoverflow.com/q/24481717
has answer: http://stackoverflow.com/a/24481728
has comment: http://stackoverflow.com/comment/37894637
type: UnansweredQuestion
tagged with: sockets
tagged with: java
has answer: http://stackoverflow.com/a/24482471
type: Question
has title: Why URI on browser causes socket to run thrice
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/37894508
has body: This is a simple chat server. If I run and type : localhost:9092, I get the print statements printing three times each. I expected them to only print once. Can someone explain why a just typeing localhost:9092 only once causes while loop to run thrice ? public class ChatServer { public static void main(String[] args) throws IOException, InterruptedException { ServerSocket serverSocket = null; Socket socket = null; PrintWriter pw = null; try { serverSocket = new ServerSocket(9092); while (true) { socket = serverSocket.accept(); System.out.println("--- socket properties: " + socket.getPort()); pw = new PrintWriter(socket.getOutputStream(), true); pw.println("This is sme text!"); pw.println("This is some text!"); pw.close(); socket.close(); System.out.println("----- someone entered."); } } finally { if (serverSocket != null) serverSocket.close(); } } } Output: --- socket properties: 61802 ----- someone entered. --- socket properties: 61803 ----- someone entered. --- socket properties: 61804 ----- someone entered.

http://stackoverflow.com/a/26913623
has body: There is more than one dependency on the classpath that defines "OneToMany." Something is using an older version of javax.persistence. Just add this line of code before you get the error and see what is printed: System.out.println(javax.persistence.OneToMany.class.getProtectionDomain().getCodeSource().getLocation()); The JAR file that is printed is likely the culprit. You need to remove it or update it to use javax.persistence-2.X.X.
type: Answer
answers question: http://stackoverflow.com/q/24496770
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/24471281
possible better answer: http://stackoverflow.com/a/24471352
has comment: http://stackoverflow.com/comment/37909204
upvote count: 1
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/37877835
has body: Here is the code that I am working with. In this test I want to verify that the log method is being called when an exception is caught. public class SuperClass(){ public void log() { do some logging; } } public class ClassUnderTest extends SuperClass(){ public String methodbeingtested(Object param) { try { String a = SomeObject. methodthatthrowsexception(param);//static method, throws JAXB/NPE } catch(Exception exp) { log("log msg",exp);//inherited method } } } public class ClassUnderTestTest { @Test public testmethodbeingtested(){ ClassUnderTest cut = new ClassUnderTest() ClassUnderTest cutspy = Mockito.spy(cut); cutspy.methodbeingtested(param); Mockito.verify(cutspy).log("log msg", new Exception()); // exp is needed to here. } } After looking at several samples, the above was the closest I could get. This testcase forces an exception. But it fails to verify the log method call as Mockito.verify requires the exact exception (exp) that is caught, which the test case does not have access to. Is there any other way to test this scenario?
accepted answer: http://stackoverflow.com/a/24481667
tagged with: mockito
has comment: http://stackoverflow.com/comment/37885818
answer count: 2
tagged with: mocking
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37877962
score: 1
has comment: http://stackoverflow.com/comment/37875208
favorite count: 0
type: Question
tagged with: exception
has answer: http://stackoverflow.com/a/24481667
has answer: http://stackoverflow.com/a/24471352
has title: Unit testing that log message written when exception caught
tagged with: java

http://stackoverflow.com/comment/37859275
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24463140
has text: So why with the two files above it I don't get this error?
score: 0

log4j
tags question: http://stackoverflow.com/q/24495349
tags question: http://stackoverflow.com/q/24549895
tags question: http://stackoverflow.com/q/24553348
tags question: http://stackoverflow.com/q/24495742
tags question: http://stackoverflow.com/q/24550070
tags question: http://stackoverflow.com/q/24486488
tags question: http://stackoverflow.com/q/24486850
tags question: http://stackoverflow.com/q/24543787
tags question: http://stackoverflow.com/q/24453974
tags question: http://stackoverflow.com/q/24490636
tag name: log4j
tags question: http://stackoverflow.com/q/24541650
tags question: http://stackoverflow.com/q/24519531
tags question: http://stackoverflow.com/q/24515981
type: Tag
tags question: http://stackoverflow.com/q/24546914

http://stackoverflow.com/q/24473375
has comment: http://stackoverflow.com/comment/37973846
has answer: http://stackoverflow.com/a/24480342
answer count: 1
linked to: http://stackoverflow.com/q/24400354
accepted answer: http://stackoverflow.com/a/24480342
has comment: http://stackoverflow.com/comment/37884416
upvote count: 1
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: amazon-s3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37881598
has title: Play 2.3.x: Non-blocking image upload to Amazon S3
type: Question
tagged with: playframework
has body: I am wondering what the correct way with Play 2.3.x (Java) is to upload images to Amazon S3 in a non-blocking way. Right now I am wrapping the amazons3.putObject method inside a promise. However I fear that I am basically just blocking another thread with this logic. My code looks like following: return Promise.promise( new Function0&lt;Boolean&gt;() { public Boolean apply() { if (S3Plugin.amazonS3 != null) { try { PutObjectRequest putObjectRequest = new PutObjectRequest( S3Plugin.s3Bucket, name + "." + format, file.getFile()); ObjectMetadata metadata = putObjectRequest.getMetadata(); if(metadata == null) { metadata = new ObjectMetadata(); } metadata.setContentType(file.getContentType()); putObjectRequest.setMetadata(metadata); putObjectRequest.withCannedAcl(CannedAccessControlList.PublicRead); S3Plugin.amazonS3.putObject(putObjectRequest); return true; } catch (AmazonServiceException e) { // error uploading image to s3 Logger.error("AmazonServiceException: " + e.toString()); } catch (AmazonClientException e) { // error uploading image to s3 Logger.error("AmazonClientException: " + e.toString()); } } return false; } } ); What is the best way to do the upload process non-blocking? The Amazon library also provides the TransferManager.class for asynchronous uploads but I am not sure how to utilize this in a non-blocking way either... SOLUTION: After spending quite a while figuring out how to utilize the Promise/Future in Java, I came up with following solution thanks to Will Sargent: import akka.dispatch.Futures; final scala.concurrent.Promise&lt;Boolean&gt; promise = Futures.promise(); ... create AmazonS3 upload object ... upload.addProgressListener(new ProgressListener() { @Override public void progressChanged(ProgressEvent progressEvent) { if(progressEvent.getEventCode() == ProgressEvent.COMPLETED_EVENT_CODE) { promise.success(true); } else if(progressEvent.getEventCode() == ProgressEvent.FAILED_EVENT_CODE) { promise.success(false); } } }); return Promise.wrap(promi…
downvote count: 0
has comment: http://stackoverflow.com/comment/37891717
linked to: http://stackoverflow.com/q/22535826
has comment: http://stackoverflow.com/comment/37961324
favorite count: 0

http://stackoverflow.com/a/24523237
has comment: http://stackoverflow.com/comment/37970657
has body: I'm not sure thar it is solution, but try to do nothink in action move: case MotionEvent.ACTION_MOVE: // handlerXYPos.post(runnableXYPos); break;
has comment: http://stackoverflow.com/comment/37971250
upvote count: 2
has comment: http://stackoverflow.com/comment/37970979
answers question: http://stackoverflow.com/q/24523032
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24533566
type: Answer
has body: Simply query the database using hibernate with bookId. If any resultset is returned return true or else false.
answers question: http://stackoverflow.com/q/24533493
score: 0

http://stackoverflow.com/q/24468836
has title: Schedule execution of mediaplayer in android
tagged with: android
favorite count: 0
tagged with: service
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has body: I'm new to Android development and I need some help with a little problem. I have a background Service that runs my media player and communicate with my PlayerActivity. So far so good. I need to schedule the execution of the tracks in different periods. i.e Play track x for one minute than play track y for 30 seconds etc. So I call MyTimer thread form the PlayerActivity, this thread throws event at the specific time, the PlayerActivity catches the Event and calls the MediaplayerService next() method. My Problem is if I call next() without the thread it works fine, If i call it with the thread I get mContext is null, can't getMirrorDisplayStatus!!! with mediaplayer warning (1, 902) I've tried to run this thread with from the PlayerActivity via Handler.post() and runOnUiThread() and I get the same error. below is the code for MyTimer Thread. public class MyTimer implements Runnable { private Object mPauseLock; private boolean mPaused; private boolean mFinished; private TimeSection section; public Trainer() { mPauseLock = new Object(); mPaused = false; mFinished = false; BusProvider.getInstance().register(this); } @Override public void run() { while (!mFinished) { TimerManager tm = TimerManager.getInstace(); this.section = tm.getCurrentTimeSection(); if(this.section == null) mFinished = true; else { tm.inc(); // produce sectionChangeEvent event BusProvider.getInstance().post(produceSectionEvent()); try { Thread.sleep((this.section.getTypeDuration() * 1000)); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } synchronized (mPauseLock) { while (mPaused) { try { mPauseLock.wait(); } catch (InterruptedException e) { } } } } } /** * Call this on pause. */ public void onPause() { synchronized (mPauseLock) { mPaused = true; } } /** * Call this on resume. */ public void onResume() { synchronized (mPauseLock) { mPaused = false; mPauseLock.notifyAll(); } } @Produce public TimeSectionEvent produceSectionEvent(){ return new TimeSectionEv…
score: 2
tagged with: android-mediaplayer
tagged with: java
has answer: http://stackoverflow.com/a/24527700
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24475676

http://stackoverflow.com/a/77082199
answers question: http://stackoverflow.com/q/24551177
score: 2
downvote count: 0
upvote count: 2
has body: It is because you have missed some parentheses, Before Fixing : &quot; WHERE ( :status IS NULL OR ( :status IS NOT NULL AND c.caseStatus IN :status ) )&quot; After Fixing : &quot; WHERE ( (:status) IS NULL OR ( (:status) IS NOT NULL AND c.caseStatus IN (:status) ) )&quot;
type: Answer

http://stackoverflow.com/comment/37833317
type: QuestionComment
has text: Do you have a constructive answer?
type: Comment
comment on: http://stackoverflow.com/q/24449060
score: 0

http://stackoverflow.com/comment/38023381
has text: File -> New Project -> Maven -> Web Application, then "next next next ..."
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24550868

http://stackoverflow.com/comment/38074372
score: 0
type: Comment
has text: I just love the fact that one can diagnose this problem and point out the specific wrongdoing without actually seeing the code and using 2 words of description for it (Screen freeze). It's almost as widespread as trying to parse HTML/XML with regexes...
type: AnswerComment
comment on: http://stackoverflow.com/a/24578483

http://stackoverflow.com/q/24434566
has body: I want to implement Thread Safe Lazily Loaded Singleton in Java. Is this a good design? public final class ThreadSafeLazySynchronizedSingleton { private ThreadSafeLazySynchronizedSingleton(){} private static ThreadSafeLazySynchronizedSingleton instance; public static ThreadSafeLazySynchronizedSingleton getSynchronizedInstance(){ synchronized(ThreadSafeLazySynchronizedSingleton.class){ if (instance==null){ instance = new ThreadSafeLazySynchronizedSingleton(); } return instance; } } } I also want to create a lock-less version for use in a scenario where one thread accesses the Singleton many more times than the other threads, how would I achieve this using the atomic objects in Java, ie AtomicBoolean or AtomicReference etc. Could you provide a code example please?
has answer: http://stackoverflow.com/a/24435637
has title: Is this a good implementation for a Thread Safe Lazily Loaded Singleton in Java?
tagged with: java
has comment: http://stackoverflow.com/comment/37806578
tagged with: lazy-initialization
has comment: http://stackoverflow.com/comment/37806881
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37806840
tagged with: singleton
score: 1
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24434783
type: Question
upvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/24434814
has answer: http://stackoverflow.com/a/24434807
downvote count: 1

http://stackoverflow.com/q/24580242
has title: Get random number with larger numbers increasingly unlikely
answer count: 4
has answer: http://stackoverflow.com/a/24581302
score: 2
type: AnsweredQuestion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/38077989
has comment: http://stackoverflow.com/comment/38077219
has answer: http://stackoverflow.com/a/24580865
possible better answer: http://stackoverflow.com/a/24581302
has comment: http://stackoverflow.com/comment/38077173
type: Question
has comment: http://stackoverflow.com/comment/38077193
has answer: http://stackoverflow.com/a/24581138
upvote count: 5
has answer: http://stackoverflow.com/a/24580290
linked to: http://stackoverflow.com/q/5271598
has comment: http://stackoverflow.com/comment/38077993
tagged with: random
accepted answer: http://stackoverflow.com/a/24580865
has comment: http://stackoverflow.com/comment/38078007
favorite count: 0
has body: How can I get a random number in the range k to h such that the closer a number is to h the more unlikely it will come up? I'm going to need a number between 20 and 1980.
has comment: http://stackoverflow.com/comment/38078464
has comment: http://stackoverflow.com/comment/38078027
has comment: http://stackoverflow.com/comment/38078416
has comment: http://stackoverflow.com/comment/38077231

http://stackoverflow.com/q/24548085
tagged with: gradle
score: 9
type: Question
downvote count: 0
has body: I've got a problem regarding running tests in gradle. I know that in other machines my gradle config works but in mine unfortunately not. We have got junit test and testNG and both of them, when try to execute, produces stacktrace like this: Could not write standard input into: Gradle Worker 1. java.io.IOException: The pipe is being closed at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:318) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Which continuously will produce this error with different number (Gradle Worker 2, Gradle Worker 3, etc). Has anybody ever faced similar problem? I'm using gradle 1.6. EDIT: I forgot to tell that I'm using gradle wrapper EDIT: After changing to version 1.12 I'm receiving error: Caused by: org.gradle.api.InvalidUserDataException: Could not create task '(custome taks name)': Unknown argument(s) in task definition: [mustRunAfter] 11:20:17.990 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory.validateArgs(TaskFactory.java:147) 11:20:17.991 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory.checkTaskArgsAndCreateDefaultValues(TaskFactory.java:134) 11:20:17.991 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:72) EDIT: Ok I think I have found what cause this problem - it was Antivirus. …
has answer: http://stackoverflow.com/a/69110075
favorite count: 0
accepted answer: http://stackoverflow.com/a/24570136
has answer: http://stackoverflow.com/a/56036244
has answer: http://stackoverflow.com/a/60286842
has answer: http://stackoverflow.com/a/50936673
answer count: 5
tagged with: testng
has answer: http://stackoverflow.com/a/24570136
has comment: http://stackoverflow.com/comment/38020690
has title: Broken pipe error when running Gradle test
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/38017124
type: AnsweredQuestion
upvote count: 9
possible better answer: http://stackoverflow.com/a/60286842
tagged with: java

http://stackoverflow.com/q/24485899
tagged with: authorize.net
answer count: 1
has comment: http://stackoverflow.com/comment/44955612
favorite count: 0
has comment: http://stackoverflow.com/comment/37904090
has body: I want to integrate my app with Authorize.Net. I have followed the Steps given in tutorial http://developer.authorize.net/integration/fifteenminutes/android/. my library project anet_android_sdk showing no error. But when I created a new project as in step 3. I am getting error. import net.authorize.android.AuthNet; import net.authorize.android.AuthNetActivityBase; import net.authorize.android.SimpleActivity; import net.authorize.android.button.AuthNetButton;
tagged with: android
has comment: http://stackoverflow.com/comment/37905139
tagged with: android-activity
has title: Issues in Integrating Authorize.net API's for android
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24487782
type: Question
accepted answer: http://stackoverflow.com/a/24487782
tagged with: java
has comment: http://stackoverflow.com/comment/37904022
upvote count: 2
has comment: http://stackoverflow.com/comment/37902993

http://stackoverflow.com/comment/37901984
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24481270
has text: I updated topic. Can you answer the optional question?

http://stackoverflow.com/a/24527185
score: 1
accepted answer of: http://stackoverflow.com/q/24527066
has comment: http://stackoverflow.com/comment/37978208
type: AcceptedAnswer
downvote count: 0
has body: screen = (EditText) findViewById(editText); The parameter editText is not a valid Resource Identifier. In XML you should have &lt;EditText ... android:id="@+id/thetextid"&gt; And then in your code you should have screen = (EditText) findViewById(R.id.thetextid);
type: Answer
answers question: http://stackoverflow.com/q/24527066
upvote count: 1

http://stackoverflow.com/a/24503987
accepted answer of: http://stackoverflow.com/q/24503914
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/37938923
downvote count: 0
score: 1
has body: i think your app crash because if text1 is null you'll have a null pointer exception when you try this : if(text1.equals("")) So you should try that instead : text1.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(text1!=null &amp;&amp; !text1.trim().equals("")){ switch (event.getAction()) { case MotionEvent.ACTION_DOWN: text1.setBackgroundColor(Color.RED); InputConnection ic = getCurrentInputConnection(); ic.commitText(textOne, 1); break; case MotionEvent.ACTION_UP: text1.setBackgroundColor(Color.YELLOW); break; } } return true; } }
has comment: http://stackoverflow.com/comment/37938974
has comment: http://stackoverflow.com/comment/37938666
answers question: http://stackoverflow.com/q/24503914

http://stackoverflow.com/comment/37980620
has text: Could you psate the code of the entity Contact please ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24528597
score: 0

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

http://stackoverflow.com/comment/37830430
type: AnswerComment
has text: you need to make sure arrayList in updateValues method and arrayList when New() adapter (at the first time) is the same (same memory). And try to remove MyAdapter adapter = new MyAdapter(...)
type: Comment
comment on: http://stackoverflow.com/a/24447692
score: 0

forms
tags question: http://stackoverflow.com/q/24457361
type: Tag
tags question: http://stackoverflow.com/q/24525770
tags question: http://stackoverflow.com/q/24554423
tag name: forms

http://stackoverflow.com/q/24506667
has answer: http://stackoverflow.com/a/24506863
tagged with: locale
answer count: 1
has comment: http://stackoverflow.com/comment/37973891
score: 0
has comment: http://stackoverflow.com/comment/37941591
has body: I'm using Spring MVC as our controller framework, to implement our app internationalization, I use org.springframework.web.servlet.i18n.LocaleChangeInterceptor to detect language change, and I hope system's default language will be set as user client's locale if no specific language is set. Now I encountered a stranger problem during setting the default locale, I came from China, locale is zh_CN by default, when our system is deployed on Windows server, I can get the correct locale (zh_CN) from HttpServletResponse, but when our system deployed on Ubuntu Linux server, I always get en_US locale from HttpServletResponse. I just confused about that, we know HttpServletResponse's locale comes from clients like Web browser, 2 requests come from the same locale, but appear 2 different locales in HttpServletResponse. Thanks, I's wondering if any guys who have ever occurred and eventually solved this problem.
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37942767
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37941154
tagged with: java
has title: Why my locale in HttpServletResponse is always en_US?
has comment: http://stackoverflow.com/comment/37967466
tagged with: servlets
type: Question

http://stackoverflow.com/a/24485347
score: 2
accepted answer of: http://stackoverflow.com/q/24485283
has comment: http://stackoverflow.com/comment/37901456
answers question: http://stackoverflow.com/q/24485283
has body: You use a wrong JDBC- Driver class: org.h2.Driver You have to use a mysql driver like com.mysql.jdbc.Driver
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/24500143
has answer: http://stackoverflow.com/a/24533360
has title: FragmentTransaction remains old fragment
type: Question
tagged with: android
score: 0
has body: I'm new android programming. I want to make slider left or right fragment. e.g when button clicked list fragment show and map fragment hide and vice versa.First i added 2 fragment to my framelayout and I use hide/show instead of replace. However my fragmenttransaction sometimes work and sometimes not work. For example, When hit button map fragment entering(show) by sliding out left and list hides by sliding out right. But sometimes list remains my frame layout. In this situation when I pressed button normally reverse effect occurs but list fragment entering (show) my frame layout and it duplicated. How can i can fix problem about remains listview. My codes here Listview fragment &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:clickable="true"/&gt; MainActivity.java public void onClick(View view) { if (mapshere) { android.support.v4.app.FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction(); ft2.setCustomAnimations(R.anim.map_slide_in_right, R.anim.map_left_evade); ft2.show(list); ft2.hide(map); ft2.commit(); btnList.setImageResource(R.drawable.icon_pin_menu1); } else { android.support.v4.app.FragmentTransaction ft2 = getSupportFragmentManager().beginTransaction(); ft2.setCustomAnimations(R.anim.map_slide_in_left, R.anim.map_right_evade); ft2.show(map); ft2.hide(list); ft2.commit(); btnList.setImageResource(R.drawable.icon1); } My Listvie OnCreatView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.map_fragment_item_list, container, false); // Set the adapter mListView = (AbsListView) view.findViewById(android.R.id.list); ((AdapterView&lt;ListAdapter&gt;) mListView).setAdapter(getmAdapter()); mListView.setOnItemClickListener(this); return view; } As I said before I have already add these fragments in OnCreate function. …
answer count: 1
tagged with: android-fragments
tagged with: java
type: UnansweredQuestion
tagged with: listview

http://stackoverflow.com/q/24587539
tagged with: compilation
has body: I am trying to compile my java program using netbeans into a single .jar file, and holds multiple libraries. I am getting the NoClassDefFound &amp; ClassNotFoundException errors when trying to run via the cmd using: java -jar javafile.jar I have put my lib folder with all libraries inside the 'dist' folder. Here is the error output in the cmd line: It is for this particular library however it isn't added any different from the others and it doesn't seem like the others are throwing out errors of the class not being found.
answer count: 1
has title: Java compiling: NoClassDefFound & ClassNotFoundException
has answer: http://stackoverflow.com/a/24587817
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24587817
has comment: http://stackoverflow.com/comment/38090409

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

http://stackoverflow.com/q/24437012
has title: When to use a constant?
accepted answer: http://stackoverflow.com/a/24437088
type: Question
has answer: http://stackoverflow.com/a/24438027
downvote count: 0
has comment: http://stackoverflow.com/comment/37810762
answer count: 4
has answer: http://stackoverflow.com/a/24437088
favorite count: 0
tagged with: constants
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24437403
possible better answer: http://stackoverflow.com/a/24437220
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24437220
tagged with: java
has body: Below is a code snippet of ArrayList, which either takes in the 'initialCapacity' provided by the user or default of 10. My question - why was 10 not a static constant ? I guess constants are used when a variable is repeated more than once in the code. Am I right ? public ArrayList(int initialCapacity) { super(); if (initialCapacity &lt; 0) throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity); this.elementData = new Object[initialCapacity]; } /** * Constructs an empty list with an initial capacity of ten. */ public ArrayList() { this(10); }

http://stackoverflow.com/comment/38067030
has text: @CP then `clean and built` your project.......
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24574972

http://stackoverflow.com/a/24481000
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24480959
has body: Looks like you're trying to create a class called Die and that's meant to be its constructor. Try this: import java.util.Random; class Die { private Random r = new Random(); private final int nSides; public Die(int sides) { this.nSides = sides; } // rest of class omitted } Notes: Constructors don't declare a return type and are named the same as the class. No need to re-initialize the Random field (line removed) Better to declare nSides as final (see code) Better to make all fields private

http://stackoverflow.com/q/24446080
has comment: http://stackoverflow.com/comment/37973269
has answer: http://stackoverflow.com/a/29077578
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37858050
tagged with: cdi
has title: Excluding a CDI Bean based on a PropertyFileConfig (DeltaSpike, WebSphere 8.5.5)
tagged with: deltaspike
type: AnsweredQuestion
has body: I am trying to exclude a Bean implementation using the DeltaSpike 1.0 @Exclude-Annotation. The exclusion should be based on a property value like this: @Exclude(onExpression = "providerimplementation!=mock") I created a PropertyFileConfig returning my .properties file name to let DeltaSpike pick up the configured value and used this @Exclude in two different implementing beans, each of them being excluded like above. The configuration is included in an EAR as a .jar file and both implementations sit in different .jar files inside the EAR. I am trying to deploy the whole archive onto a WebSphere 8.5.5 Server and on startup I get a javax.enterprise.inject.AmbiguousResolutionException for the injection point. It seems to me that the PropertyFileConfig is not picked up before the expression resolution, although I found references to this kind of pattern (http://deltaspike.apache.org/core.html#exclude and https://groups.google.com/forum/#!topic/java-config/xsleMKST3rU), so I wonder what's wrong with my setup.
accepted answer: http://stackoverflow.com/a/29077578
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/37921991
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24496405
type: QuestionComment
has text: I have the text file of base64 characters and I need to take the text file an output it is the correct XML File. Sorry for the confusion. If I converted the text file to Bytes and then decoded the Bytes would I receive the correct characters?

http://stackoverflow.com/comment/38058879
has text: Read the documentation of available(), its perfectly legal for an implementation to always return 0 despite having data available.
comment on: http://stackoverflow.com/q/24570210
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24510184
has comment: http://stackoverflow.com/comment/37951335
has comment: http://stackoverflow.com/comment/37979065
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24510035
score: 2
has comment: http://stackoverflow.com/comment/37946676
answers question: http://stackoverflow.com/q/24510035
downvote count: 0
has body: In the bad old days, collections and maps were typically stuffed inside a class whose methods expose the right types. So, to create a "typesafe" list of integers, you might do something like: class IntegerList { private final List delegate = new ArrayList(); public boolean add(Integer i) { return delegate.add(i); } public Integer get(int index) { return (Integer) delegate.get(i); } public Iterator iterator() { return delegate.iterator(); } // etc } Of course, you're stuck with a non-typesafe Iterator, but you could achieve that with another similar IntegerIterator. Note that this is basically what generics does for you automatically. Why are you using such an antiquated JDK?
upvote count: 2

http://stackoverflow.com/comment/38076135
has text: Never did it myself, but try this: http://docs.oracle.com/javase/tutorial/jdbc/basics/cachedrowset.html. I assume, you may remove unwanted data on 2nd step by doing cachedRowSet.updateXXX(2, null);
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24578949
type: AnswerComment

http://stackoverflow.com/comment/38079393
comment on: http://stackoverflow.com/q/24581337
has text: @RichardTingle That depends. What is meant by "composition" ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38082441
comment on: http://stackoverflow.com/q/24573688
score: 0
type: QuestionComment
has text: Parth i don't know about it, i have just started learning it by my own.
type: Comment

http://stackoverflow.com/comment/38010339
type: Comment
has text: May be i couldn't understand fully, b utrace condition you exhibited could be very simple avoided with while loop checking the condition for queue full. I have pasted a code in paste bin to show what i am asking http://pastebin.com/ZD1uFy7S. The race condition you explained will not happen in the above code pasted.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24542089

http://stackoverflow.com/comment/37981266
has text: Also, if possible, add the full error message you get from the VISA.
score: 0
comment on: http://stackoverflow.com/q/24528156
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38037214
type: QuestionComment
comment on: http://stackoverflow.com/q/24558331
score: 1
has text: if this were visual basic, it would probably track down an IP address.
type: Comment

http://stackoverflow.com/a/24494303
has body: Isn't a best pratice to use raw type. If you want to use raw types without warning, you have to put @SuppressWarnings("rawtypes") above the method.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24494074

email
tags question: http://stackoverflow.com/q/24557088
tags question: http://stackoverflow.com/q/24493627
tags question: http://stackoverflow.com/q/24536168
tags question: http://stackoverflow.com/q/24429778
tags question: http://stackoverflow.com/q/24544763
tags question: http://stackoverflow.com/q/24585821
tags question: http://stackoverflow.com/q/24465235
tags question: http://stackoverflow.com/q/24566454
tags question: http://stackoverflow.com/q/24556259
tags question: http://stackoverflow.com/q/24529236
tags question: http://stackoverflow.com/q/24505264
tags question: http://stackoverflow.com/q/24453535
tags question: http://stackoverflow.com/q/24573296
type: Tag
tag name: email

http://stackoverflow.com/comment/37958902
has text: in the runTime() method i want it to show how long the battery has been running. And if and when it gets to 90% remaining, displays a warning. and in the start() method, I want it to start the battery and display the running time and remaining capacity of the battery.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24516895
score: 0

http://stackoverflow.com/comment/38853425
comment on: http://stackoverflow.com/a/24576979
score: 0
type: Comment
has text: @Jon Skeet: There *are* certain stack frames which Oracle’s JVM hides. But that has nothing to do with JIT inlining. I would just prefer existing issues for explaining the unreliability of stack traces over theoretical ones. In the end, a JVM is not required to provide stack traces at all.
type: AnswerComment

http://stackoverflow.com/a/24436667
has body: dbf files all use encodings, and not utf-8. Which encoding was used is a part of the metadata stored in the first few bytes of the file. You are facing one of two scenarios: The encoding is stored properly in the dbf file If this is happening then MS Acess is properly using that information to decode the raw dbf data into unicode, and xBaseJ is not. The encoding is not stored properly in the file If this is happening then MS Access is getting a lucky guess on the encoding, and xBaseJ is refusing to guess. You need to find a tool that will examine the dbf file and tell you which encoding was stored in it. If you don't know of any, and you don't mind having Python on your machine, you can use a dbf module I wrote to figure it out: import dbf table = dbf.Table('/path/to/some_table.dbf') print(table) which will print out the encoding, number of fields, size of a record, field names, etc. Note on installing (which can be such a pain) Ideally, you should be able to install pip, and then do a pip install enum34 dbf --upgrade which will put the latest versions of those two libraries in the correct spot on your system. Failing that, you'll want to grab both enum34 and dbf from PyPI and put enum.py and dbf.py in your Python's site-packages folder: c:\python27\lib\site-packages # I think, it's been a while since I used Windows Update If, after doing all that, you discover that the codepage/encoding was never set in the file (it's amazing how often this happens), then you can also use dbf to change it (if you know what it should be): table.open() table.codepage = dbf.CodePage('cp1252') # for example table.close()
has comment: http://stackoverflow.com/comment/37855374
score: 1
has comment: http://stackoverflow.com/comment/37833266
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24432174
has comment: http://stackoverflow.com/comment/37819166
type: Answer

http://stackoverflow.com/comment/38064219
score: 0
type: Comment
type: QuestionComment
has text: I could also understand that. But I don't know where the issue is. Tell me another reachable host I could try... I have account almost everywhere. None is working except gmail.
comment on: http://stackoverflow.com/q/24573296

http://stackoverflow.com/q/24430587
tagged with: facet
has title: IBM RAD - Java Compiler & Project Facets Mismatch
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2239959
has answer: http://stackoverflow.com/a/24430808
tagged with: eclipse
has body: I have installed both Java 1.6 &amp; 1.7 on my system. I am using IBM RAD 8.5 (Built on top of Eclipse) for development and Currently trying to see what errors/warnings I get in case I compiler by Java 1.6 build project with Java 1.7 compiler. If I go to "Project->Properties->Java Compiler" then I am able to see version "1.7" among the listed Compiler Compliance Levels. BUT when I go to the "Project->Properties->Project Facets" then I am able to see only facets upto 1.6 and 1.7 is NOT listed there. When I try to compile this project by keeping project facets as 1.6 and compiler as 1.7 then I get Project Facets Mismatch error. The error says: - Java Compiler Level does not match the version of the isntalled Java Project Facet. Please suggest what changes do I need to do so that "1.7" becomes visible under the installed Java Project Facets. Thanks.
type: Question
has answer: http://stackoverflow.com/a/54104828
has answer: http://stackoverflow.com/a/24431287
score: 4
tagged with: ibm-rad
upvote count: 4
possible better answer: http://stackoverflow.com/a/24431287
answer count: 3
accepted answer: http://stackoverflow.com/a/24430808
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/38010565
comment on: http://stackoverflow.com/q/24543377
score: 0
type: Comment
type: QuestionComment
has text: OP, please consider accepting the answer that was the most helpful to you.

http://stackoverflow.com/comment/37981675
score: 0
type: Comment
type: QuestionComment
has text: You should also update what u want get from every example you gave.
comment on: http://stackoverflow.com/q/24527437

http://stackoverflow.com/comment/37973995
type: Comment
has text: @user1948008 Edited. There are other methods that you don't want to invoke involved. Just test that it is a method you do want.
comment on: http://stackoverflow.com/a/24524896
score: 0
type: AnswerComment

http://stackoverflow.com/q/24547353
tagged with: linux
type: UnansweredQuestion
has title: Xterm display not showing properly while executing java program in linux
tagged with: java
type: Question
has body: I am facing one issue while interacting with linux using java code. My need is to execute java program in linux environment which will open xterm and the execution will show there. The code I am using : try { Runtime r = Runtime.getRuntime(); String myScript = "/usr/bin/ls"; String[] cmdArray = {"xterm", "-e", myScript + " ; le_exec"}; r.exec(cmdArray); } catch (InterruptedException ex){ ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } The XTERM is opening on running the java program but is closing on its own and I am not able to see what went on for display in XTERM. As far as I know " ; le_exec" this is used for xterm to remain open unless key enter is not pressed.
tagged with: xterm
has answer: http://stackoverflow.com/a/24547440
score: 0
answer count: 1

http://stackoverflow.com/a/24474878
has comment: http://stackoverflow.com/comment/37881246
answers question: http://stackoverflow.com/q/24474838
score: 4
has body: Either, Move the initialisation into a method, and simply call the method again This has the advantage of being explicit about what you are doing, and also works for infinite streams. Collect the stream and then re-stream it In your example: final int[] arr = IntStream.range(1, 100).filter(n -&gt; n % 2 == 0).toArray(); Then final IntStream s = IntStream.of(arr);
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37881278

http://stackoverflow.com/comment/37965748
comment on: http://stackoverflow.com/a/24520439
type: AnswerComment
score: 0
type: Comment
has text: And at any rate even with the code you provided using reflection still will not allow `getDeclaredMethod` to be used on `instance` because it thinks its an `Object`

http://stackoverflow.com/a/24471918
score: 0
has body: Could you stash the value into a Formattable and use Formattable#formatTo to generate the desired output? As far as I know there's no way to suppress the decimal separator in a standard String.format("%f") output. Even if you add a DecimalFormatSymbolsProvider class, it must still return a char value from DecimalFormatSymbols.html#getDecimalSeparator().
type: Answer
answers question: http://stackoverflow.com/q/24471700

http://stackoverflow.com/a/65914203
answers question: http://stackoverflow.com/q/24535720
has body: Try using invisibilityOfElementLocated method. You can reference example here How to wait until an element no longer exists in Selenium?
score: 0
type: Answer

http://stackoverflow.com/a/24560050
answers question: http://stackoverflow.com/q/24559981
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/38039945
upvote count: 3
has comment: http://stackoverflow.com/comment/38039622
has body: Look at your two positions. Your fill oval is happening at snake.cherry.x*10 while the image is drawn at snake.cherry.x (SAME FOR Y) Thats why the image is at 49,27 and the dot is at 490,270
accepted answer of: http://stackoverflow.com/q/24559981

http://stackoverflow.com/comment/37924282
comment on: http://stackoverflow.com/a/24497811
type: AnswerComment
type: Comment
has text: Forgot to mention that I cannot modify `Foo`.
score: 1

http://stackoverflow.com/comment/37851429
type: QuestionComment
comment on: http://stackoverflow.com/q/24458806
has text: Have you tried restarting DDMS? What happens if you run `adb logcat` from the command line?
score: 0
type: Comment

http://stackoverflow.com/q/24560177
has body: I have a prototype storm app that reads a STOMP stream and stores the output on HBase. It works, but is not very flexible and I'm trying to get it set up in a more consistent way with the rest of our apps, but not having much luck figuring out how the current way of working with Storm. We use spring-jms classes, but instead of using them in the standard spring way, they are being created at run time, and setting dependencies manually. This project: https://github.com/granthenke/storm-spring looked promising, but it hasn't been touched in a couple years and doesn't build properly since the storm jars have been taken into apache incubator and repackaged. Is there something I'm missing, or is it not worth my while to get these things integrated?
score: 6
tagged with: apache-storm
has comment: http://stackoverflow.com/comment/38153015
type: Question
has answer: http://stackoverflow.com/a/24625587
tagged with: java
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/32117917
has comment: http://stackoverflow.com/comment/38128098
favorite count: 0
has title: Storm and Spring 4 integration
has answer: http://stackoverflow.com/a/30633148
accepted answer: http://stackoverflow.com/a/24625587
has answer: http://stackoverflow.com/a/32117917
tagged with: spring
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/a/24512796
has body: Not sure why your button freezes. It would be helpful to see what you are doing in the main activity. Here's an example that works for me and does not freeze: You can put this in the main activity: @Override protected void onStart() { super.onStart(); Button button = (Button) findViewById(R.id.button1); button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SubActivity.class); //****** Uncomment the following line if you want to re-use the subactivity instead of launching a new one //intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); } }); } And this in the sub-activity: @Override public void onBackPressed() { //super.onBackPressed(); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); }
answers question: http://stackoverflow.com/q/24496342
accepted answer of: http://stackoverflow.com/q/24496342
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37960362
type: Comment
has text: @ChrisTarazi that won't solve the problem, it will only convert it into a short-circuit operator.
comment on: http://stackoverflow.com/q/24517643
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37918611
comment on: http://stackoverflow.com/q/24491808
score: 0
type: Comment
type: QuestionComment
has text: @DanGetz I was tempted to annotate that statement in the question with an explanation that I can't imagine there being any difference for the type system. But I thought that maybe it would bring someone to an idea were it could make a difference.

http://stackoverflow.com/a/24546843
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38035543
accepted answer of: http://stackoverflow.com/q/24544052
type: Answer
has body: Is it basically a Maven project, i.e., do you have and maintain it through a pom.xml? Then my suggestion is to delete the project in Eclipse but keep the files on the disk (i.e., it removes it from the workspace). Then, run a simple mvn eclipse:clean eclipse:eclipse which creates a simple Java project without the Maven nature based on the POM (so the libraries are linked and the source/output directories are set up correctly - this may solve your ClassNotFoundError). If it's a simple Java project, I would advise deleting it from the workspace, removing the .classpath and .project files and importing it again with the Create a Java project with existing sources wizard. Either way, make a backup of your project before you start doing anything :-)
has comment: http://stackoverflow.com/comment/38135887
has comment: http://stackoverflow.com/comment/38139090
upvote count: 2
downvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24544052

http://stackoverflow.com/q/24523010
has body: I have worked on exporting the html(table)contents to excel using table id. I have used content type like response.getWriter().write(datatoexport); response.setHeader("Content-Type", "application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=test_file.xls"); response.getWriter().flush(); response.getWriter().close(); Here, datatoexport is the table id. It is working fine with excel. But, if I use content type as pdf like response.setHeader("Content-Type", "application/pdf"); response.setHeader("Content-Disposition", "attachment; filename=test_file.pdf"); But, I am getting pdf file is corrupted. Any help? Without using iText or other jars, How can I achieve it? Especially in IE 8
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37970206
score: 2
has title: Exporting content to pdf without using iText
has answer: http://stackoverflow.com/a/24523116
downvote count: 2
has comment: http://stackoverflow.com/comment/37970167
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37970200
tagged with: java
has comment: http://stackoverflow.com/comment/37970219
has comment: http://stackoverflow.com/comment/37970379
tagged with: servlets
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24523116
answer count: 1
tagged with: jsp
favorite count: 0

http://stackoverflow.com/q/24530581
has title: How to convert this scriptlet into JSTL?
has comment: http://stackoverflow.com/comment/38062624
has body: I've been reading up on JSTL and for the life of me I still cannot understand how some things work. Are there any short tutorials or brief run-throughs of the essential concepts and functions of JSTL? How do you convert this scriptlet into JSTL? I'm using some of my own defined classes and JSTL doesn't seem to recognize them. It gives out a "must prefix with some namespace" error when the jsp page is called. sessionCheck.jspf &lt;%@ page import="javax.servlet.http.Cookie" %&gt; &lt;%@ page import="sessionmanager.Errors" %&gt; &lt;%@ page import="sessionmanager.SessionCheck" %&gt; &lt;%@ page import="sessionmanager.SessionManager" %&gt; &lt;%@ page import="sessionmanager.SessionManager.Cookies" %&gt; &lt;% String sessionId = null; Cookie cookies[] = request.getCookies(); if(cookies != null) for(Cookie cookie : cookies) if(cookie.getName().equalsIgnoreCase(Cookies.SESSION_ID.getName())) { sessionId = cookie.getValue(); break; } SessionCheck sessionCheck = new SessionCheck(sessionId); Errors error = sessionCheck.getError(); Cookie sessionIdCookie = new Cookie(Cookies.SESSION_ID.getName(), sessionId); if(error == Errors.NONE) { sessionIdCookie.setMaxAge(SessionManager.cookieMaxAge); } else { sessionIdCookie.setMaxAge(0); } response.addCookie(sessionIdCookie); %&gt;
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37986145
has comment: http://stackoverflow.com/comment/37989602
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37988062
type: Question
has comment: http://stackoverflow.com/comment/37988154
score: 0
tagged with: jstl
has comment: http://stackoverflow.com/comment/37988956
tagged with: jsp

http://stackoverflow.com/q/24486589
has comment: http://stackoverflow.com/comment/41415106
has body: I am searching for a comfortable way to serialize / deserialize my java Pojos to JSON and came across Boon. I created a simple test code like this: ObjectMapper boonMapper = JsonFactory.create(); File file = temporaryFolder.newFile(); boonMapper.writeValue(file, myPojoList); // test if serialized as desired List&lt;MyPojo&gt; pojoList = boonMapper.readValue(file, ArrayList.class, MyPojo.class); // test if deserialized as desired It works fast and all values of my pojos are restored to my list. If i delete some values from the JSON File boon simply sets those values in my pojo to null or 0, which is ok. BUT if i add some values to the JSON file, which have no representive field in the pojo class, boon ignores those values, which of course results in loss of information. Jackson for example throws an error in those cases, which would be the desired behavior. I did not find any ways to configure boon to handle those cases differently, for example with annotations, like it is possible in Jackson. Performance is crucial for this serialization, so i am looking for faster alternatives to Jackson. But i like to have a JSON representation in serialized form and not a binary one. Thats why i started working with boon in the first place. So in summary: Is there a way to configure boon like Jackson? If not, are there alternatives to boon? Any suggestions or ideas are welcome, thank you
type: Question
has comment: http://stackoverflow.com/comment/41609739
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
score: 1
favorite count: 0
tagged with: serialization
has title: Is it possible to ensure typesafety (including different POJO versions) when (de-)serialising java-POJOs with the boon ObjectMapper?
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/37882949
type: Comment
type: QuestionComment
has text: Your problem is that `this` makes no sense in a `static` method, because `this` means the object on which the current method is being run, and `static` means that the method is not run on any particular object. Most likely, you want `playTurn` not to be `static`.
score: 1
comment on: http://stackoverflow.com/q/24475740

http://stackoverflow.com/comment/37820387
comment on: http://stackoverflow.com/q/24442012
type: Comment
has text: You are mistyping `==` (comparison) as `=` (assignment), though I hear that in Java you’re supposed to use `.equals` anyways. Also, `answer != "yes" || "no"` doesn’t work. `||` is an operator like any other; you need to give it appropriate operands, i.e. `!(answer.equals("yes") || answer.equals("no"))`.
score: 1
type: QuestionComment

http://stackoverflow.com/q/24515917
upvote count: 6
score: 6
has answer: http://stackoverflow.com/a/24561945
tagged with: jsonschema
type: AnsweredQuestion
has body: I am trying to automatically generate JsonSchema from pojos in my project: The code looks like this: ObjectMapper mapper = new ObjectMapper(); SchemaFactoryWrapper visitor = new SchemaFactoryWrapper(); mapper.acceptJsonFormatVisitor(clazz, visitor); JsonSchema jsonSchema = visitor.finalSchema(); String schemaString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonSchema); When clazz is defined like this: public class ZKBean { public String anExample; public int anInt; } I end up with this: { "type" : "object", "id" : "urn:jsonschema:com:emc:dpad:util:ZKBean", "properties" : { "anInt" : { "type" : "integer" }, "anExample" : { "type" : "string" } } } All that is great. What I want to do is add the "description" key to the schema, so that I instead have something that looks like: { "type" : "object", "id" : "urn:jsonschema:com:emc:dpad:util:ZKBean", "properties" : { "anInt" : { "type" : "integer", "description" : "Represents the number of foos in the system" }, "anExample" : { "type" : "string", "description" : "Some descriptive description goes here" } } } I assumed there was some annotation I could just put on the fields in my ZKBean class, but after half a day of futzing I have not found one. Is this the way to go? Or do I need to do something with my Visitor? Thanks, Jesse
has title: Generating JsonSchema from pojo: how do I add "description" automatically?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/41617901
type: Question
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/24561945
tagged with: jackson
favorite count: 0
has answer: http://stackoverflow.com/a/24518309
accepted answer: http://stackoverflow.com/a/24518309

http://stackoverflow.com/q/24532156
downvote count: 0
score: 1
has body: I'm trying to figure out how to parse a JSON feed into a table in Dart. I'm not sure if I should use a Map but if I do, I'm not sure how to approach extracting data. I want to have one cell to hold the assetID, then another for domain name, and another for IP address. Please let me know if you need more information. Dart: void loadData() { var url = "http://localhost:8080/***selectAll"; //call the web server asynchronously var request = HttpRequest.getString(url).then(onDataLoaded); } void onDataLoaded(String response) { TableElement table = querySelector("#domainTableSelector"); //table.children.add(); var jsonString = response; // print(jsonString); List&lt;String&gt; list = new List&lt;String&gt;(); list.add(jsonString); for (var x = 0; x &lt; list.length; x++) { //create new table row TableRowElement row = table.insertRow(x+1); TableCellElement cell = row.insertCell(x); cell.text = list.toString(); // print(list); } // Iterator itr= list.iterator(); // // print("Displaying List Elements,"); // // while(itr.hasNext()) // { // print(itr.next()); // } } JSON [{"serviceResponseValue":[{"assetId":"8a41250446b89b5f0146b04d49910023","oplock":0,"longitude":115.86,"domainName":"free-aus-trip.au","latitude":-31.95,"ipAddress":"6.0.0.6"},{"assetId":"8a49859246918966014691b1aac9000c","oplock":0,"longitude":-65.30,"domainName":null,"latitude":-24.18,"ipAddress":"4.0.0.4"},{"assetId":"8a49859246876566014691b1437512e4","oplock":0,"longitude":77.60,"domainName":"allmovies.cn","latitude":12.97,"ipAddress":"14.0.0.14"},{"assetId":"8a49850446b04b5f0146b04d49910000","oplock":0,"longitude":112.47,"domainName":"getrichez.cn","latitude":32.98,"ipAddress":"5.0.0.5"},{"assetId":"8a498592469189660146919b7a210006","oplock":0,"longitude":-37.61,"domainName":"googles.com","latitude":55.75,"ipAddress":null},{"assetId":"8a42250876b89b5f0876b04d49910763","oplock":0,"longitude":-68.90,"domainName":"lolcatzfun.net","latitude":-22.48,"ipAddress":"8.0.0.8"},{"assetId":"8a498592469189660146919f8d70…
possible better answer: http://stackoverflow.com/a/24532783
favorite count: 0
has answer: http://stackoverflow.com/a/24532783
accepted answer: http://stackoverflow.com/a/24532788
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37987259
upvote count: 1
tagged with: http
linked to: http://stackoverflow.com/q/8977199
type: Question
has comment: http://stackoverflow.com/comment/37987397
has title: Dart Parse JSON into Table
tagged with: javascript
has answer: http://stackoverflow.com/a/24532788
answer count: 2
tagged with: dart

http://stackoverflow.com/q/24523342
has comment: http://stackoverflow.com/comment/37971207
has comment: http://stackoverflow.com/comment/37970889
has body: I was recently learning Objective C, and learnt that in Objective C, you can run a method on an object, even if it's Type does not declare it. I was wondering why you can't do that in Java. For example: class Animal{ public void move(){/*something*/} } class Dog extends Animal{ public void bark(){/*barks*/} } //In another class: Animal anInstanceOfADog = new Dog(); anInstanceOfADog.bark()// &lt;- This would be an error, as Animal doesn't have the method bark. In this case, we would get an error as Animal cannot bark. Nonetheless, the object is a reference a Dog, and a Dog can bark. Thus, the question is: What role do types play in the execution of code in Java? Why is this so? Thanks, Dean
has comment: http://stackoverflow.com/comment/37970880
has comment: http://stackoverflow.com/comment/37971224
favorite count: 0
has comment: http://stackoverflow.com/comment/37971359
has comment: http://stackoverflow.com/comment/37971341
has comment: http://stackoverflow.com/comment/37971483
has comment: http://stackoverflow.com/comment/37970801
upvote count: 1
has comment: http://stackoverflow.com/comment/37970791
has comment: http://stackoverflow.com/comment/37970918
has title: Why does java have types? Do they do anything at runtime?
has answer: http://stackoverflow.com/a/24523549
downvote count: 6
has comment: http://stackoverflow.com/comment/37971049
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/37971388
has comment: http://stackoverflow.com/comment/37970832
tagged with: java
has comment: http://stackoverflow.com/comment/37970901
has comment: http://stackoverflow.com/comment/37971101
has comment: http://stackoverflow.com/comment/37971380
has comment: http://stackoverflow.com/comment/37970802
type: Question
has comment: http://stackoverflow.com/comment/37970796
tagged with: casting
accepted answer: http://stackoverflow.com/a/24523549
has comment: http://stackoverflow.com/comment/37970848
has comment: http://stackoverflow.com/comment/37971273
has comment: http://stackoverflow.com/comment/37971292
has comment: http://stackoverflow.com/comment/37971176
has comment: http://stackoverflow.com/comment/37970862
tagged with: types
answer count: 1

database
tags question: http://stackoverflow.com/q/24447880
tags question: http://stackoverflow.com/q/24509919
tags question: http://stackoverflow.com/q/24547173
tags question: http://stackoverflow.com/q/24522519
tags question: http://stackoverflow.com/q/24518202
type: Tag
tags question: http://stackoverflow.com/q/24435989
tags question: http://stackoverflow.com/q/24541650
tags question: http://stackoverflow.com/q/24571914
tags question: http://stackoverflow.com/q/24485365
tags question: http://stackoverflow.com/q/24507711
tags question: http://stackoverflow.com/q/24471543
tags question: http://stackoverflow.com/q/24484709
tags question: http://stackoverflow.com/q/24539038
tag name: database
tags question: http://stackoverflow.com/q/24537911
tags question: http://stackoverflow.com/q/24543752
tags question: http://stackoverflow.com/q/24436196
tags question: http://stackoverflow.com/q/24431063
tags question: http://stackoverflow.com/q/24467498
tags question: http://stackoverflow.com/q/24427597
tags question: http://stackoverflow.com/q/24505146
tags question: http://stackoverflow.com/q/24506289
tags question: http://stackoverflow.com/q/24483998
tags question: http://stackoverflow.com/q/24517054
tags question: http://stackoverflow.com/q/24557298
tags question: http://stackoverflow.com/q/24429553
tags question: http://stackoverflow.com/q/24543409
tags question: http://stackoverflow.com/q/24535493
tags question: http://stackoverflow.com/q/24567633
tags question: http://stackoverflow.com/q/24428318
tags question: http://stackoverflow.com/q/24578950
tags question: http://stackoverflow.com/q/24528146
tags question: http://stackoverflow.com/q/24499620
tags question: http://stackoverflow.com/q/24556715
tags question: http://stackoverflow.com/q/24484662

http://stackoverflow.com/q/24491808
has comment: http://stackoverflow.com/comment/37913435
has answer: http://stackoverflow.com/a/24492108
has comment: http://stackoverflow.com/comment/37913500
type: AnsweredQuestion
has body: In the JDK, there's Collection.emtpyList() and Collection.emptySet(). Both in their own right. But sometimes all that is needed is an empty, immutable instance of Collection. To me, there's no reason to chose one over the other as both implement all operations of Collection in an efficient way and with the same results. Yet each time I need such an empty collection I ponder which one to use for a second of two. I do not expect to gain a deeper understanding of the collections framework from an answer to this question but maybe there's a subtle reason I could use to justify choosing one over the other without thinking about it ever again. An answer should state at least one reason preferring one of Collection.emtpyList() and Collection.emptySet() over the other in a context where they're functionally equivalent. An answer is better if the stated reason is near the top of this list: There's a case where the type system is happier with one over the other (e.g. type inference allows shorter code with one than the other). There is a performance difference, maybe in some special case (e.g. if the empty collection is passed as an argument to some of the collection framework's static or instance methods like Collections.sort() or Collection.removeAll()). Choosing one over the other "makes more sense" in the general case, if you think about it. Examples where this question arises To give some context, here are two examples where I am in need of an empty, unmodifiable collection. This is an example of an API that allows creating some object by optionally specifying a collection of objects that are used in the creation. The second method just calls the first one with an empty collection: static void createObjectWithTheseThings(Collection&lt;Thing&gt; things) { ... } static void createObjectWithoutAnyThings() { createObjectWithTheseThings(Collections.emptyXXX()); } This is an example of an Entity with state represented by an immutable collection stored in a non-final field. On …
downvote count: 0
has comment: http://stackoverflow.com/comment/37918432
score: 1
tagged with: java
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/37914027
possible better answer: http://stackoverflow.com/a/24492108
has answer: http://stackoverflow.com/a/24494971
has title: emptyList() vs emptySet(), is there any reason to chose one over the other if an instance of Collection is needed?
has comment: http://stackoverflow.com/comment/37914444
answer count: 3
has comment: http://stackoverflow.com/comment/37913492
upvote count: 1
has answer: http://stackoverflow.com/a/24494622
favorite count: 0
accepted answer: http://stackoverflow.com/a/24494622
has comment: http://stackoverflow.com/comment/37913660
has comment: http://stackoverflow.com/comment/37918611

http://stackoverflow.com/comment/37823724
has text: Are your sure that `connectionParameters` is been loaded correctly and contains all the values?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24443824

http://stackoverflow.com/comment/38071130
type: QuestionComment
comment on: http://stackoverflow.com/q/24576322
has text: You should be using "large objects", use a `bytea` column instead (which is effectively the same as `BLOB` in other DBMS). Search this site. This gets asked about once a month
score: 0
type: Comment

http://stackoverflow.com/q/24528597
tagged with: sqlite
downvote count: 0
has comment: http://stackoverflow.com/comment/37980800
has comment: http://stackoverflow.com/comment/37980622
has answer: http://stackoverflow.com/a/24528847
has comment: http://stackoverflow.com/comment/37980648
has answer: http://stackoverflow.com/a/24528701
score: 3
has answer: http://stackoverflow.com/a/24528667
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/24528701
has comment: http://stackoverflow.com/comment/37980620
has body: I've been given an assignment to demonstrate CRUD operations using sqlite. When I try to retrieve an item from the database my ResultSet doesn't seem the have the "id" column. I am quite stumped. This is my ContactRepository class. public class ContactRepositoryJDBC implements ContactRepository { private static Connector connector = new Connector(); ... public Contact getById(int id) throws SQLException { Contact contact = null; try (Connection conn = connector.getConnection(); PreparedStatement statement = conn .prepareStatement(SQL.GET_CONTACT_BY_ID)) { statement.setInt(1, id); try (ResultSet resultSet = statement.executeQuery()) { if (resultSet.next()) { contact = new Contact(); contact.setId(resultSet.getInt("id")); contact.setFirstName(resultSet.getString("first_name")); contact.setSurname(resultSet.getString("surname")); contact.setHomeNumber(resultSet.getString("home_number")); contact.setCellNumber(resultSet.getString("cell_number")); contact.setEmail(resultSet.getString("email")); } } } if (contact == null) { System.out.print("no contact with id " + id + " found : "); } return contact; } ... } I use a seperate class for my sql statements public class SQL { ... public static final String GET_CONTACT_BY_ID = "SELECT first_name, surname, home_number, cell_number, email FROM Contact WHERE id = ?"; ... } I get an SQLException "no such column id" Exception in thread "main" java.sql.SQLException: no such column: 'id' at org.sqlite.RS.findColumn(RS.java:121) at org.sqlite.RS.getInt(RS.java:293) at net.phonebook.repository.ContactRepositoryJDBC.getById(ContactRepositoryJDBC.java:59) at net.phonebook.model.app.App.main(App.java:31) EDIT: Contact model class public class Contact { private int id; private String firstName; private String surname; private String homeNumber; private String cellNumber; private String email; public Contact(String firstName, String surname, String homeNumber, String cellNumber, String email) { this.firstName = firstName; this.surname = surn…
type: AnsweredQuestion
has title: java.sql.SQLException: no such column
accepted answer: http://stackoverflow.com/a/24528667
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24528740
tagged with: sql

http://stackoverflow.com/comment/37989284
score: 0
comment on: http://stackoverflow.com/q/24530693
type: Comment
has text: Okay you have permission now, i'm sorry.
type: QuestionComment

http://stackoverflow.com/q/24537769
type: Question
tagged with: apache-kafka
tagged with: sbt
has answer: http://stackoverflow.com/a/24538206
downvote count: 0
answer count: 1
favorite count: 0
tagged with: scala
accepted answer: http://stackoverflow.com/a/24538206
type: AnsweredQuestion
has body: I'm trying to install Kafka on a Digitalocean droplet with this guide: https://kafka.apache.org/08/quickstart.html So, I'm downloading the last release: http://ftp.unicamp.br/pub/apache/kafka/0.8.1.1/kafka-0.8.1.1-src.tgz But after TAR file and enter directory, it has no SBT file to run. Am I doing something wrong?
score: 1
has title: where is SBT file in my kafka download?
tagged with: java
upvote count: 1

http://stackoverflow.com/q/24561028
has comment: http://stackoverflow.com/comment/38041688
has body: I have the following piece of code that evaluates to true: &lt;c:choose&gt; &lt;c:when test="${not isAddressNotFound}"&gt; &lt;%-- Always evaluates to true --&gt; &lt;/c:when&gt; &lt;/c:choose&gt; However, the isAddressNotFound variable is never defined in the code. Is this a feature at the time of evaluating a variable that has been never defined instead of throwing an error? If so, what would be the benefits of doing so?
type: AnsweredQuestion
tagged with: jsp
has answer: http://stackoverflow.com/a/24561491
has title: JSP EL: Why does the not operator evaluates to true on undeclared variable
type: Question
linked to: http://stackoverflow.com/q/2811626
score: 0
accepted answer: http://stackoverflow.com/a/24561491
answer count: 1
has comment: http://stackoverflow.com/comment/38041880
tagged with: java

http://stackoverflow.com/q/24526714
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: Now I want to add this layout "R.layout.post" to this layout "R.layout.fragment_main" and also to repeat it more than one time and to return it as a View. So, I don't know how to put that LinearLayout "mainLayout" in the View to return it back public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); LinearLayout mainLayout = (LinearLayout) rootView.findViewById(R.layout.fragment_main); int k = 3; for (int i = 0 ; i &lt; k ;i++) { rootView = inflater.inflate(R.layout.post, container, false); mainLayout.addView(rootView); } return rootView; } fragment_main.xml &lt;RelativeLayout xmlns:android="schemas.android.com/apk/res/android"; xmlns:tools="schemas.android.com/tools"; android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.wikimob.MainActivity$PlaceholderFragment" android:id="@+id/frgment"&gt; &lt;/RelativeLayout&gt; post.xml ?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/postLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; LogCat 07-02 13:21:05.537: I/art(17001): Profiler disabled. To enable setprop dalvik.vm.profiler 1 07-02 13:21:05.642: I/am_on_resume_called(17001): [0,com.example.wikimob.Splash] 07-02 13:21:05.647: D/CanvasContext(17001): Render dirty regions requested: true 07-02 13:21:05.650: I/am_on_resume_called(17001): [0,com.example.wikimob.Splash] 07-02 13:21…
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/37978673
type: Question
has comment: http://stackoverflow.com/comment/37977601
tagged with: android-layout
has title: How to Repeat fragment layout ? in Android
tagged with: layout
has comment: http://stackoverflow.com/comment/37977500
has answer: http://stackoverflow.com/a/24527627

http://stackoverflow.com/a/24443093
has comment: http://stackoverflow.com/comment/37823843
score: 1
upvote count: 1
has body: Your expression Paths.get("c:\\folder1\\..\\.\\folder1\\..\\.\\folder1\\..\\.\\folder1\\..") is really just c:\ when normalized. If you then relativize c:\file.txt against that path, you get a relative path that will lead you there. From c:\, that relative path is file.txt. The result ..\..\..\..\..\..\..\..\..\..\..\file.txt is exactly equivalent to file.txt. When normalized, leading .. will be discarded. I agree it isn't pretty, but that's just an implementation detail.
has comment: http://stackoverflow.com/comment/37822953
has comment: http://stackoverflow.com/comment/37823873
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24442911
has comment: http://stackoverflow.com/comment/37823673
answers question: http://stackoverflow.com/q/24442911
type: Answer

http://stackoverflow.com/a/24585752
has comment: http://stackoverflow.com/comment/38087561
answers question: http://stackoverflow.com/q/24585682
score: 0
has body: The problem is you set textview findViewById outside of onCreate method.So,Initialize textview in method of activity not in activity class. i.e. Change public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RequestQueue queue = MyVolley.getRequestQueue(); StringRequest myReq = new StringRequest(Method.GET, "http://www.google.com/", createMyReqSuccessListener(), createMyReqErrorListener()); queue.add(myReq); } TextView tv = (TextView) findViewById(R.id.textView1); to public class MainActivity extends Activity { TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.textView1); RequestQueue queue = MyVolley.getRequestQueue(this); StringRequest myReq = new StringRequest(Method.GET, "http://www.google.com/", createMyReqSuccessListener(), createMyReqErrorListener()); queue.add(myReq); } Edit You did not initialize volley's request queue,so first initialize it. so change this public static RequestQueue getRequestQueue() { if (mRequestQueue != null) { return mRequestQueue; } else { throw new IllegalStateException("RequestQueue not initialized"); } } to public static RequestQueue getRequestQueue(Context mContext) { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(mContext); } return mRequestQueue; } and change RequestQueue queue = MyVolley.getRequestQueue(); to RequestQueue queue = MyVolley.getRequestQueue(this); in OnCreate method of activity.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38087237
type: Answer
has comment: http://stackoverflow.com/comment/38087349
has comment: http://stackoverflow.com/comment/38087210
has comment: http://stackoverflow.com/comment/38087660
accepted answer of: http://stackoverflow.com/q/24585682
has comment: http://stackoverflow.com/comment/38087146
has comment: http://stackoverflow.com/comment/38087527
has comment: http://stackoverflow.com/comment/38087676
has comment: http://stackoverflow.com/comment/38087167
has comment: http://stackoverflow.com/comment/38087411
has comment: http://stackoverflow.com/comment/38087257
has comment: http://stackoverflow.com/comment/38087751
has comment: http://stackoverflow.com/comment/38087276

http://stackoverflow.com/comment/38024631
type: Comment
comment on: http://stackoverflow.com/q/24546532
has text: Post your jrxml code.
score: 0
type: QuestionComment

http://stackoverflow.com/a/24479207
answers question: http://stackoverflow.com/q/24475105
type: Answer
has comment: http://stackoverflow.com/comment/37921837
score: 0
has body: The main problem in your code is that you didn't closed connection and statement. Moreover, I would like to add that your servlet is not programmed according to good practice, database connections should be initialized and destroyed in context listeners which creates a connection when web is first started and close it when context is destroyed and should be saved to servlet context and in all servlets, connection should be retrieved from the servlet context. Statements ONLY should be made and destroyed in the servlets, however i would prefer preparedStatements if query is to be executed repeatedly.

http://stackoverflow.com/q/24515150
has answer: http://stackoverflow.com/a/24515249
score: 1
tagged with: java
upvote count: 1
has body: Suppose I write an app for android in the Play Store and then I create a new version in a new project in a separate workspace. If I use the same application name, package name, and keystore and key, can I replace the existing app in the Play Store? Or would it consider the second app different? I use Eclipse if that matters.
has answer: http://stackoverflow.com/a/24515267
type: Question
tagged with: mobile
accepted answer: http://stackoverflow.com/a/24515249
has answer: http://stackoverflow.com/a/24515360
downvote count: 0
possible better answer: http://stackoverflow.com/a/24515259
favorite count: 0
has answer: http://stackoverflow.com/a/24515259
tagged with: android
tagged with: apk
answer count: 4
has title: Signing apk with same package name and key
type: AnsweredQuestion

http://stackoverflow.com/comment/38044054
type: QuestionComment
has text: What do you mean nothing happens? Does your load method (incarcareContacte) even execute? Does it throw an exception? Does it deserialize an empty list?
comment on: http://stackoverflow.com/q/24562029
score: 0
type: Comment

http://stackoverflow.com/a/24581484
score: 4
has comment: http://stackoverflow.com/comment/38079530
has comment: http://stackoverflow.com/comment/38079562
has comment: http://stackoverflow.com/comment/38079590
type: Answer
has comment: http://stackoverflow.com/comment/38079557
has comment: http://stackoverflow.com/comment/38079591
has comment: http://stackoverflow.com/comment/38079526
has comment: http://stackoverflow.com/comment/38079614
has comment: http://stackoverflow.com/comment/38079629
has body: Because you hide the Node class with the generic Node (here: Tree&lt;Node&gt;). &lt;T extends Node&gt; So it know it extends Node what you pass to it (and know it have x etc.)
upvote count: 4
has comment: http://stackoverflow.com/comment/38079570
answers question: http://stackoverflow.com/q/24581449
downvote count: 0

http://stackoverflow.com/comment/37798381
score: 0
has text: As @immibis suggested, use Object `wait`/`notify`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24430308

http://stackoverflow.com/q/24527232
has body: Consider the following setup: // debugger class public class Debug { // setting public final static boolean DEBUG = false; void print_checked( String s ) { if( DEBUG ) System.out.print( s ); } void print_unchecked( String s ) { System.out.print( s ); } } // worker class public class Algorithm { Debug debugger; public void heavyWeightAlgorithmImplementation() { // method 1 debugger.print_checked( "This method 1" ); // method 2 if( debugger.DEBUG ) debugger.print_unchecked( "Or this method 2" ); } } I have read here that final booleans in Java will most likely be optimized out. However as in my setup the if-condition is inside another class and currently implemented as in print_checked(). Does Java also optimize away the function call (method 1) or do I have to rewrite everything as in method 2? EDIT #1: added static again
has answer: http://stackoverflow.com/a/24528749
has comment: http://stackoverflow.com/comment/37978179
tagged with: java
has comment: http://stackoverflow.com/comment/37978387
tagged with: optimization
type: Question
score: 0
has title: Java final boolean optimization
has comment: http://stackoverflow.com/comment/37978371
has comment: http://stackoverflow.com/comment/37979220
answer count: 3
has answer: http://stackoverflow.com/a/24527400
has comment: http://stackoverflow.com/comment/37982862
has comment: http://stackoverflow.com/comment/37977974
linked to: http://stackoverflow.com/q/7122723
has comment: http://stackoverflow.com/comment/37979479
has answer: http://stackoverflow.com/a/24527755
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37978192

http://stackoverflow.com/comment/37979278
has text: || can be different value, i can not use this logic, is there logic to get just values from the outermost not dependent on ||.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24527899
score: 0

http://stackoverflow.com/comment/38014181
comment on: http://stackoverflow.com/a/24546282
type: Comment
score: 2
has text: Large-scale simulations, where performance considerations outweigh "exact accuracy" considerations? I'd imagine that `double` precision is "good enough" for a lot of cases otherwise no one would use them...
type: AnswerComment

http://stackoverflow.com/q/24550779
type: Question
has body: I have a application with many bundles. It turns out that I need to use imports from may bundles and I get warning from maven that three is loop in bundles dependencies. The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='bundle1'}' and 'Vertex{label='bundle1'}' introduces to cycle in the graph ................. To solve the import issue is there any was to store Object in Apache Felix framework which I can insert and use it in every bundle?
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: apache-felix
tagged with: osgi
type: UnansweredQuestion
tagged with: java
upvote count: 1
has title: Store object in Felix framework
has answer: http://stackoverflow.com/a/24551604

http://stackoverflow.com/comment/37797239
type: QuestionComment
comment on: http://stackoverflow.com/q/24427847
score: 0
has text: Which version of eclipse you are using?
type: Comment

http://stackoverflow.com/comment/38055110
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24543794
has text: Thanks for your help. i am confused about why 'a'.equals('a') doesn't work. that should return true right?

http://stackoverflow.com/comment/37947047
type: Comment
score: 0
type: AnswerComment
has text: Thanks a lot! Your answer is not quite how I ended up doing it, but it helped a lot.
comment on: http://stackoverflow.com/a/24507112

http://stackoverflow.com/comment/38043309
has text: If you run again and again with x=25 you will see the same effect also, because you have race condition.
score: 0
comment on: http://stackoverflow.com/q/24561974
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38065582
score: 0
type: Comment
type: QuestionComment
has text: I've installed again after uninstalled the GAE plug-in in Eclipse.
comment on: http://stackoverflow.com/q/24565411

http://stackoverflow.com/a/24454437
accepted answer of: http://stackoverflow.com/q/24436194
has body: The Solution The initial goal was to print, from start to end, all of the paths that exit the array. An earlier rendition of the script wrote "0" on treaded locations rather than "2", but for some reason I imagined that I needed the "2" and I needed to differentiate between "treaded path" and "invalid path". In fact, due to the recursive nature of the problem, I discovered that you can in fact solve the problem writing only 0's as you go. Also, I no longer needed to keep track of where I came from and instead of checking clockwise over a matrix, I was iterating from left to right down the 3x3 matrix surrounding me, skipping my own cell. Here is the completed code for such a solution. It prints to console upon finding an exit (edge) and otherwise traces itself around the maze, complete with recursion. To start the function, you are given a square 2D array of 0's and 1's where 1 is a valid path and 0 is invalid. You are also given a set of coordinates where you are "dropped in" (locX, locY) and an empty string that accumulates coordinates, forming a path that is later printed out (String Path = "") Here is the code: static void Navigator(int locX, int locY, int[][] myArray, String Path) { int newX = 0; int newY = 0; Path = Path.concat("["+locX+","+locY+"]"); if ((locX == 0 || locX == myArray.length-1 || locY == 0 || locY == myArray[0].length-1)) {//Edge Found System.out.println(Path); pathCnt++; myArray[locX][locY] = 1; return; } for (int row = -1; row &lt;= 1; row++) { for (int col = -1; col &lt;= 1; col++) { if (!(col == 0 &amp;&amp; row == 0) &amp;&amp; (myArray[locX+row][locY+col] == 1)) { //Valid Path Found myArray[locX][locY] = 0; Navigator(locX+row, locY+col, myArray, Path); } } } //Dead End Found myArray[locX][locY] = 1; return; } System.out.println(Path); pathCnt++; swamp[locX][locY] = 1; return; } for (int row = -1; row &lt;= 1; row++) { for (int col = -1; col &lt;= 1; col++) { if (!(col == 0 &amp;&amp; row == 0) &amp;&amp; (swamp[locX+row][locY+col] == 1)) …
answers question: http://stackoverflow.com/q/24436194
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/37797691
comment on: http://stackoverflow.com/q/24429619
type: Comment
type: QuestionComment
has text: You should add the code of FormulaElement class, it would be easier to understand your problem
score: 0

http://stackoverflow.com/q/24471102
has comment: http://stackoverflow.com/comment/37874503
downvote count: 1
has comment: http://stackoverflow.com/comment/37874349
has answer: http://stackoverflow.com/a/24474014
favorite count: 0
has comment: http://stackoverflow.com/comment/37874362
has answer: http://stackoverflow.com/a/24471372
tagged with: time
type: UnansweredQuestion
has body: So Java 1.8 comes with a whole new (and old) bunch of classes to manage time calculations: java.time.Instant, java.time.LocalTime, java.time.temporal.ChronoUnit, and maybe more... But why is there no simple way to calculate the time difference between any of these? I would expect "time_later - time_earlier" to be the most used manipulation of time, but this is nowhere to be seen. I cannot subtract one LocalTime from the other and get a new LocalTime; I cannot subtract one Instant from the other to get a new Instant. Instead I have to fiddle with ChronoUnits.between, and long milliseconds and whatnots to achieve this very useful thing. Why is this? There has to be something going on that I do not get? Or I'm just daft...?
upvote count: 4
tagged with: java-8
answer count: 4
score: 3
has answer: http://stackoverflow.com/a/24473979
tagged with: java
has title: Java 1.8 time functionality
type: Question
has comment: http://stackoverflow.com/comment/37874610
tagged with: java-time
has comment: http://stackoverflow.com/comment/37891289
has comment: http://stackoverflow.com/comment/37874244
has comment: http://stackoverflow.com/comment/37874802
has answer: http://stackoverflow.com/a/26455535

http://stackoverflow.com/comment/37962787
has text: You're right, I just tested it client side and the values are completely the same. When it is being saved to Parse the value is changing. That is so strange.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24514758

http://stackoverflow.com/a/24484915
has comment: http://stackoverflow.com/comment/37961164
downvote count: 0
has comment: http://stackoverflow.com/comment/37959405
has comment: http://stackoverflow.com/comment/37902284
has comment: http://stackoverflow.com/comment/37960790
type: Answer
has body: as I mentioned in my comment there is really no need to further improvement. I did some measurements looped 1000000 times the whole thing measure time in [ms] ms / 1000000 = ns so single pass times [ns] are these: [176 ns] - exploit that even numbers are every third [179 ns] - &amp;1 instead of %2 [169 ns] - &amp;1 instead of %2 and eliminated if by -,^,&amp; [edit1] new code [105 ns] - exploit that even numbers are every third + derived double iteration of fibonaci [edit2] new code [76 ns] - decreased operand count to lower overhead and heap trashing the last one clearly wins on mine machine (although I would expect that the first one will be best) all was tested on Win7 x64 AMD A8-5500 3.2GHz App with no threads 32-bit compiler BDS2006 Trubo C++ 1,2 are nicely mentioned in Answers here already so I comment just 3: s+=a&amp;(-((a^1)&amp;1)); (a^1) negates lovest bit ((a^1)&amp;1) is 1 for even and 0 for odd a -((a^1)&amp;1)) is -1 for even and 0 for odd a -1 is 0xFFFFFFFF so anding number by it will not change it 0 is 0x00000000 so anding number by it will be 0 hence no need for if also instead of xor (^) you can use negation (!) but that is much slower on mine machine OK here is the code (do not read further if you want to code it your self): //--------------------------------------------------------------------------- int euler002() { // Each new term in the Fibonacci sequence is generated by adding the previous two terms. // By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... // By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. int a,a0=0,a1=1,s=0,N=4000000; /* //1. [176 ns] a=a0+a1; a0=a1; a1=a; // odd a=a0+a1; a0=a1; a1=a; // even for (;a&lt;N;) { s+=a; a=a0+a1; a0=a1; a1=a; // odd a=a0+a1; a0=a1; a1=a; // odd a=a0+a1; a0=a1; a1=a; // even } //2. [179 ns] for (;;) { a=a0+a1; a0=a1; a1=a; if (a&gt;=N) break; if ((a&amp;1)==0) s+=a; } //3. [1…
has comment: http://stackoverflow.com/comment/37953435
has comment: http://stackoverflow.com/comment/37901978
score: 1
answers question: http://stackoverflow.com/q/24483199
upvote count: 1
has comment: http://stackoverflow.com/comment/37959688

http://stackoverflow.com/comment/37801662
has text: See also [Deep clone utility recomendation](http://stackoverflow.com/questions/665860/deep-clone-utility-recomendation)
type: QuestionComment
comment on: http://stackoverflow.com/q/24432087
type: Comment
score: 0

http://stackoverflow.com/comment/38054319
type: Comment
type: QuestionComment
has text: What are you planning on doing on the MySQL side? Generally speaking, you don't want to call those functions over dates in columns, as it would invalidate the use of indices (ie, don't use for grouping for sales-by-week)...
score: 0
comment on: http://stackoverflow.com/q/24566831

http://stackoverflow.com/q/24578648
has title: Display an error message for the non-numeric input
has answer: http://stackoverflow.com/a/24578775
tagged with: java
answer count: 3
has body: So this is my code i dont know what to add if i want to display invalid message for the non numeric inputs please help ty import java.util.Scanner; public class Date { public static void main (String args []) { int x; Scanner in = new Scanner (System.in); System.out.print("Enter a date "); x = in.nextInt(); while (x &lt; 1520 || x &gt; 3999) { System.out.println ("Invalid Gregorian Calendar date."); System.out.print ("Please Input a valid Gregorian Calendar date: "); x = in.nextInt(); } System.out.println("Good");
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38074136
has answer: http://stackoverflow.com/a/24578678
favorite count: 0
score: -1
type: Question
has answer: http://stackoverflow.com/a/24579048
downvote count: 1

http://stackoverflow.com/a/24545589
has comment: http://stackoverflow.com/comment/38013173
type: Answer
has comment: http://stackoverflow.com/comment/38013942
has comment: http://stackoverflow.com/comment/38013001
accepted answer of: http://stackoverflow.com/q/24545239
has comment: http://stackoverflow.com/comment/38017440
has comment: http://stackoverflow.com/comment/38017827
has comment: http://stackoverflow.com/comment/38013445
has comment: http://stackoverflow.com/comment/38016982
upvote count: 10
has comment: http://stackoverflow.com/comment/38013115
has comment: http://stackoverflow.com/comment/38017786
has comment: http://stackoverflow.com/comment/38016889
type: AcceptedAnswer
score: 10
downvote count: 0
has comment: http://stackoverflow.com/comment/38038172
answers question: http://stackoverflow.com/q/24545239
has body: Make constructor private and provide createInstance method with the same attributes as constructor or factory method ? How does it helps ? Answer: making the constructor private and providing createInstance() (factory method) does not help by itself: it is one of few things you should do in order to allow users to actually use the class and its instances while you still have the control of the way instances are created. Make attributes final - the post fails to explain this point and somewhere I read to avoid the modification accidentally. How can you modify accidentally, when there are no mutators and class is final ? How making an attribute final is helping ? Answer: declaring a class as final means that the user can't extend it, so it "blocks" the user from this kind of "workaround". Declaring an attribute as final won't allow the user of the class to change it. It cannot be "modified accidentally", but it can be "modified viciously" using reflection. Let's see an example, say you have: final public class SomeClass { final Integer i = 1; } from another class you can do as follows: class AnotherClass { public static void main (String[] args) throws Exception { SomeClass p = new SomeClass(); Field i =p.getClass().getDeclaredField("i"); i.setAccessible(true); i.set(p, 5); System.out.println("p.i = " + p.i); // prints 5 } } Can instead of factory use builder pattern ? Answer: you can use the builder pattern or any pattern that helps you control the creation of instances of the class. Further: If you want to make sure your class is immutable, make sure that any getter returns a deep-copy of the class member. This technique is called "protective/defensive copy". You can read more about it here
has comment: http://stackoverflow.com/comment/38017658

http://stackoverflow.com/a/24434782
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24434666
has comment: http://stackoverflow.com/comment/37831822
type: Answer
has comment: http://stackoverflow.com/comment/37816628
has body: You can ftp your job using Java. Which you can add into your Selenium test http://www.ibm.com/developerworks/systems/library/es-batch-zos.html If FTP isnt open on your firewall try telnet
score: 0
accepted answer of: http://stackoverflow.com/q/24434666

http://stackoverflow.com/a/24516048
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37957173
has body: That property indicates where Eclipse is storing the server's configuration metadata. By default, Eclipse hides those details from you, but the button allows you to change it so you can view (or potentially edit) it. From the Eclipse help pages (http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.wst.server.ui.doc.user%2Ftopics%2Ftmetasrv.html): On the workbench, you have the option to display or hide the metadata of the server. The metadata contains a variety of information about the server such as: The location where the server configuration files are stored on the workbench. The fully qualified DNS name or IP address of the host machine where the server is running. The name assigned to the server. The name of the installed server runtime environment which defines the runtime environment of an application server for compiling your application. By default, the workbench hides the metadata of the server to keep the development workspace clean. Displaying the metadata of the server on the workbench, allows you to persist the data of the server in a serverName.server file, where serverName is the name assigned to the server. The serverName.server file is useful when you are working in a team development environment and you are required to maintain the metadata of the server in a source control repository. To display or hide the metadata of the server: In the Servers view, right-click the server you want to display or hide the metadata and select Properties. In the General page there is a Location field, select the Switch location button to toggle between displaying and hiding the metadata on the workbench. Tip: If the value of the Location field contains [workspace metadata], this means the workbench is hiding the metadata. To display the metadata on the workbench, select the Switch location button again until the [workspace metadata] changes to a file path directory. The file path directory specifies the location where the server metadata file is stored on th…
answers question: http://stackoverflow.com/q/24515798
downvote count: 0
has comment: http://stackoverflow.com/comment/37957432
type: Answer
has comment: http://stackoverflow.com/comment/37957285

http://stackoverflow.com/a/24570878
has comment: http://stackoverflow.com/comment/38059963
score: 0
type: Answer
has body: Is that JSON ? If so, I would much rather use the appropriate parser and its API rather than trying to come up with a regexp to handle a well-defined grammar.
answers question: http://stackoverflow.com/q/24570807

http://stackoverflow.com/comment/37882245
type: QuestionComment
comment on: http://stackoverflow.com/q/24474978
score: 0
has text: Okay. Got the idea. I'm trying to switch to the iframe. Problem is: part of the iframe id is generated when loading the page. So when I try to do `driver.switchTo().frame("DetailTab-ext-gen23-810870");` it fails, because the last sequence (810870) is now different.
type: Comment

http://stackoverflow.com/comment/37846972
type: QuestionComment
comment on: http://stackoverflow.com/q/24456001
has text: @Jens - removed it from build path. Now the error is `The import com.mockobjects cannot be resolved`
score: 0
type: Comment

sqlite
tags question: http://stackoverflow.com/q/24430061
tags question: http://stackoverflow.com/q/24468614
tags question: http://stackoverflow.com/q/24578331
tags question: http://stackoverflow.com/q/24488922
tags question: http://stackoverflow.com/q/24433625
type: Tag
tags question: http://stackoverflow.com/q/24545017
tags question: http://stackoverflow.com/q/24513576
tags question: http://stackoverflow.com/q/24549425
tags question: http://stackoverflow.com/q/24458931
tags question: http://stackoverflow.com/q/24430683
tags question: http://stackoverflow.com/q/24512414
tags question: http://stackoverflow.com/q/24454297
tags question: http://stackoverflow.com/q/24535493
tags question: http://stackoverflow.com/q/24541603
tags question: http://stackoverflow.com/q/24546749
tags question: http://stackoverflow.com/q/24572805
tags question: http://stackoverflow.com/q/24530299
tags question: http://stackoverflow.com/q/24528597
tags question: http://stackoverflow.com/q/24464327
tags question: http://stackoverflow.com/q/24548599
tags question: http://stackoverflow.com/q/24536056
tags question: http://stackoverflow.com/q/24556715
tags question: http://stackoverflow.com/q/24525750
tags question: http://stackoverflow.com/q/24484662
tags question: http://stackoverflow.com/q/24515275
tags question: http://stackoverflow.com/q/24477987
tags question: http://stackoverflow.com/q/24522519
tags question: http://stackoverflow.com/q/24528146
tags question: http://stackoverflow.com/q/24570471
tags question: http://stackoverflow.com/q/24548258
tags question: http://stackoverflow.com/q/24447880
tag name: sqlite
tags question: http://stackoverflow.com/q/24564976

http://stackoverflow.com/a/24561594
score: 1
answers question: http://stackoverflow.com/q/24561504
upvote count: 1
downvote count: 0
type: Answer
has body: Since you print the values right after you start the threads, you're not going to "catch" the threads in the middle of the for loops. The thread scheduler is returning control to the main thread sometimes after the threads are done and sometimes before they start, but never during run(). You have to wait until the threads are done.

http://stackoverflow.com/comment/52620408
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25575215
score: 0
has text: Well that helps. Deleted the temp build directory and my error was gone.

indexoutofboundsexception
tags question: http://stackoverflow.com/q/24534505
tags question: http://stackoverflow.com/q/24432812
tag name: indexoutofboundsexception
tags question: http://stackoverflow.com/q/24500048
type: Tag

http://stackoverflow.com/q/24473006
type: AnsweredQuestion
tagged with: android-layout
accepted answer: http://stackoverflow.com/a/24473077
tagged with: java
tagged with: android-linearlayout
possible better answer: http://stackoverflow.com/a/24474714
answer count: 2
has answer: http://stackoverflow.com/a/24473077
has answer: http://stackoverflow.com/a/24474714
has title: A relative and linear layout placing issue
score: 0
tagged with: android
tagged with: android-activity
has body: <RelativeLayout android:id="@+id/layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:weightSum="1" > i am trying to align the codes here in a row. it being the relative layout as the parent and 3 linear layout as the child. My java codes would generate text view and 2 edit text as the child of the linear layout and display it in a row. however, it turned out vertical stacking on top of each other
type: Question

http://stackoverflow.com/comment/37885616
has text: I presume you are trying to sound grateful, while actually making a sideways criticism. So to hell with you, you were the one that wanted tips and those 7 tips came to within 2 characters of the limit for comments.
comment on: http://stackoverflow.com/q/24476216
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24546683
type: Answer
answers question: http://stackoverflow.com/q/24546612
downvote count: 0
score: 1
has body: First: Never do so } catch (SQLException e) { // do nothing } Add a e.printStackTrace() to the catch block. I think you get an exception when you do so. You may need a second statement variable.
upvote count: 1

http://stackoverflow.com/q/24585747
has body: I am trying to connect to glassfish server but everytime I run the pre written program I get this error. I have followed installation of netbeans and glassfish 3 correctly and have set up the server so I'm out of ideas. The error is below. Thanks a lot! java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) Can't join the chat roomjava.net.ConnectException: Connection refused: connect at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.&lt;init&gt;(Socket.java:425) at java.net.Socket.&lt;init&gt;(Socket.java:241) at guiclient.ChatRoom.&lt;init&gt;(ChatRoom.java:30) at guiclient.GuiChatClientMain.main(GuiChatClientMain.java:17)
score: 0
answer count: 1
tagged with: netbeans-8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24585965
has title: Glass Fish 3 connection refused - Netbeans IDE 8
tagged with: glassfish-3
tagged with: java
type: Question

http://stackoverflow.com/comment/37932683
type: QuestionComment
comment on: http://stackoverflow.com/q/24502028
has text: I know your problem man...sometimes we gets the html page contents in response....so if you are getting this then this is the error from server side...they are not sending data in proper way...please contact to your server side developer...
score: 0
type: Comment

http://stackoverflow.com/comment/78320740
has text: Total disaster. You'll get the item clicked position of the item which was just blinded not the item you click
type: Comment
comment on: http://stackoverflow.com/a/26701352
score: 1
type: AnswerComment

http://stackoverflow.com/q/24463022
tagged with: java
has answer: http://stackoverflow.com/a/24472849
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24472849
has body: My remote (Linux) and local (windows) node both use the same jdk version 1.7.0_45 and gridgain 6.0.3 and peer-class loading is enabled. But I get the folowing: Caused by: java.lang.ClassNotFoundException: Optimized stream class checksum mismatch (is same version of marshalled class present on all nodes?) [expected=-3449, actual=7739, cls=class java.io.FileDescriptor] at org.gridgain.grid.marshaller.optimized.GridOptimizedClassResolver.readClass(GridOptimizedClassResolver.java:345) Local node console has log: visor&gt; [20:50:12] Local node's library list differs from remote node's [20:50:12] &lt;commons-lang-2.6.jar&gt; vs. &lt;not jar or zip file&gt; [20:50:12] &lt;guava-14.0.1.jar&gt; vs. &lt;guava-15.0.jar&gt; [20:50:12] &lt;javax.servlet-api-3.0.1.jar&gt; vs. &lt;servlet-api-2.4.jar&gt; [20:50:12] &lt;jcommander-1.30.jar&gt; vs. &lt;jcommander-1.27.jar&gt; [20:50:12] &lt;log4j-1.2.16.jar&gt; vs. &lt;log4j.jar&gt; [20:50:12] Code public final class GG_HelloWorld { public static class GridCmd extends Command&lt;GridEvt&gt; { @Override protected void executeImpl() throws CommandException, InterruptedException { final GridConfiguration config = getEvent().getConfig(); // task GridComputeTask&lt;String, Integer&gt; task = new GridComputeTaskSplitAdapter&lt;String, Integer&gt;() { @NotNull @Override protected Collection&lt;? extends GridComputeJob&gt; split(int gridSize, @NotNull String arg) { Collection&lt;GridComputeJob&gt; jobs = new LinkedList&lt;&gt;(); for (final String word : arg.split(" ")) { jobs.add(new GridComputeJobAdapter() { @Nullable @Override public Object execute() { X.println("&gt;&gt;&gt;"); X.println("&gt;&gt;&gt; Printing '" + word + "' on this node from grid job."); X.println("&gt;&gt;&gt;"); // Return number of letters in the word. return word.length(); } }); } return jobs; } @Nullable @Override public Integer reduce(@NotNull List&lt;GridComputeJobResult&gt; results) { return results.size() - 1 + F.sumInt(F.&lt;Integer&gt;jobResults(results)); }…
possible better answer: http://stackoverflow.com/a/24485676
score: 0
has answer: http://stackoverflow.com/a/24485676
tagged with: gridgain
type: AnsweredQuestion
has title: ClassNotFoundException: stream class checksum mismatch

http://stackoverflow.com/comment/37931222
has text: So if I only had a list of clients like so: jsonString = [{"name" : "client 1","id" : 1},{"name" : "client 2","id" : 2}], then I could just do: HashMap[] values = new ObjectMapper().readValue(jsonString, new TypeReference[]>() {}); to get what I want. I am basically asking if there is a way using Jackson methods to get the jsonString above from the JSON in the original question. I know I can easily do it with this example with string parsing but there will be more complex situations in the future and string parsing is not really considered best practice.
score: 0
comment on: http://stackoverflow.com/q/24501372
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24480560
tagged with: android-arrayadapter
has title: java.lang.IndexOutOfBoundsException during adapter filtering
has comment: http://stackoverflow.com/comment/37892246
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: This part of the code is supposed to filter through the objects in the adapter and remove or add objects in the listview depending on the user input. However when I try to put in any letter I get an error saying: java.lang.IndexOutOfBoundsException: Invalid index 5, size is 5 or similar depending on the input in the EditText. I don't understand what causes this. Here is the code: import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Filter; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import nick.miros.BudgetControl.budgetcontrol.app.Currency; import nick.miros.BudgetControl.budgetcontrol.app.R; public class CurrencyAdapter extends ArrayAdapter&lt;Currency&gt; { private final Context context; private List&lt;Currency&gt; currencies; private CurrencyFilter currencyFilter; public CurrencyAdapter(Context context, List&lt;Currency&gt; currencies) { super(context, R.layout.list_currency, currencies); this.context = context; this.currencies = currencies; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_currency, parent, false); TextView currencyName = (TextView) rowView.findViewById(R.id.currencyName); TextView currencySymbol = (TextView) rowView.findViewById(R.id.currencySymbol); currencyName.setText(currencies.get(position).getCurrencyName()); currencySymbol.setText(currencies.get(position).getSymbol()); return rowView; } @Override public Filter getFilter() { if (currencyFilter == null) currencyFilter = new CurrencyFilter(); return currencyFilter; } private class CurrencyFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults(); // We impl…
tagged with: filtering

http://stackoverflow.com/q/24437184
accepted answer: http://stackoverflow.com/a/24437860
score: 0
tagged with: xml-parsing
answer count: 1
has body: I am using GWT XML Parser to parse an xml file on my app. I am following this example: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsXML.html But I get a error during class cast. Here is the stack trace: ERROR: Failed to create an instance of 'xds.metadata.editor.client.editor.DocumentModelEditorView' via deferred binding java.lang.ClassCastException: com.google.gwt.xml.client.impl.ElementImpl cannot be cast to com.google.gwt.user.client.Element And here are my sources: Document dom= XMLParser.parse(PreParse.getInstance() .doPreParse(AppResources.INSTANCE.codes().getText())); List&lt;CodedTerm&gt; classCodes=new ArrayList&lt;CodedTerm&gt;(); NodeList nodes= dom.getElementsByTagName("CodeType"); if (predefinedCodes.equals(PredefinedCodes.CLASS_CODES)){ if (classCodes.size()==0) { int index = 0; // it is during the next line I get my error while (!((Element) nodes.item(index)).getAttribute("name").equals("classCode")) { index++; } // .... } } Can anybody explain to me why I get this classCastException whereas they do exactly the same thing in gwt-project sample code? Thank you.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24437860
tagged with: java
has title: Issue with GWT XML Parser using cast to Element
type: Question
tagged with: gwt

http://stackoverflow.com/q/24450815
answer count: 1
has comment: http://stackoverflow.com/comment/37837698
favorite count: 0
has title: Google in-app billing library isn't showing in SDK Mananger
has body: I recently downloaded and installed Eclipse Java EE IDE: . I made a simple application that runs well on my device ; now I want to publish the app . I am not able to see the in-app billing library in the extras section of the sdk manager. I was told it was found in the SDK manager under "Extras". I proceeded in Eclipse to Window > Android SDK Manger. I waited for it get done fetching and then went to "Extras". Making sure "Updates/New" was checked as well as "Installed"; however, under the "Extras" tab is "Android Support Package" , "Google Play service" , "Google USB driver", "Intel emulator" and in-app billing library is missing . And so here I am ... stuck on what I need to do. Any help would be greatly appreciated.
tagged with: android
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25052639
tagged with: eclipse
type: Question
downvote count: 0

http://stackoverflow.com/q/24524308
score: 0
answer count: 1
has title: How to workaround jbehave bug when combining meta parameters and example table
has comment: http://stackoverflow.com/comment/37982029
has body: I'm using project made from 0.9.229 thucydides-jbehave archetype. Here I have some jbehave story: Narrative: Some text Meta: @registrator1 666-126 @registrator2 666-127 @reg1 666126 @reg1 666127 @ip 172.16.1.2 @zone1 666-126-666-127 Scenario: A Given the user is logged to zonemanager as 'admin' with password 'admin' Scenario: B Then user creates new registrator &lt;registrator1&gt; with IP &lt;ip&gt; Then user creates new registrator &lt;registrator2&gt; with IP &lt;ip&gt; Scenario: C Then user creates new bunch with 'Тестовый участок' And user creates new zone with 'Тестовая зона','Встречное', '60' And user selects &lt;registrator1&gt; for first new point 'Тестовая 666126' with latitude '55.730229', longitude '48.921177' And user selects &lt;registrator2&gt; for second new point 'Тестовая 666127' with latitude '55.710411', longitude '48.896223' And user completes the zone creation Scenario: D Given the user is logged to adminconsole as 'admin' with password 'password' And the user switches to zones Then the user adds &lt;registrator1&gt; into adminconsole with region 'Татарстан', code &lt;zone1&gt;, location &lt;zone1&gt;, location code &lt;zone1&gt; And the user switches to services And the user adds service for &lt;registrator1&gt; And the user exits adminconsole Scenario: E Given the ftp server is started Scenario: F Given the folder structure is created for &lt;reg1&gt; And the folder structure is created for &lt;reg2&gt; And the first registrator has number &lt;reg1&gt; name &lt;registrator1&gt; latitude '55.730229', longitude '48.921177' height '79.099998' deltafix '10' type 'TEXT' version '4.0' And the second registrator has number &lt;reg2&gt; name &lt;registrator2&gt; latitude '55.710411', longitude '48.896223' height '79.090098' deltafix '10' type 'TEXT' version '4.0' When the first registered number is &lt;number&gt; priority zone '1' lane number '1' lane type '2' movement direction '1' light '1' valid time '1' And car goes &lt;speed&gt; km/h from latitu…
tagged with: jbehave
tagged with: atdd
accepted answer: http://stackoverflow.com/a/26943612
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: thucydides
has answer: http://stackoverflow.com/a/26943612
tagged with: tdd

http://stackoverflow.com/q/24532734
has comment: http://stackoverflow.com/comment/37988722
tagged with: wildfly-8
has comment: http://stackoverflow.com/comment/37989078
has comment: http://stackoverflow.com/comment/38016000
has comment: http://stackoverflow.com/comment/37988866
tagged with: hikaricp
score: 0
has comment: http://stackoverflow.com/comment/38014734
has comment: http://stackoverflow.com/comment/38015413
answer count: 1
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/37988582
has comment: http://stackoverflow.com/comment/37998530
has answer: http://stackoverflow.com/a/24569526
has comment: http://stackoverflow.com/comment/38015840
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I built a DAL jar library which uses HikariCP as the connection provider. This jar is then included (as a Maven dependency) in a web application. I tested this web application onto a Wildfly 8.0.0 application server and all works as expected: the deployment process ends without problems and I can access the DB with the web app. The problem raises when I run the same web application onto a JBoss Application Server 7.1. In fact, the deployment process ends with the following exception stack http://pastebin.com/qQh5EW1N Here is the persistence.xml confgured in the DAL <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence NONE <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/> <property name="hibernate.connection.provider_class" value="com.zaxxer.hikari.hibernate.HikariConnectionProvider"/> <property name="hibernate.hikari.maximumPoolSize" value="100"/> <property name="hibernate.hikari.minimumIdle" value="20"/> <property name="hibernate.hikari.idleTimeout" value="30000"/> <property name="hibernate.hikari.dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/> <property name="hibernate.hikari.dataSource.url" value="jdbc:mysql://URL:3306/DB"/> <property name="hibernate.hikari.dataSource.user" value="user"/> <property name="hibernate.hikari.dataSource.password" value="pwd"/> <property name="hibernate.archive.autodetection" value="class" /> And here is the pom.xml of the DAL 4.0.0 my.dal dal 0.0.4-SNAPSHOT jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <java.version>1.7</java.version> com.mysema.querydsl querydsl-core 3.3.2 com.mysema.querydsl querydsl-apt 3.3.2 com.mysema.querydsl querydsl-jpa 3.3.2 log4j log4j 1.2.16 org.jglue.cdi-unit cdi-unit 3.0.1 test junit junit 4.11 javax javaee-api 6.0 org.hibernate hibernate-core 4.3.5.Final org.hibernate.common hibernate-commons-annotations 4.0.4.Final javax.enterprise cdi-api 1.1 org.hibernate.javax.persistence hibernate-jpa-2…
type: Question
has title: HikariConnectionProvider ClassNotFoundException when deploying to JBoss Application Server 7.1
accepted answer: http://stackoverflow.com/a/24569526

http://stackoverflow.com/comment/37871100
has text: are you sure with hbm file path `/login.hbm.xml`? can show your project directory structure?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24467384
score: 0

http://stackoverflow.com/comment/37897098
comment on: http://stackoverflow.com/q/24483093
has text: move all your TextView declarations inside your onCreate (TextView totalView = (TextView) findViewById(R.id.totalColumn2);)
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/38015152
comment on: http://stackoverflow.com/q/24546966
type: Comment
score: 0
has text: give your fully qualified path instead
type: QuestionComment

http://stackoverflow.com/q/24558120
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24559230
has comment: http://stackoverflow.com/comment/38036766
has comment: http://stackoverflow.com/comment/38036888
has comment: http://stackoverflow.com/comment/38036437
tagged with: backtracking
has title: Knights tour - results in an infinite loop and i can't figure out why
upvote count: 2
has body: I'm trying to solve the knight's tour problem using backtracking. I think the algorithm I have should work. I've tried but I can't figure out why it isn't working. It results in an infinite loop. However if I comment out the line that back track solutionBoard[dst.x][dst.y]=-1; it works! I just don't understand why! Any help would be appreciated. private int solutionBoard[][] = new int [8][8]; // The eight possible moves a knight can make from any given position private static final Point[] MOVES = new Point[] { new Point(-2, -1), new Point(-2, 1), new Point(2, -1), new Point(2, 1), new Point(-1, -2), new Point(-1, 2), new Point(1, -2), new Point(1, 2) }; private int count = 0; public KnightsTour_DFS(){ // board is 0- 7 //initialize visited for(int i =0; i&lt;8;i++){ for(int j = 0; j&lt; 8; j++){ solutionBoard[i][j] = -1; } } solutionBoard[0][0]=count++; if(findTour(0, 0)){ System.out.println("Tour found!!"); printSolution(); } } public boolean findTour(int x, int y){ if(x &lt;0 || y &lt;0 || x&gt;7 || y &gt; 7 ){ return false; } if(count == 64){ //we've covered all node return true; } for(int i = 0; i &lt; this.MOVES.length; i++){ Point dst = new Point(x + MOVES[i].x, y + MOVES[i].y); if(canMove(dst)){ solutionBoard[dst.x][dst.y]=count++; if(findTour(dst.x, dst.y)){ System.out.println("Solution shown on board\n"); return true; } else{ count --; solutionBoard[dst.x][dst.y]=-1; } } } return false; } private void printSolution() { System.out.println("Solution shown on board\n"); for (int[] rows : solutionBoard) { for (int r : rows) { System.out.printf("%2d ", r); } System.out.println(); } } public boolean canMove(Point destination){ if(destination.x&lt;0 || destination.y&lt;0 || destination.x&gt;7|| destination.y&gt;7){ return false; } if(solutionBoard[destination.x][destination.y] != -1){ //already visited return false; } return true; }
tagged with: depth-first-search
has comment: http://stackoverflow.com/comment/38042652
has comment: http://stackoverflow.com/comment/38037592
type: Question
has comment: http://stackoverflow.com/comment/38037914
score: 2
has comment: http://stackoverflow.com/comment/38036471
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38036695
tagged with: algorithm
has answer: http://stackoverflow.com/a/24559230
has comment: http://stackoverflow.com/comment/38037310
tagged with: java
has comment: http://stackoverflow.com/comment/108047067
has comment: http://stackoverflow.com/comment/38036657
has comment: http://stackoverflow.com/comment/38036636
has comment: http://stackoverflow.com/comment/38036389
linked to: http://stackoverflow.com/q/21511683
tagged with: knights-tour

http://stackoverflow.com/comment/37807569
type: QuestionComment
score: 0
has text: Yeah I've been wondering is there any way to restrict the number of input events per frame to prevent it hindering the performance? Each frame in my game has fixed 30ms duration. Sorry if it's a stupid question, I've searched online but I couldn't find an answer.
comment on: http://stackoverflow.com/q/24433595
type: Comment

http://stackoverflow.com/q/24433202
tagged with: web-applications
has answer: http://stackoverflow.com/a/24433663
has comment: http://stackoverflow.com/comment/37804051
tagged with: com4j
tagged with: java
type: Question
tagged with: weblogic
tagged with: dll
score: 0
has body: I'm developing a java Web Application, which uses a com4j library to connect to, and extract data from an external database. My application work seamlessly on my localhost, which runs a maven/jetty setup. However, I need the application to be hosted on a WebLogic server, which i am not the admin of. When deploying and starting the web-app there, I get an unsatisfied link exception, as shown below. I have been trying numerous suggested solutions to similar problems, without any luck. The errors have been changing slightly from time to time, but mostly the same. All of the suggested solutions I have found, can be boiled down to three suggestions, found on this site: https://com4j.java.net/deployment.html It should work automatically when you package the jar: It does not. The jar is definitely in the war-file, and the dll is inside the .jar but still the same exception occurs. Place com4j.dll in the same directory as com4j.jar: Does absolutely nothing to the error message. Set the system property java.library.path to include the directory where com4j.dll resides: The error changed to .dll is already loaded in another ClassLoader. i've tried one at the time, all at once, and different combinations of the above. I do not expect a wizard to swoop down and tell me exactly what to do here, but I would love some help finding another angle of attack to this problem. &lt;11-06-2014 15:23:34 CEST&gt; &lt;Error&gt; &lt;Deployer&gt; &lt;BEA-149265&gt; &lt;Failure occurred in the execution of deployment request with ID '1402493014299' for task '158'. Error is: 'weblogic.application.ModuleException: Unable to load com4j.dll' weblogic.application.ModuleException: Unable to load com4j.dll at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1401) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:460) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState…
has title: Why can't my WebLogic server find the *.dll, other than whan it is already loaded in another classloader?
has comment: http://stackoverflow.com/comment/37804150
answer count: 1
has comment: http://stackoverflow.com/comment/37804880
type: UnansweredQuestion

http://stackoverflow.com/q/24528729
tagged with: spring
type: Question
tagged with: saml
tagged with: java
has answer: http://stackoverflow.com/a/24537204
answer count: 1
has body: I am newly working with CXF STS and came across below requirements, which I am unable to proceed 1 How can the DefaultSecurityTokenServiceProvider from CXF STS provide SAML assertion of different versions say 1.1 or 2.0 . I have an assumption on it.Please correct me if am wrong. The bean property for DefaultSecurityTokenServiceProvider:services <property name="services" ref="myServiceList" /> <property name="endpoints" ref="wspAllowedEndpoints" /> <util:list id="wspAllowedEndpoints"> http://localhost:8080/doubleit/services/doubleit.* </util:list> It requests the wsdl for all allowed services, reads the policy element, <sp:RequestSecurityTokenTemplate> <t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</t:TokenType> <t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey</t:KeyType> <t:KeySize>256</t:KeySize> </sp:RequestSecurityTokenTemplate> ans based on SAMLV1.1 or SAMLV2.0 it determines which version of SAML assertion to be sent in response 2 How can I read the SAML assertion from org.apache.cxf.ws.security.trust.STSClient as text **saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="s2b7afe8e21a0910d027dfbc94ec4b862e1fbbd9ab" IssueInstant="2007-12-10T11:39:48Z"** so I can put them in header and work with SOAPUI as client?
tagged with: x509certificate
has title: cxf DefaultSecurityTokenServiceProvider response based on SAML version
tagged with: cxf
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/38084564
type: QuestionComment
has text: Yes i read the Are java primitive ints atomic by design or by accident? but I was not sure thats why i asked explicit if "getfield", "iload_1" is atomic
comment on: http://stackoverflow.com/q/24584295
score: 0
type: Comment

http://stackoverflow.com/comment/38077948
type: Comment
comment on: http://stackoverflow.com/a/24580569
score: 0
type: AnswerComment
has text: You can try the second hint I provided

http://stackoverflow.com/comment/37842978
type: Comment
comment on: http://stackoverflow.com/a/24450714
score: 0
has text: @JakeGrim It seems like your code, the one you've posted in the question, is situated in a method. In this case, your method does want something to return. Read this for more clarity: http://www.homeandlearn.co.uk/java/java_methods.html
type: AnswerComment

http://stackoverflow.com/q/24455922
tagged with: android
upvote count: 1
tagged with: android-intent
answer count: 1
has body: I'm trying to pass info from an activity to a service. i'm getting a null pointer exception in the logcat. I'm new to this but i remember reading on SO that it's because intent.getStringExtra is null in the service. I'm not sure that's the case. Can someone please tell me what the actual problem is because i've tried everything. we can't use Bundle extras = this.getIntent().getExtras(); so how else can we solve this problem . below is what i have in the activity flashButton1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub strobeDIV++; try { Intent i1 = new Intent(LeLauncher.this, FlashServ.class); Bundle b = new Bundle(); totalMS = String.valueOf(totalMilli); cdMS = String.valueOf(totalMilli); strobeDIVString =String.valueOf(strobeDIV); b.putString("totalTimeMilli", totalMS); b.putString("cdTimeMilli", cdMS); b.putString("strobeDIV", strobeDIVString); i1.putExtra("totalTimeMilli", totalMilli); i1.putExtra("cdTimeMilli", cdMilli); i1.putExtra("strobeDIV", strobeDIV); i1.putExtras(b); LeLauncher.this.startService(i1); flashText1.setText("Seconds Left: 1"); } catch (Exception e1) { e1.printStackTrace(); } } }); below is what i have in the service. @Override public int onStartCommand(Intent intent, int flags, int startId) { //String totalTimeMilli182 = intent.getStringExtra("totalTimeMilli"); //String cdTimeMilli182 = intent.getStringExtra("cdlTimeMilli"); //String strobeDIVstring182 = intent.getStringExtra("strobeDIV"); Bundle b=intent.getExtras(); String totalTimeMilli182 = b.getString("totalTimeMilli"); String cdTimeMilli182 = b.getString("cdlTimeMilli"); String strobeDIVstring182 = b.getString("strobeDIV"); fooTimeTotal = Integer.parseInt(totalTimeMilli182); fooCDTotal = Integer.parseInt(cdTimeMilli182); strobeDIV = Integer.parseInt(strobeDIVstring182); strobeTimer182(); return START_STICKY; }
has title: How to send data via intent from an Activity to Service - Null Pointer Issue
tagged with: java
downvote count: 0
type: UnansweredQuestion
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24456061
has comment: http://stackoverflow.com/comment/37846047
score: 1
tagged with: service
favorite count: 0
type: Question

http://stackoverflow.com/a/26108826
type: Answer
has body: We solved this issue by just setting useLocalSessionState=true in the connection string. The below link explain the details of ReadOnly related changes happened from Mysql5.6 and the java connector 5.1.23. http://dev.mysql.com/doc/relnotes/connector-j/en/news-5-1-23.html
has comment: http://stackoverflow.com/comment/53476173
answers question: http://stackoverflow.com/q/24563385
has comment: http://stackoverflow.com/comment/72264658
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24563385
score: 8
upvote count: 8

http://stackoverflow.com/comment/37812348
type: QuestionComment
comment on: http://stackoverflow.com/q/24437784
score: 1
has text: Leaving aside whether or not your implementation works, I'd recommend [the Initialization-on-demand holder idiom](http://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom) instead due to its simplicity and efficiency.
type: Comment

http://stackoverflow.com/q/24432851
tagged with: soap
type: UnansweredQuestion
tagged with: java
tagged with: web-services
type: Question
score: 0
answer count: 1
tagged with: wsdl
has body: I would like to write some code in Java, which will be generate examples SOAP request for given WSDL files. The code below do it for every opperation of web services, but instead of example data in SOAP request. I have question mark. I don't need execute request, but only write this request. I know that it is possible(like in SoapUi) but I don't know how I can do it. I'll be grateful for Yours help. Best regards. Lukasz import com.eviware.soapui.impl.wsdl.*; public class Main { public static void main(String[] args) { WsdlProject project = new WsdlProject(); WsdlInterface[] wsdls = WsdlImporter.importWsdl(project, "sample.wsdl"); WsdlInterface wsdl = wsdls[0]; for (Operation operation : wsdl.getOperationList()) { WsdlOperation op = (WsdlOperation) operation; WsdlRequest request = op.addNewRequest("My Request"); System.out.println("#" + op.getName() + "#\n" + op.createRequest(true)); } } }
has answer: http://stackoverflow.com/a/25323186
has title: How to generate example SOAP request with SoapUI in java

http://stackoverflow.com/q/24466932
type: Question
answer count: 2
downvote count: 0
tagged with: javascript
favorite count: 0
tagged with: drag-and-drop
has answer: http://stackoverflow.com/a/24484404
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24564608
has body: I use the example here: https://gwt-dnd.appspot.com/#InsertPanelExample with only one column. The column is a VerticalPanel which contains many Widgets. Using the VerticalPanelDropController I can register: @Override public void onDrop(DragContext context) { super.onDrop(context); final Widget widget = context.draggable; final int newIndex = columnPanel.getWidgetIndex(widget); } @Override public void onPreviewDrop(DragContext context) throws VetoDragException { super.onPreviewDrop(context); int newIndex = ??? } in onDrop() I can get the new position of a widget in the columnPanel with columnPanel.getWidgetIndex(widget) but in onPreviewDrop() I cannot do it because the widget is not inside the columnPanel at this time. How do I get the target index where a dropped Widget should be dropped into the columnPanel in onPreviewDrop()? I want to know where the widget should be inserted before it is inserted. This way I can cancel the insertion.
score: 2
possible better answer: http://stackoverflow.com/a/24484404
upvote count: 2
has title: How do I get the index of a Widget in onPreviewDrop() in a VerticalPanel?
tagged with: gwt
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24564608

http://stackoverflow.com/q/24579288
has comment: http://stackoverflow.com/comment/38075450
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38075600
has comment: http://stackoverflow.com/comment/38075468
has title: How to stop a countdown "Timer" in Java?
has comment: http://stackoverflow.com/comment/38075345
has comment: http://stackoverflow.com/comment/38076523
has body: I'm trying to make a countdown timer for a educational game that I'm creating (just for studying purposes), but I'm having a little problem. Summarizing, I just need a timer that: Make a 10 seconds countdown. Stop when it reaches 0 seconds. Throw an exception when it stop (that will be detected by my "View", to show a message to user). My game have a lot of problems to be solved, each of them must be solved before 10 seconds. I've created a class called "Chronometer" for take care of the problems of my game, but I don't know how I can stop it and throw the desired exception (by the way, this is the best way to contact my view?). Currently it counts from 10 to 0, but instead stop, it continues and next time it counts from 59 to 0 - and it never stop. How can I fix that? Current code: public class Chronometer { private Timer chronometer; private DateFormat format = new SimpleDateFormat("ss"); private Calendar calendar = Calendar.getInstance(); private final byte countType; public static final byte PROGRESSIVE = 1; public static final byte REGRESSIVE = -1; public Chronometer(int years, int months, int days, int hours, int minutes, int seconds, byte countType) { this.chronometer = new Timer(); calendar.set(years, months, days, hours, minutes, seconds); this.countType = countType; } public void starts_chronometer(){ TimerTask task = new TimerTask() { public void run() { System.out.println(getTime()); } }; chronometer.scheduleAtFixedRate(task, 0, 1000); this.chronometer = null; } public int getTime() { calendar.add(Calendar.SECOND, countType); return Integer.parseInt(format.format(calendar.getTime())); } } Tried this to throw an exception: (failed, it throws the exception at the same time chronometer starts.) public void starts_chronometer() throws Exception { TimerTask task = new TimerTask() { public void run() { System.out.println(getTime()); } }; chronometer.scheduleAtFixedRate(task, 0, 1000); this.chronometer = null; throw new Exception("The time's over!"); } Tried th…
has comment: http://stackoverflow.com/comment/38075374
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24580463
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/24580380
tagged with: countdown
tagged with: timer
type: Question
has comment: http://stackoverflow.com/comment/38075427
answer count: 2

http://stackoverflow.com/q/24528571
favorite count: 0
tagged with: postgresql
has title: Unable to Configure EntityManagerFactory - JPA
type: UnansweredQuestion
tagged with: openshift
has comment: http://stackoverflow.com/comment/37980863
tagged with: gwt
has comment: http://stackoverflow.com/comment/37981777
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I have an application developed in GWT + Errai using Postgres as backend, deployed in jboss7. I have recently migrated the whole application from one Openshift (Origin) instance to another with rhc client. And then manually restored the dump of database with sftp. The application migrated successfully, But I m unable to login to my application . I ve tailed the logs on server and It gives me following Exception. org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking endpoint at org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:61) at org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:22) at org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54) at org.jboss.errai.cdi.server.CDIExtensionPoints$2.callback(CDIExtensionPoints.java:494) at org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47) at org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:293) at org.jboss.errai.bus.server.SimpleDispatcher.dispatchGlobal(SimpleDispatcher.java:46) at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:97) at org.jboss.errai.bus.server.service.ErraiServiceImpl.store(ErraiServiceImpl.java:114) at org.jboss.errai.bus.server.servlet.DefaultBlockingServlet.doPost(DefaultBlockingServlet.java:140) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) at org.apache.catalina.core.Ap…
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/38031407
type: Comment
type: QuestionComment
score: 1
has text: You should actually look at the documentation for `Math.ceil()`...
comment on: http://stackoverflow.com/q/24555687

http://stackoverflow.com/a/24550630
has comment: http://stackoverflow.com/comment/38024564
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38025528
has comment: http://stackoverflow.com/comment/38028174
upvote count: 3
has comment: http://stackoverflow.com/comment/38028796
has comment: http://stackoverflow.com/comment/38026860
type: Answer
has comment: http://stackoverflow.com/comment/38026476
has comment: http://stackoverflow.com/comment/38025624
has comment: http://stackoverflow.com/comment/38024758
downvote count: 0
has comment: http://stackoverflow.com/comment/38023698
score: 3
has comment: http://stackoverflow.com/comment/38025237
answers question: http://stackoverflow.com/q/24549514
has comment: http://stackoverflow.com/comment/38025998
has body: First when the application is deployed it checks the web.xml and gets /* Then it initializes the DispatcherServlet and initializes the initialization paramerters using contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml (WEB-INF must start with /) then in mvc-dispatcher-servlet.xml the view resolver resolves the rendering pages. Change <property name="prefix" value="WEB-INF/pages/"/> to <property name="prefix" value="/WEB-INF/pages/"/> Finally in your controller @RequestMapping("/getMessageStats") so finally launching the application as http://localhost:8080/ProjectName/getMessageStats/ invokes printWelcome() of GetMessagesStatsController and http://localhost:8080/ProjectName/getMessageStats/json invokes generateJsonResponse()
accepted answer of: http://stackoverflow.com/q/24549514

http://stackoverflow.com/q/24483735
has comment: http://stackoverflow.com/comment/37898335
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37898305
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24483861
tagged with: java
has answer: http://stackoverflow.com/a/24483855
has body: I've just started beginning program and my professor is having us write a program that counts votes. The concept is looping but I'm having trouble with it. The program is supposed to get an input of characters from the user and it will use those characters to count the vote. So far the program can only execute the quit function properly and if I enter any other character other than the specified ones I'll get an endless loop. If I enter 'Y', 'y', 'N', or 'n' in the beginning it'll continue to take inputs even if I try to quit. Thanks in advance! public static void main(String[]args) { Scanner input = new Scanner(System.in); int yesVotes = 0; int noVotes = 0; int quitVote = 0; char vote = 'x'; System.out.println("Enter 'Y' to vote yes or Enter 'N' to vote no or Enter 'Q' to quit"); vote = input.next().charAt(0); while (quitVote &lt; 1) { if (vote == 'Y' || vote == 'y') yesVotes++; else if (vote == 'N' || vote == 'n') noVotes++; else if (vote == 'Q' || vote == 'q') quitVote++; else System.out.println("Your input is invalid"); } System.out.println("Total yes votes: " + yesVotes); System.out.println("Total no votes: " + noVotes); } }
tagged with: loops
accepted answer: http://stackoverflow.com/a/24483956
type: Question
has answer: http://stackoverflow.com/a/24483823
has comment: http://stackoverflow.com/comment/37898329
tagged with: if-statement
answer count: 6
possible better answer: http://stackoverflow.com/a/24483823
has answer: http://stackoverflow.com/a/24484490
score: 0
has answer: http://stackoverflow.com/a/24483894
favorite count: 0
has answer: http://stackoverflow.com/a/24483956
has title: Looping if statement trouble

http://stackoverflow.com/comment/37816611
type: AnswerComment
comment on: http://stackoverflow.com/a/24439839
score: 0
type: Comment
has text: I tried this after reading [this](http://stackoverflow.com/questions/1084112/access-this-from-java-anonymous-class?rq=1) just after posting this question. I verified it worked and was just about to post the answer but it appears you beat me to it. Thanks!

http://stackoverflow.com/q/24465320
has title: Using Regex Pattern with Jsoup on a Weblink
has answer: http://stackoverflow.com/a/24466168
favorite count: 0
downvote count: 1
tagged with: regex
upvote count: 0
has comment: http://stackoverflow.com/comment/37874477
has comment: http://stackoverflow.com/comment/37880040
has body: I'm trying to make a parser to get products info on a Website. I've made a similar tool with Php and Regex, and I wish to do the same with Java. The objective is to get a parent link, to make child products links with regex for getting their products info in a loop String curl = TextField1.getText(); URL url = new URL(curl); URLConnection spoof = url.openConnection(); spoof.setRequestProperty( "User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818)" ); BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream(),"UTF-8")); String strLine = ""; while ((strLine = in.readLine()) != null){ Pattern pattern = Pattern.compile("style='color:#000000;font-weight:bold;'&gt;(.*?)&lt;/a&gt;"); strLine = strLine.replaceAll(" ","_"); strLine = strLine.replaceAll("d'","d"); Matcher m = pattern.matcher(strLine); while(m.find()){ String enfurl = "http://www.exemple.com/fr/"+m.group(1)+".htm"; System.out.println(enfurl); } } This code works, but someone tell me that Jsoup is a better solution to parse html. I'm reading the Jsoup documentation, but after establish a connexion, I don't know which syntax I must choose. Could you help me ? EDIT : Ok, with this code : Elements links = doc.select("a[href][title*=Cliquer pour obtenir des détails]"); for (Element link : links) { System.out.println(link.attr("href")); String urlenf = link.attr("href"); Document docenf = Jsoup.connect(urlenf).get(); System.out.println(docenf.body().text()); } I've got the links... but now, I must open another Jsoup connexion to get product info, and this test don't works. How Could I use another Jsoup in the for loop ? thanks
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37952853
score: -1
has comment: http://stackoverflow.com/comment/37963459
type: Question
has answer: http://stackoverflow.com/a/24474484
accepted answer: http://stackoverflow.com/a/24474484
tagged with: jsoup
answer count: 2
possible better answer: http://stackoverflow.com/a/24466168

http://stackoverflow.com/comment/37868060
score: 0
has text: What's your issue/What part do you not understand? If you are having problems, please specify the specific problems. If you want someome to take a look at your code to give opinions, post it here: http://codereview.stackexchange.com
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24467612

http://stackoverflow.com/a/24473446
has comment: http://stackoverflow.com/comment/37878699
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/24473418
has comment: http://stackoverflow.com/comment/37878688
has comment: http://stackoverflow.com/comment/37878730
has comment: http://stackoverflow.com/comment/37878840
has comment: http://stackoverflow.com/comment/37878573
has comment: http://stackoverflow.com/comment/37878671
score: -1
has comment: http://stackoverflow.com/comment/37878695
has comment: http://stackoverflow.com/comment/37878820
has body: First of all, you may want to check this out: how to add checkbox and combobox in table cell? In your example, I am thinking that this may be due to the fact that there is not enough height to display the GUI. What I mean is that the Swing components automatically resize to fill their container, and if the container height is too small, then it may not display the GUI correctly. Here are images to illustrate my example (I used Windows XP): Initial Launch: Click on Cell: After Cell Click:
downvote count: 1
has comment: http://stackoverflow.com/comment/37878647

http://stackoverflow.com/comment/81723689
comment on: http://stackoverflow.com/a/24553468
type: AnswerComment
has text: Shouldn't the name of the XmlRootElement be the same as the class name?
score: 0
type: Comment

http://stackoverflow.com/q/24467374
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24467584
has body: The aim is to retrieve data from a MYSQL table and input this into a list view. In order to do this I am putting the values into an array. However, it seems that the length of the array must be equal to the number of values taken from the table (which can vary); or the app will respond with a null pointer exception. My question is: How do i set the arrays to be dynamic in length so the error does not evolve? Or is there an alternate way? Defining the arrays used: public String titleId[] = new String[2]; //Defining the arrays used public Integer imageId[] = new Integer[2]; Setting the Arrays equal to the values: (Currently, this will perform 2 iterations) for(int i=0; i&lt;jArray.length();i++){ JSONObject json = jArray.getJSONObject(i); titleId[i] = "test"; imageId[i] = R.drawable.ic_launcher; } Using arrays to set up ListView: CustomList adapter = new CustomList(getActivity(), data.titleId, data.imageId); listView.setAdapter(adapter); CustomList.java (Used to set up custom adapter) public class CustomList extends ArrayAdapter&lt;String&gt;{ private final Activity context; private final String[] titleId; private final Integer[] imageId; public CustomList(Activity context, String[] titleId, Integer[] imageId) { super(context, R.layout.single_row, titleId); this.context = context; this.titleId = titleId; this.imageId = imageId; } @Override public View getView(int position, View view, ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View rowView= inflater.inflate(R.layout.single_row, null, true); TextView txtTitle = (TextView) rowView.findViewById(R.id.tvTitle); ImageView imageView = (ImageView) rowView.findViewById(R.id.ivIcon); txtTitle.setText(titleId[position]); imageView.setImageResource(imageId[position]); return rowView; } }
tagged with: listview
answer count: 1
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/37867116
has comment: http://stackoverflow.com/comment/37867139
favorite count: 0
accepted answer: http://stackoverflow.com/a/24467584
tagged with: android
has title: How do i set an array of an expandable size to prevent null pointer exception?
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/24554767
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24548964
answers question: http://stackoverflow.com/q/24548964
has body: Note that your question is quite broad (and will likely be closed as such). My explanation is similarly broad and just meant to give you some background on why you might see the behavior that you are seeing. It is unlikely that the way you measure time makes a big difference here, given that you are up to hundreds of milliseconds. It is more likely that the web site that you are invoking is sometimes takes longer to respond. It may help to compare it to what you see when you type a search query into Google. Sometimes the response pops up "instantaneously", but sometimes it takes a few moments to load. Since you're using the same browser for every search, it can't be the browser causing the difference. Instead it is likely something in the web service that is varying between the calls. In the Google search example, you might be routed to a different Google server, the server might be using a different storage to search, the query might be cached at some point, etc. So there is no way to determine why the performance is different between invocations by simply looking at the client code. Instead, you should look at the server code and profile what happens there for different invocations.

http://stackoverflow.com/a/24578483
downvote count: 0
has comment: http://stackoverflow.com/comment/38075757
has comment: http://stackoverflow.com/comment/38074749
has comment: http://stackoverflow.com/comment/38075783
has body: Your problem is in code not shown here: //color update code for the buttons. You're likely running a loop that never ends on the Swing event thread, possibly a never-ending while loop that polls the state of something(a guess), freezing your GUI. Solution: don't do this; don't use a continuous polling loop. Instead, change the colors based on responses to events as Swing is event-driven. For better more specific help, please show the offending code and tell us more about your program. Edit If you're trying to show colored rows, one by one marching down the board, then my guess is right, you'll want to use a Swing Timer, one that uses an int index to indicate which row is being displayed in color. You'd increment the index inside of the Timer's ActionPerformed class, and then when all rows have been displayed stop the Timer. For example something like so: import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; import java.util.Random; import javax.swing.*; @SuppressWarnings("serial") public class MyGrid extends JPanel { private static final int GRID_LENGTH = 8; private static final Color BTN_BACKGROUND = Color.BLACK; private static final Color[] COLORS = { Color.MAGENTA, Color.CYAN, Color.RED, Color.YELLOW, Color.ORANGE, Color.PINK, Color.BLUE, Color.GREEN }; private static final int PREF_W = 400; private static final int PREF_H = PREF_W; private static final int TIMER_DELAY = 800; private JButton[][] buttonGrid = new JButton[GRID_LENGTH][GRID_LENGTH]; private Map&lt;JButton, Color&gt; btnColorMap = new HashMap&lt;&gt;(); private Random random = new Random(); public MyGrid() { setLayout(new GridLayout(GRID_LENGTH, GRID_LENGTH)); for (int row = 0; row &lt; buttonGrid.length; row++) { for (int col = 0; col &lt; buttonGrid[row].length; col++) { JButton btn = new JButton(); btn.setBackground(BTN_BACKGROUND); // !! add action liste…
has comment: http://stackoverflow.com/comment/38075677
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38073836
has comment: http://stackoverflow.com/comment/38074663
has comment: http://stackoverflow.com/comment/38074372
has comment: http://stackoverflow.com/comment/38075708
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/38075122
has comment: http://stackoverflow.com/comment/38073839
has comment: http://stackoverflow.com/comment/38074802
has comment: http://stackoverflow.com/comment/38073893
accepted answer of: http://stackoverflow.com/q/24578458
answers question: http://stackoverflow.com/q/24578458
has comment: http://stackoverflow.com/comment/38073864
has comment: http://stackoverflow.com/comment/38114449
has comment: http://stackoverflow.com/comment/38114420
upvote count: 5

http://stackoverflow.com/comment/80002354
type: Comment
type: QuestionComment
has text: Same exception here and solved by removing the jaxb-impl dependency (by setting de maven dependency scope to provided)
comment on: http://stackoverflow.com/q/24453449
score: 0

http://stackoverflow.com/comment/38595751
score: 8
comment on: http://stackoverflow.com/a/24438136
has text: DON'T DO THIS if you are using ADT bundle. ECLIPSE won't start after uninstalling ADT! This is only for people who added ADT to and existing eclipse installation.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/47015053
comment on: http://stackoverflow.com/q/24543787
score: 0
type: Comment
type: QuestionComment
has text: Hi. I have the same problem at the moment. Googling the problem description got me here. Did you solve the problem ? If so, could share the solution?

http://stackoverflow.com/comment/37989746
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24529834
type: Comment
has text: version 3.3.0.RELEASE, I have no idea about the plug-ins

http://stackoverflow.com/a/24552407
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24551144
has body: JAXB - Java to XML binding, is the way to go for effective and efficient XML to POJO and vice versa as pointed by above example. Plus required tools are bundled with JDK only requirement is error free XSD/set of XSDs required for creating object bindings. XJC xjc : with either command line args as -p for package name -d for out dir etc. details can be found on xjc man page/refer Online page. But if implementation involves multiple xsds, then prefer using xjb (binding file) &lt;jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" version="2.1" jxb:extensionBindingPrefixes="xjc"&gt; &lt;jxb:globalBindings&gt; &lt;xjc:simple/&gt; &lt;/jxb:globalBindings&gt; &lt;jxb:bindings schemaLocation="schema/xml/xmldsig-core-schema.xsd"&gt; &lt;jxb:schemaBindings&gt; &lt;jxb:package name="org.w3.xmldsig"/&gt; &lt;/jxb:schemaBindings&gt; &lt;/jxb:bindings&gt; &lt;jxb:bindings schemaLocation="schema/xml/xenc-schema.xsd"&gt; &lt;jxb:schemaBindings&gt; &lt;jxb:package name="org.w3.xenc"/&gt; &lt;/jxb:schemaBindings&gt; &lt;/jxb:bindings&gt; &lt;/jxb:bindings&gt; Comprehensive guide from oracle on XJBs Guide Once you have your bindings generated, all you need is create JAXBContext with either class or list of packages separated by : final JAXBContext context = JAXBContext.newInstance(Generated.class); final JAXBContext contextOnPackage = JAXBContext.newInstance("com.alpha.generated:com.beta.generated"); optionally you can provide a Classloader as well final JAXBContext contextCustomClassLoader = JAXBContext.newInstnace("..:..", X.class.getClassLoader()); // this is for more advanced use. UnMarshalling // source can be a file/InputStream/InputSource etc. Test obj = (Test)context.createUnMarshaller().unmarshal(source); Marshalling Test test = gen.xml.package.ObjectFactory.createTest(); // Bunch of setters // gen.xml.package is generated package XJC will create ObjectFactory as well // sink can…
upvote count: 2

http://stackoverflow.com/comment/38036479
type: Comment
type: QuestionComment
has text: How many times are you going to ask the same question? http://stackoverflow.com/questions/24517357/com-vaadin-ui-link-class-cannot-re-size-ie-window-when-opening-pdf-file
comment on: http://stackoverflow.com/q/24558391
score: 0

http://stackoverflow.com/q/24472255
has title: Dynamic User Input Forms
has answer: http://stackoverflow.com/a/24472647
accepted answer: http://stackoverflow.com/a/24472647
score: 0
tagged with: android
answer count: 1
has body: I want to collect information about the user. Let's say, I want to collect information like age and gender for each of their family members. How could I do this, in a form, given I do not know their family size, so that when prompted, they can input the number of family members. To which a screen now shows, a form like list with family member 1: Age: Gender: Family Member 2: Age Gender and so on. I would like one big list, so you could scroll down the app to input all information. And a submit button at the end will submit the form to me. I just don't know how to handle the unknown number of editText forms etc and how to then extract the info from each. If you could show me how to do this with some code snippets.
tagged with: input
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
type: Question

http://stackoverflow.com/q/24443598
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24460335
type: AnsweredQuestion
has body: I have a Java 7 application which is using Java Chromium Embedded Framework to draw html/css into two windows it launches. This works quite well in 4 of 5 PCs that I've run it on. In one case there are alignment issues with the rendered html. Successful runs include Windows 7/8/8.1. Unsuccessful run is 8.1 on an HP TouchSmart Envy, straight out of the box. Perhaps the only distinguishable differences are that this PC is new and that it has a touch screen. As you can see, the content is shifted upward while being additionally clipped at the right and bottom sides. This is true of both windows that the application opens. What's even stranger is that mouse events (such as the :hover effects on the buttons and click events) are received in their correct position -- clicking about two inches below "Start Presentation" fires the button's click event. Frankly, I have no idea what to try next on this. I've tried installing and uninstalling graphics-related software, adjusting the screen resolution, adding and removing the second screen, restarting the pc, and updating the onboard graphics driver. As I have no idea what else could be causing this inconsistency, any advice in troubleshooting this issue would be fantastic.
downvote count: 0
score: 1
favorite count: 0
tagged with: chromium-embedded
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/24460335
has title: Misaligned Screen in JCEF (Java Chromium Embedded Framework) Application

hazelcast
tags question: http://stackoverflow.com/q/24435362
type: Tag
tag name: hazelcast
tags question: http://stackoverflow.com/q/24451542
tags question: http://stackoverflow.com/q/24520921
tags question: http://stackoverflow.com/q/24551039

http://stackoverflow.com/comment/37978652
score: 1
has text: Yeah there is a week format available according to [here](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24527611

http://stackoverflow.com/a/24531149
has body: On save action of your editor, call your load class method.
answers question: http://stackoverflow.com/q/24531090
score: 0
type: Answer

http://stackoverflow.com/q/24493276
has answer: http://stackoverflow.com/a/24493463
type: AnsweredQuestion
tagged with: inner-classes
score: 1
has comment: http://stackoverflow.com/comment/37916224
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37918647
has title: Eligible for garbage collection?
accepted answer: http://stackoverflow.com/a/24493463
possible better answer: http://stackoverflow.com/a/24493439
has answer: http://stackoverflow.com/a/24493445
has answer: http://stackoverflow.com/a/24493439
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37916141
favorite count: 0
has body: I know that an instance of an inner class must bind to an instance of the wrapper class and this lead me to question what happens to a wrapper class instance, when there is no reference to it but when there is still a reference to a bound instance. So, is object referenced by otr eligible for garbage collection once the reference is set to null ? class Outer { class Inner { } } class Test{ public static void main(String []args){ Outer otr = new Outer() ; // (1) Outer.Inner oi = otr.new Inner() ; // (2) otr = null ; // (3) // more complicated code } }
tagged with: garbage-collection

http://stackoverflow.com/q/24461510
has comment: http://stackoverflow.com/comment/37856432
duplicate of: http://stackoverflow.com/q/24459779
has comment: http://stackoverflow.com/comment/37856407
answer count: 1
has comment: http://stackoverflow.com/comment/37856919
has answer: http://stackoverflow.com/a/24462022
favorite count: 0
tagged with: timer
has comment: http://stackoverflow.com/comment/37856844
has title: [eclipse]I want to add another move for my button in the timer
downvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37857011
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37856883
has comment: http://stackoverflow.com/comment/37856392
has comment: http://stackoverflow.com/comment/37856361
accepted answer: http://stackoverflow.com/a/24462022
tagged with: java
tagged with: eclipse
type: Question
has body: guys I am new to the eclipse, I am practicing the timer in eclipse, can I have some help for my codes? The code below is like if I clicked the trigger button while it is counting, it will trigger another counting without stop the previous counting. I have tried chancel the button or reactive it after the down counting, still i want to know how to make the same trigger button acquire the restart counting function. Can u help me by directly embed to my code please? I know i am too new to eclipse, java even eng, everything, i would need your explanation if it is not going to take your take too much. Button countDownButton2 = (Button) findViewById(R.id.countDown1); countDownButton2.setOnClickListener(new View.OnClickListener() { public void onClick(View view){ CountDownTimer timer2 = new CountDownTimer(3000,1000){ @Override public void onFinish() { mTimeLabel1.setText("Times Up baby!"); } @Override public void onTick(long millisUntilFinished) { int seconds = (int) (millisUntilFinished / 1000); int minutes = seconds / 60; seconds = seconds % 60; mTimeLabel1.setText("" + minutes + ":" + String.format("%02d", seconds)); } }.start(); } });
linked to: http://stackoverflow.com/q/24459779
tagged with: javascript
score: -1

http://stackoverflow.com/comment/38838914
type: QuestionComment
has text: Read [The Tutorial](http://docs.oracle.com/javase/tutorial/javabeans/TOC.html) by Oracle, free of cost.
score: 0
comment on: http://stackoverflow.com/q/24529737
type: Comment

http://stackoverflow.com/q/24433595
has comment: http://stackoverflow.com/comment/37805754
has comment: http://stackoverflow.com/comment/37805181
tagged with: java
has body: Help! I am making a very simple android game which involves dragging a player sprite to avoid enemy sprites, but I'm running into problems with both View and SurfaceView. View - The onDraw() and onTouchEvent() methods are on the UI Thread and cause the framerate to drop (or even speed up on some devices) when the screen is touched. SurfaceView - There is no Hardware Acceleration on this, which causes my high resolution .png bitmaps to be drawn very badly without antialiasing. GLSurfaceView - I would really not prefer to learn OpenGL for such a basic game, and I also don't have enough time as the game must be done very soon. Do I have any alternative here? If I could handle touch events in another thread using the View then it might work, but I don't know if it's possible.
type: Question
has comment: http://stackoverflow.com/comment/37837941
linked to: http://stackoverflow.com/q/24419942
tagged with: surfaceview
score: 0
has comment: http://stackoverflow.com/comment/37804751
has title: View and SurfaceView alternative?
tagged with: android
has comment: http://stackoverflow.com/comment/37807569
has comment: http://stackoverflow.com/comment/37806572
answer count: 0
has comment: http://stackoverflow.com/comment/37806522
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37807195
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37805905
has comment: http://stackoverflow.com/comment/37847941

http://stackoverflow.com/comment/37903675
has text: give the connectivity code
comment on: http://stackoverflow.com/q/24486685
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24451887
has comment: http://stackoverflow.com/comment/37838312
answers question: http://stackoverflow.com/q/24451780
type: Answer
has comment: http://stackoverflow.com/comment/37838267
accepted answer of: http://stackoverflow.com/q/24451780
has body: You can probably configure a Keyboard shortcut for this. In eclipse go to Window -&gt; Preference. From the left pane go to General-&gt; keys Find out the Run Maven Install, Edit a keyboard configuration in the Binding field that suits for you. Hopes this helps.
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/24528156
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-signature
type: UnansweredQuestion
tagged with: x509certificate
has comment: http://stackoverflow.com/comment/38022399
has comment: http://stackoverflow.com/comment/37981266
has answer: http://stackoverflow.com/a/57507165
has comment: http://stackoverflow.com/comment/84658283
has comment: http://stackoverflow.com/comment/37981224
has body: I have an issue with XML Signature value mismatch error. Full Scenario I generated a private 1024 bit key with OpenSSL. I generated the CSR with that private key and sent it to VISA, they have signed the document with their root CA certificate and sent me a signed certificate in the .pem format. I use the following java code to sign an XML document. When i send the data back to VISA they verify the signature value and send an error of mismatch. XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM", (Provider) Class.forName(providerName).newInstance()); DigestMethod digestMethod = factory.newDigestMethod(DigestMethod.SHA1, null); factory.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null); Reference reference = factory.newReference("#" + paresId, digestMethod, null, null,null); CanonicalizationMethod canonicalizationMethod = factory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null); SignatureMethod signatureMethod = factory.newSignatureMethod(SignatureMethod.RSA_SHA1, null); SignedInfo signedInfo = factory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference)); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); kpg.initialize(512); KeyPair keyPair = kpg.generateKeyPair(); KeyInfoFactory keyInfoFactory = factory.getKeyInfoFactory(); KeyStore keyStore = KeyStore.getInstance("JKS"); //PKC#7 keyStore.load(new FileInputStream(keystorePath), "dell12345".toCharArray()); KeyStore.PrivateKeyEntry keyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry("deskey", new KeyStore.PasswordProtection("dell12345".toCharArray())); //PrivateKey m_objRequestSigningKey = (PrivateKey) obj_keyStore.getKey(str_alias, "password".toCharArray()); KeyStore.TrustedCertificateEntry rootEntry = (KeyStore.TrustedCertificateEntry) keyStore.getEntry("root", null); X509Certificate rootCertificate = (X509Certificate) rootEntry.getTrustedCertificate(); KeyStore.TrustedCertificateEntry inter…
tagged with: java
has comment: http://stackoverflow.com/comment/37981361
type: Question
answer count: 1
score: 0
has title: XML Signature Value mismatch issue
has comment: http://stackoverflow.com/comment/37981304
has comment: http://stackoverflow.com/comment/38006725
tagged with: cryptography

http://stackoverflow.com/comment/37891052
comment on: http://stackoverflow.com/a/24448709
score: 71
has text: This broke my eclipse installation.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24503560
has comment: http://stackoverflow.com/comment/37934749
tagged with: hive
has comment: http://stackoverflow.com/comment/37935728
answer count: 0
tagged with: java
has title: java.lang.AbstractMethodError: org.yong3.hive.mongo.MongoStorageHandler.configureJobConf
type: Question
tagged with: mongodb
has body: I am getting 'java lang AbstactMethodError'. Anyone can please help me. I am unable to find out reason behind it. Thanks in advancejava.lang.AbstractMethodError: org.yong3.hive.mongo.MongoStorageHandler.configureJobConf(Lorg/apache/hadoop/hive/ql/plan/TableDesc;Lorg/apache/hadoop/mapred/JobConf;)V
has comment: http://stackoverflow.com/comment/37934811
score: 0
has comment: http://stackoverflow.com/comment/39588146
type: UnansweredQuestion

http://stackoverflow.com/a/24466555
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24464279
answers question: http://stackoverflow.com/q/24464279
has body: So I decided to go with a slight variation of the answer by @Juvanis. To get at the nth element in a LinkedHashSet: Iterator&lt;T&gt; itr = mySet.iterator(); int nth = y; T value = null; for(int i = 0; itr.hasNext(); i++) { value = itr.next(); if (i == nth) { break; } } Version 2 of the code: public class SetUtil { @Nullable public static &lt;T&gt; T nthElement(Set&lt;T&gt; set, int n) { if (null != set &amp;&amp; n &gt;= 0 &amp;&amp; n &lt; set.size()) { int count = 0; for (T element : set) { if (n == count) return element; count++; } } return null; } } NB: with some slight modifications the method above can be used for all Iterables&lt;T&gt;. This avoids the overhead of ensuring that a Set and a List stay in sync, and also avoids having to create a new List every time (which will be more time-consuming than any amount of algorithmic complexity). Obviously I am using a Set to ensure uniqueness and I'd rather avoid a lengthy explanation as to why I need indexed access.
upvote count: 2

http://stackoverflow.com/q/24536244
score: 1
favorite count: 0
type: Question
has body: I have an XML with a "token" field in it, in java it's: @XmlElement(name = "Token", required = true) protected byte[] token; I'm using a UUID to generate the token, so I do: UUID uuid=UUID.randomUUID(); ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); byte[] token = bb.array(); myXML.setToken(token); and in the XML I get something like that: jvXrf8HvSVq23MiwSbnT+A== I need also to send the token to a service that use Json notation, so in another funcion I get the token from the XML object and store it in a POJO: String sToken = Base64.encode(myXML.getToken()); myPojo.setToken(sToken); I've checked the string and it's correct, but when I convert myPojo to Json with Gson: GsonBuilder gb = new GsonBuilder() .serializeNulls() .setPrettyPrinting() .setDateFormat("yyyy-MM-dd HH:mm:ss"); Gson gson = gb.create(); String json=gson.toJson(myPojo); I get this in the json string representation of the object: jvXrf8HvSVq23MiwSbnT+A== with the two "=" translated in "=". It's normal? Do the = code get translated to "=" at the receiving part? Thank you
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24536981
linked to: http://stackoverflow.com/q/16558709
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24536981
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: base64
has title: Java: converting bytearray to string and xml
type: AnsweredQuestion
tagged with: arrays
downvote count: 0

http://stackoverflow.com/q/24543529
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24544110
linked to: http://stackoverflow.com/q/22243651
tagged with: android
linked to: http://stackoverflow.com/q/24525595
has title: Eclipse: Issues with deleting and creating projects
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24544110
has answer: http://stackoverflow.com/a/24546632
has body: I am having an issue in Eclipse. If I create a project, then delete it and check the "Delete project contents on disk (cannot be undone)" check box, a project created afterwards with the exact same name and settings will not be created with a MainActivity.java file. If I create a project then delete it without checking that box, it can be recreated with the MainActivity.java file but will require you to open and save the fragment_main XML file before the project can be deleted again (with or without checking the check box). What is happening here? Why does it behave in this way?
accepted answer: http://stackoverflow.com/a/24546632
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/24445894
tagged with: eclipse
tagged with: main-activity

http://stackoverflow.com/comment/37875889
comment on: http://stackoverflow.com/q/24469444
type: Comment
type: QuestionComment
has text: Check that you are checking all the necessary boxes prior to hitting "Finish"
score: 0

http://stackoverflow.com/comment/37907765
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24488689
type: Comment
has text: Yes you are right :) I forgot to complete with all the details. But if I create a separate method and include it in the actionPerformed method of the button it should work right ?

http://stackoverflow.com/comment/37956970
type: AnswerComment
score: 0
type: Comment
has text: But then how can I get the properties in session scope?
comment on: http://stackoverflow.com/a/24515843

http://stackoverflow.com/q/24514149
has answer: http://stackoverflow.com/a/24539739
tagged with: gzip
tagged with: base64
has title: Decompressing Bitmap from Base64 and GZIP
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24514381
has body: In my application I get a profile picture for user then I save it to a serialized class as string. I do the GZIP compress and Base64 using the code below, but I can not do the reverse thing as you see in the getProfilePicture() method further down: private void saveBitmap(){ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); mBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); byte[] byteArray = byteArrayOutputStream.toByteArray(); String bitmapContent = ""; try { bitmapContent = FileHelpers.compressAndBase64(byteArray); //later save it... } catch (IOException e) { e.printStackTrace(); Log.e(TAG, "Error converting bitmap to gzip and base64"); } } public static String compressAndBase64(byte[] byteArray) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream zos = new GZIPOutputStream(baos); zos.write(byteArray); zos.close(); byte[] bytes = baos.toByteArray(); return Base64.encodeToString(bytes, Base64.DEFAULT); } Now I want to convert it back to Bitmap...but so far I didn't succeed to. The steps are decoding back the string from Base64 to byte array then decompress the byte array and convert to Bitmap. public Bitmap getProfilePicture(){ if(getProfilePhotoBase64() != null) { byte[] decoded = Base64.decode(mProfilePhotoBase64.getBytes(), Base64.DEFAULT); final int BUFFER_SIZE = 32; ByteArrayInputStream is = new ByteArrayInputStream(decoded); GZIPInputStream gis = null; try { gis = new GZIPInputStream(is, BUFFER_SIZE); } catch (IOException e) { e.printStackTrace(); } StringBuilder string = new StringBuilder(); byte[] data = new byte[BUFFER_SIZE]; int bytesRead; try { while ((bytesRead = gis.read(data)) != -1) { string.append(new String(data, 0, bytesRead)); } } catch (IOException e) { e.printStackTrace(); } try { gis.close(); is.close(); } catch (IOException e) { e.printStackTrace(); } byte[] byteArray = string.toString().getBytes(); Bitmap bitmap = BitmapFactory.decodeByteArray(byteArr…
tagged with: android
has answer: http://stackoverflow.com/a/24514381
type: AnsweredQuestion
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/24539739
tagged with: java
type: Question

http://stackoverflow.com/comment/38003897
comment on: http://stackoverflow.com/a/24539941
score: 0
type: AnswerComment
type: Comment
has text: @HighCore I "love" that BigDecimal still gets rounding errors after all the pain you go through to use them.

http://stackoverflow.com/comment/37823528
score: 0
comment on: http://stackoverflow.com/q/24443659
type: Comment
type: QuestionComment
has text: Sounds like you want a range search: https://en.wikipedia.org/wiki/Range_searching

http://stackoverflow.com/a/24536981
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24536244
answers question: http://stackoverflow.com/q/24536244
has body: Yes, GSON changes = to unicode \u003d. you can get details info here: GSON issue with String Disable escape HTML and then you are good to go.
type: Answer
score: 0

http://stackoverflow.com/comment/37834026
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). That might solve the problem. If not, it should provide more information as to the reason it failed. 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. As an aside, that code looks like it would not compile, let alone run. It is missing a closing `"`. Don't waste people's time by posting 'something like' the code.
comment on: http://stackoverflow.com/q/24436201
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24561408
has comment: http://stackoverflow.com/comment/38046871
tagged with: process
tagged with: java
has body: I want to be able to kill a ping started from my java program, but I need to get the pid to do so. I also did some research and I found out that I can use SendSignal.exe to send Ctl+C, but I need the pid of the process that I have just started. Is there a way in Java to get the pid? Process p = null; InputStream processOutput; BufferedReader reader = null; String line = " "; p = Runtime.getRuntime().exec("cmd /c " + command); processOutput = p.getInputStream(); reader = new BufferedReader(new InputStreamReader(processOutput)); // Read the input while((line = reader.readLine()) != null){ output += line + "\n"; System.out.println(line); }
type: Question
linked to: http://stackoverflow.com/q/35842
answer count: 1
duplicate of: http://stackoverflow.com/q/35842
score: 0
tagged with: pid
tagged with: cmd
has title: Send Ctrl+C to a proccess started within java
has comment: http://stackoverflow.com/comment/38042581
has comment: http://stackoverflow.com/comment/38042637
has answer: http://stackoverflow.com/a/24561818
type: UnansweredQuestion

http://stackoverflow.com/q/24549342
score: 0
answer count: 3
upvote count: 1
downvote count: 1
tagged with: bufferedreader
favorite count: 0
has answer: http://stackoverflow.com/a/24549373
has answer: http://stackoverflow.com/a/24549421
has body: I'm using a small "xml text based database" to store information. While coding and debugging I had no problems with a method I created, but as an exe file(wrapped with jsmooth), it gives me an error: Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: java.io.BufferedReader.lines()LJava/util/stream/Stream: at primary.loadErrorDB(primary.java:471 So i checked line 471 but on Intellij, there is no such error, everything works fine there. Hope you guys know what to do. This is the method public static Object[] loadErrorDB() { File db = new File(System.getProperty("user.dir") + "\\errordb.xml"); Object[] errordbAry = new String[20][20]; FileReader file = null; try { file = new FileReader(db); } catch (Exception ex) { ex.printStackTrace(); } try { BufferedReader br = new BufferedReader(file); Stream&lt;String&gt; streamList = br.lines(); errordbAry = streamList.toArray(); } catch (Exception ex) { ex.printStackTrace(); } String a = ""; for (Object o : errordbAry) { a = a + String.valueOf(o) + ";"; } String[] srgAry = a.split(";"); String[] newAry = new String[srgAry.length - 5]; int x = 0; for (int i = 5; i &lt; srgAry.length; i++) { newAry[x] = srgAry[i]; x++; } return newAry; }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24549404
has title: Java - NoSuchMethodError on java.io.BufferdReader.lines on other systems
tagged with: java
has answer: http://stackoverflow.com/a/24549404
type: Question
tagged with: intellij-idea
tagged with: jsmooth
accepted answer: http://stackoverflow.com/a/24549373

http://stackoverflow.com/q/24572705
score: 0
answer count: 2
tagged with: jpa
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24572869
has title: Dynamic creation of EntityManager
has body: My problem is actually simple but I really do not find a good solution to it. I've currently to manage several DB in my application: one UNIQUE admin DB (with a static name); one client DB, with a name depending on the client. I'm using JPA and I would like to create dynamically EntityManagers for client DB. But when I create this programmatically, I get this error: javax.persistence.TransactionRequiredException: joinTransaction has been called on a resource-local EntityManager which is unable to register for a JTA transaction. Here is the code: @Stateful public class ServiceImpl implements Service{ private EntityManagerFactory emf; private EntityManager em; @PostConstruct // automatically called when EJB constructed and session starts public void init() { emf = Persistence.createEntityManagerFactory("punit"); em = emf.createEntityManager(); } ... And @Stateful(mappedName = "CustomerService") public class CustomerServiceImpl extends ServiceImpl implements CustomerService { @Override public void create(Customer cust) { getEm().joinTransaction(); getEm().persist(cust); } More generally, I'v got problems with JPA. I just would like to connect to two databases, do some CRUD operations on them. But I really don't know how to manage transactions (my first approach was to let the container manage it...). If someone could help me, could be great! NB: I'm using a Glassfish Java EE server and PGSql DBs.
has answer: http://stackoverflow.com/a/24580321
type: Question
tagged with: ejb
tagged with: java

http://stackoverflow.com/a/24435143
has comment: http://stackoverflow.com/comment/37808547
has body: Pass a reference of MainActivity to MyAsyncTask: public class MyAsyncTask extends AsyncTask&lt;String, Void, String&gt; { private MainActivity mainActivity; public MyAsyncTask(MainActivity mainActivity) { this.mainActivity = mainActivity; } } Then, whenever creating an instance of MyAsyncTask inside the class MainActivity, pass this (MainActivity instance) to the constructor: new MyAsyncTask(this).execute();
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24435073
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24435073

http://stackoverflow.com/comment/37856699
has text: But that would copy the whole array and take up memory which is bad since I will have to do these checks in specific slices of the array many times.
comment on: http://stackoverflow.com/a/24461797
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/48237401
type: AnswerComment
type: Comment
has text: I installed scala 2.11.6 . don't forget to set the environment variable for scala for global access.
score: 1
comment on: http://stackoverflow.com/a/30061155

http://stackoverflow.com/comment/40728713
type: AnswerComment
comment on: http://stackoverflow.com/a/24541087
score: 0
type: Comment
has text: Are you using 5+ or 5.0+ in your build.gradle? I would recommend using 5.0.+ since that has already rolled out and should work fine.

http://stackoverflow.com/a/24554237
has comment: http://stackoverflow.com/comment/38028626
has comment: http://stackoverflow.com/comment/38028559
score: 0
answers question: http://stackoverflow.com/q/24554084
type: Answer
has body: Well, if you need 200m objects in memory then you can initialize each while iterating through the ResultSet - you don't need to save the metadata ResultSet rs = stmt.executeQuery(); while (rs.next()) { String col1= rs.getString("col1"); Integer col2= rs.getInt("col2"); MyClass o = new MyClass(col1,col2); add(o); } rs.close();

http://stackoverflow.com/comment/37836506
comment on: http://stackoverflow.com/a/24450600
score: 0
has text: Split the problem in parts: try `String files = userHome.list();`. And then try `Desktop.getDesktop().browse(userHome.toURL());`. However I saw now http://stackoverflow.com/questions/7201722/java-desktop-getdesktop-browseuri-is-supported-but-does-not-open-document
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24577480
has answer: http://stackoverflow.com/a/51365752
has comment: http://stackoverflow.com/comment/38073988
has answer: http://stackoverflow.com/a/24588385
has body: After updating from Grails 2.3.10 to 2.3.11 and updating the path variable to export GRAILS_HOME=/Applications/grails/grails-2.3.11 When I run: grails I get the following error: Error: Main class org.codehaus.groovy.grails.cli.support.GrailsStarter could not be found
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46887514
possible better answer: http://stackoverflow.com/a/32439001
has answer: http://stackoverflow.com/a/29832200
has title: org.codehaus.groovy.grails.cli.support.GrailsStarter not found error
has comment: http://stackoverflow.com/comment/38074958
has answer: http://stackoverflow.com/a/29421859
has comment: http://stackoverflow.com/comment/38091993
type: Question
has answer: http://stackoverflow.com/a/26537483
answer count: 8
upvote count: 9
tagged with: java
tagged with: grails
tagged with: grails-2.0
downvote count: 0
accepted answer: http://stackoverflow.com/a/26537483
favorite count: 0
has answer: http://stackoverflow.com/a/29918090
tagged with: groovy
score: 9
has answer: http://stackoverflow.com/a/32439001

http://stackoverflow.com/q/24554635
tagged with: twilio
type: UnansweredQuestion
tagged with: scala
has body: Automatic call disconnects in Twilio, and I think this is the reason: controller var lng="en-US"; var code="123456" var twiml=" "; twiml+=Messages("callData", ""," <Pause length='1'/> "+code.toList.mkString(" <Pause length='1'/> "))(Lang(lng))+" " Ok(views.xml.twilio(twiml)) twilio.scala.xml @(twiml:String) @twiml But this is not working properly. It shows the content but not as like xml, where Response tag shown in purple color and the string that I entered is in black. When I check the Body of request in Request Inspector in my Twilio account, it shows me something like this. 4 I know its not a proper way to deal with xml. Can anyone help me?
tagged with: http://stackoverflow.com/tag/xml
has title: Automatic call disconnects in Twilio
score: 0
tagged with: java
type: Question
tagged with: twilio-twiml
has answer: http://stackoverflow.com/a/26802914
answer count: 1

http://stackoverflow.com/q/24559871
accepted answer: http://stackoverflow.com/a/24561712
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38039529
tagged with: mockito
has body: I have a static void method from a different class that is invoked along my code as some sort of logger. In order to automatically test the different use cases of my code I was thinking of checking the logs of the system created by such method. What I thought is to mock that class and overwrite the behaviour of the method so that it outputs to System.err. Also, redirecting System.err as explained here so that I can easily verify the correct functioning of the code. I do not know how to override the standard behaviour of the method so that it does something (printing to the stderr) instead of what it normally does (by not mocking it) or nothing (what I get my using when(...).thenReturn(...))
tagged with: mocking
has title: Mocking static void method and changing its behaviour
linked to: http://stackoverflow.com/q/1119385
answer count: 1
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/24561712
favorite count: 0
has comment: http://stackoverflow.com/comment/38043306
tagged with: powermock
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38043110
score: 1
tagged with: java

nodelist
type: Tag
tags question: http://stackoverflow.com/q/24533769
tag name: nodelist

http://stackoverflow.com/q/24472181
score: 0
answer count: 1
has title: Does Client have to know Impl of an Object returned by RMI Server?
type: UnansweredQuestion
tagged with: client
has answer: http://stackoverflow.com/a/24472247
tagged with: java
has body: I just wondered if the Client has to know actual Implementations of the objects on the server. I thought the Client only has to know the interfaces of the objects on the server. Example (on the server side): public class AccountImpl implements Account { //lots of Code } public class AccountManagerImpl implements AccountManager { public Account login() { return new AccountImpl(); } } on the client side: AccountManager accMan = (AccountManager) registry.lookup("accMan"); Account myAccount = accMan.login(); So the client has the interface Account. Does he need to know the implementation of the class AccountImpl, too? Since every User should get his own Account I don't think I can export and bind them to the registry... How is this usually done? Thanks in advance
type: Question
tagged with: rmi

http://stackoverflow.com/comment/37998022
type: AnswerComment
type: Comment
has text: i can't find the solution -.-
comment on: http://stackoverflow.com/a/24537226
score: 0

http://stackoverflow.com/a/26445082
score: 0
answers question: http://stackoverflow.com/q/24553269
type: AcceptedAnswer
type: Answer
has body: In LOIC change the method tab to UDP. Also try testing out the maximum amount of threads that your computer can handle. Hope this helps.
accepted answer of: http://stackoverflow.com/q/24553269

http://stackoverflow.com/q/24487641
favorite count: 0
has answer: http://stackoverflow.com/a/24488414
tagged with: io
has comment: http://stackoverflow.com/comment/37906033
type: AnsweredQuestion
has body: public static void main(String[] args) { ReadInts ri = new ReadInts("mydata.dat"); } I've recently created a file called mydata.dat What is the easiest way to call a data from the file using the Constructor, class and leaving the main method with that simply to read it? The code that writes the file: import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class WriteInts { private String fname; public WriteInts(String fname) { this.fname = fname; } public void write(int... a) throws IOException { File file = new File(fname); try { System.out.println("Writing to-" + file.getAbsolutePath()); if (!file.exists()) file.createNewFile(); file.canRead(); } catch (IOException x) { x.printStackTrace(); } BufferedWriter outputWriter = new BufferedWriter(new FileWriter(file)); for (int i = 0; i &lt; a.length; i++) { outputWriter.write(Integer.toString(a[i])); outputWriter.newLine(); } outputWriter.flush(); outputWriter.close(); } public static void main(String[] args) { int myArr[] = { 16, 31, 90, 45, 89 }; try { WriteInts wi = new WriteInts("mydata.dat"); wi.write(myArr); } catch (IOException e) { e.printStackTrace(); } } }
downvote count: 2
tagged with: filewriter
has comment: http://stackoverflow.com/comment/37905648
has comment: http://stackoverflow.com/comment/37906160
upvote count: 1
tagged with: filereader
accepted answer: http://stackoverflow.com/a/24488414
has title: How to Read an Integer from a Created File?
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24487727
has answer: http://stackoverflow.com/a/24487785
score: -1
has answer: http://stackoverflow.com/a/24487727
answer count: 3
has comment: http://stackoverflow.com/comment/37905516

http://stackoverflow.com/comment/38085228
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24573594
score: 0
has text: You might also have a look at http://code.google.com/p/pircbotx/ - a kind of fork of pircbot. In my opinion the code quality is better than the original pircbot code.

android-fragments
tags question: http://stackoverflow.com/q/24467423
tags question: http://stackoverflow.com/q/24493378
tags question: http://stackoverflow.com/q/24491995
tags question: http://stackoverflow.com/q/24488922
tags question: http://stackoverflow.com/q/24459226
tags question: http://stackoverflow.com/q/24564920
tags question: http://stackoverflow.com/q/24500143
tags question: http://stackoverflow.com/q/24555996
tags question: http://stackoverflow.com/q/24495893
type: Tag
tags question: http://stackoverflow.com/q/24502394
tags question: http://stackoverflow.com/q/24526714
tags question: http://stackoverflow.com/q/24562012
tags question: http://stackoverflow.com/q/24553926
tags question: http://stackoverflow.com/q/24522362
tags question: http://stackoverflow.com/q/24438839
tags question: http://stackoverflow.com/q/24530383
tags question: http://stackoverflow.com/q/24517494
tags question: http://stackoverflow.com/q/24545421
tags question: http://stackoverflow.com/q/24469636
tags question: http://stackoverflow.com/q/24530090
tags question: http://stackoverflow.com/q/24470052
tags question: http://stackoverflow.com/q/24543179
tags question: http://stackoverflow.com/q/24585420
tags question: http://stackoverflow.com/q/24473604
tags question: http://stackoverflow.com/q/24552925
tags question: http://stackoverflow.com/q/24503545
tags question: http://stackoverflow.com/q/24536524
tags question: http://stackoverflow.com/q/24568477
tags question: http://stackoverflow.com/q/24535900
tags question: http://stackoverflow.com/q/24539516
tags question: http://stackoverflow.com/q/24514078
tags question: http://stackoverflow.com/q/24485819
tags question: http://stackoverflow.com/q/24528803
tags question: http://stackoverflow.com/q/24583988
tags question: http://stackoverflow.com/q/24543328
tag name: android-fragments
tags question: http://stackoverflow.com/q/24487756
tags question: http://stackoverflow.com/q/24582485

http://stackoverflow.com/a/24583494
type: Answer
answers question: http://stackoverflow.com/q/24583475
downvote count: 0
score: 10
has body: You can use Apache Commons StringUtils.defaultString(String) method, or you can even write your own method that would be just one liner, if you're not using any 3rd party library. private static String nullToEmptyString(String str) { return str == null ? "" : str; } and then use it in your sysout as so: System.out.println("s: " + nullToEmptyString(s));
upvote count: 10

http://stackoverflow.com/q/24558080
downvote count: 0
possible better answer: http://stackoverflow.com/a/24558201
has answer: http://stackoverflow.com/a/24558201
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24558196
score: 1
favorite count: 0
has title: Epoch to Date Not Working Properly
tagged with: epoch
answer count: 3
upvote count: 1
tagged with: simpledateformat
tagged with: java
tagged with: date
has body: I am trying to do a simple epoch to date conversion using SimpleDateFormat. Whenever I run the program, I keep receiving invalid dates post-conversion. I have run the epoch stamps in a converter [and I also have the dates stored in an outside server], so I know what the output should be, but I am still receiving bad conversions. I have tried multiple mathematical changes to the long epochTime in experimenting, but to no avail. I do know [or at least am mostly sure] that my epoch timestamp is stored in milliseconds, thus requiring a * 1000 change. Here is what I have: String convertedTime = null; //(1) //startTime = startTime/1000; --none of these three manipulations solve the issue //(2) //startTime = startTime * 1000; //(3) //long change = (long) startTime * 1000; Date d = newDate(startTime); //startTime is *long* parameter passed into method SimpleDateFormat formatter = new SimpleDateFormat("mm-dd-yyyy 'at' hh:mm:ss"); convertedTime= formatter.format(d); For example, if the epoch stamp is 1404327407738 and I do not include (1), (2), (3) I receive 56-02-2014 at 01:56:47 PM Including (1) - 05-17-1970 at 12:05:27 AM Including (2) - 35-13-46471 at 05:35:38 AM Including (3) - 35-13-46471 at 05:35:38 AM (yes, I replaced change for startTime here) I should receive 07-02-2014 at 01:56:47 PM
has answer: http://stackoverflow.com/a/24558196
has answer: http://stackoverflow.com/a/79300125
linked to: http://stackoverflow.com/q/40025528

http://stackoverflow.com/q/24547943
has answer: http://stackoverflow.com/a/34208638
tagged with: gradle
type: Question
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/48284290
tagged with: intellij-idea
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/43419863
has answer: http://stackoverflow.com/a/34632810
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Suppose I have an Android application project in IntelliJ Idea with Gradle. Call it MyApplication. What I want to do is to add a plain java library module (not Android library project) as a submodule to MyApplication. Lets call this module a testlib. And then when whole project is built, I want this module compiled to jar and included to /libs folder of MyApplication. What I tried: I've created a submodule testlib and included it as a dependency to MyApplication, but I get a following warning: Warning:Gradle: module 'testlib' won't be compiled. Unfortunately you can't have non-Gradle Java module and Android-Gradle module in one project. Is this even possible?
has title: How do I add a java gradle submodule to my Android module?
has comment: http://stackoverflow.com/comment/38046251
tagged with: java

http://stackoverflow.com/a/24447891
upvote count: 1
answers question: http://stackoverflow.com/q/24447738
type: AcceptedAnswer
downvote count: 0
score: 1
has body: I don't know PIG, but in Java one syntactically-correct regex to match pqrs,234 and lmn,2345 and would be: ^\S+$ assuming you were in multiline mode. In Java you escape backslashes, so that turns into ^\\S+$ In Java you can turn on multiline with (?m) so a regex could be (?m)^\\S+$ See demo.
type: Answer
accepted answer of: http://stackoverflow.com/q/24447738

http://stackoverflow.com/comment/37934786
comment on: http://stackoverflow.com/q/24503082
type: Comment
type: QuestionComment
score: 1
has text: Java 7 doesn't allow methods of interfaces to have an implementation. So you can't implement DEFAULT as an interface. But it also doesn't allow inheriting from two different classes. So it's impossible. Java 8 allows interfaces to have default methods, which provide an implementation (but still may not have state). So Java 8 default methods *could* be the answer. But my guess is that you should use composition rather than inheritance.

http://stackoverflow.com/comment/37906644
type: AnswerComment
comment on: http://stackoverflow.com/a/24487499
score: 0
type: Comment
has text: After closing the outputstream object.out.close()

http://stackoverflow.com/comment/37897796
comment on: http://stackoverflow.com/q/24482968
has text: I might have an infinite loop for put a few iterations down the road, not sure yet.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37886651
comment on: http://stackoverflow.com/q/24477605
type: Comment
type: QuestionComment
score: 0
has text: So you aren't able to produce a few lines of Java that show how this array is declared and initialized? Are you *really* suggesting that we guess what these unintelligible characters mean?

http://stackoverflow.com/comment/37893935
has text: @JensG It's a silly question... I just put in my two cents. There's no reason to downvote just because you find it "funny". I just put out my way of doing it like everyone else did.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24473544
type: Comment

http://stackoverflow.com/a/24509523
score: 0
has comment: http://stackoverflow.com/comment/37945529
has body: Using Java 8, the method of Enne could be written like this: private static List&lt;Integer&gt; generateRandom( int low, int high ) { List&lt;Integer&gt; range = IntStream.range( low, high ).boxed() .collect( Collectors.toList() ); Collections.shuffle( range ); return range; }
answers question: http://stackoverflow.com/q/24508742
type: Answer

http://stackoverflow.com/a/26075176
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24586350
answers question: http://stackoverflow.com/q/24586350
type: Answer
has body: To see if a method of the ConnectivityManager class is callable via Reflection, try this: final Class&lt;?&gt; conmanClass = Class.forName(GlobalService.getConnectivityService(context).getClass().getName()); final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService"); iConnectivityManagerField.setAccessible(true); final Object iConnectivityManager = iConnectivityManagerField.get(GlobalService.getConnectivityService(context)); final Class&lt;?&gt; iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName()); final Method[] methods = iConnectivityManagerClass.getDeclaredMethods(); for (final Method method : methods) { if (method.toGenericString().contains("set")) { Log.i("TESTING", "Method: " + method.getName()); } } If the method does not exist (for example, setMobileDataEnabled) in the LogCat output, then it's not callable.
has comment: http://stackoverflow.com/comment/62062721
has comment: http://stackoverflow.com/comment/92107126
has comment: http://stackoverflow.com/comment/65719803
score: 1
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/72505666
has body: There is a key difference I noted when using Date() as follows. { dateWhenCreated : Date() } vs { dateWhenCreated : new Date() } Notice the "new" keyword in the second usage. Whereas the first usage loads the data "as a string", the second one loads date as a field with date data type. This might impact your sorting capability - dates stored as strings don't get sorted the same way as dates stored as dates. Per the mongodb documentation here
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24483727
type: Answer

http://stackoverflow.com/q/24581661
tagged with: libgdx
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/38080242
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24581773
has title: How do you install android apps on an android device from windows 8?
has body: I have created a game using libgdx and would like to test the game on my android phone. I have done my research but there seems to be no information on installing android apps when running windows 8. More specifically: http://developer.android.com/tools/extras/oem-usb.html there is no way to get around this part of the installation process on windows 8. As well as there is no documentation or information about installing android apps in the libgdx documentation from what i could find. if anyone could offer any insight that would be great. thanks again
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24581773
tagged with: windows-8

storage
tag name: storage
tags question: http://stackoverflow.com/q/24475790
type: Tag
tags question: http://stackoverflow.com/q/24486952

http://stackoverflow.com/comment/58601295
has text: What if I have a list of Embeddable? or element collection?
comment on: http://stackoverflow.com/a/24457687
type: Comment
score: 18
type: AnswerComment

http://stackoverflow.com/comment/38075790
has text: You mean Java 8, don't you? ;-)
comment on: http://stackoverflow.com/a/24579547
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37974719
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24525372
type: Comment
has text: Do you mean setContentView(R.layout.fish); if so, it also works but it stuck! :(

http://stackoverflow.com/a/24456664
type: Answer
has body: You miss the mockobjects-core jar. You have the mockito-all.jar not the mockobjects all ver 1.9.5 Add also mockobjects-jdk1.4-j2ee1.3.jar and remove mockobjects-jdk1.3-j2ee1.3-0.09.jar`
score: 0
answers question: http://stackoverflow.com/q/24456001

http://stackoverflow.com/comment/38065640
score: 0
comment on: http://stackoverflow.com/q/24573564
type: Comment
type: QuestionComment
has text: i've made an SSCCE, see the edit. many thanks

http://stackoverflow.com/q/24512529
tagged with: java
upvote count: 1
type: Question
has body: In Node.js, I am required to run a JAR file and therefore create a child process: var cp = require('child_process'); var child = cp.spawn('.../java.exe', ['-jar', 'C:/test.jar']); child.stdout.on('data', function(data) { console.log(data.toString()); }); child.stderr.on('data', function(data) { console.log('Error: ' + data.toString()); }); I try to use child.stdin.write('test test'); to send data to the child process, but here's where I'm stuck – I have no idea how to get this data in the Java program. I have tried the following: public static void main(String[] args) { System.out.println("Waiting for input"); Scanner s = new Scanner(System.in); String resp = s.nextLine(); System.out.println("Input got: " + resp); } ... as well as initializing DataInputStream(System.in), but alas to no avail. I see the line "Waiting for input" in Node.js, but it seems that I'm barking up the wrong tree by listening to System.in. How can I get the input that is sent from Node.js with child.stdin.write() and child.stdin.end()? Thanks in advance!
has title: Communicate with Embedded JAR File
has answer: http://stackoverflow.com/a/24537052
tagged with: ipc
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24537052
tagged with: node.js
type: AnsweredQuestion

http://stackoverflow.com/q/24445512
has body: We have to calculate numbers of "this" in a given string having multiple "this" substrings. Eg. "Hello this is a recruit and this is a veteran and this is this" would return 4. So I am using: StringTokenizer stringTokenizer1 = new StringTokenizer(input2); ArrayList&lt;String&gt; arrayList1 = new ArrayList&lt;String&gt;(); int count=0; int arrIndex = stringTokenizer1.countTokens(); for (int i = 0; i &lt; stringTokenizer1.countTokens(); i++) { arrayList1.add(stringTokenizer1.nextToken()); } for (String string2 : arrayList1) { if (string2.equals(string)) { count++; } } output1 = count; System.out.println(output1); return only 2. However, if int arrindex is assigned with the value of stringTokenizer1.countTokens() and used in looping condition, it's giving the correct result of 4. WHY?? Note:Using JavaSE-1.6
has answer: http://stackoverflow.com/a/24445653
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/37827534
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37826714
favorite count: 0
accepted answer: http://stackoverflow.com/a/24445653
type: AnsweredQuestion
has title: StringTokenizer.countTokens() returning erroneous value in for loop condition
tagged with: java
has comment: http://stackoverflow.com/comment/37827185
upvote count: 1
possible better answer: http://stackoverflow.com/a/24445604
has comment: http://stackoverflow.com/comment/37826707
type: Question
has answer: http://stackoverflow.com/a/24445604
has comment: http://stackoverflow.com/comment/37827074
has comment: http://stackoverflow.com/comment/37826622
has comment: http://stackoverflow.com/comment/37826689
tagged with: stringtokenizer

jboss
tags question: http://stackoverflow.com/q/24565960
tags question: http://stackoverflow.com/q/24452075
tags question: http://stackoverflow.com/q/24428652
tags question: http://stackoverflow.com/q/24428433
tags question: http://stackoverflow.com/q/24574046
tags question: http://stackoverflow.com/q/24429478
tags question: http://stackoverflow.com/q/24436732
tags question: http://stackoverflow.com/q/24476917
tag name: jboss
tags question: http://stackoverflow.com/q/24432897
tags question: http://stackoverflow.com/q/24468940
tags question: http://stackoverflow.com/q/24474774
type: Tag
tags question: http://stackoverflow.com/q/24586957
tags question: http://stackoverflow.com/q/24541813
tags question: http://stackoverflow.com/q/24558158
tags question: http://stackoverflow.com/q/24444633
tags question: http://stackoverflow.com/q/24473247
tags question: http://stackoverflow.com/q/24429729
tags question: http://stackoverflow.com/q/24514240
tags question: http://stackoverflow.com/q/24505418
tags question: http://stackoverflow.com/q/24587878
tags question: http://stackoverflow.com/q/24434914
tags question: http://stackoverflow.com/q/24483998

http://stackoverflow.com/comment/38055190
has text: To be honest, I don't think it actually make sense to test individual translations. What if your terminology change? Just like that you'll end up with multiple test failures. And your code will be correct. You should test behaviours, not specifics. And the behaviour here is, your screen got translated. The whole screen, not the individual words for translation may be the same word in a target language...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24553068

http://stackoverflow.com/comment/37973139
score: 0
comment on: http://stackoverflow.com/a/24524170
type: Comment
has text: Have you tested the command on the command line to make sure it works?
type: AnswerComment

http://stackoverflow.com/a/24583716
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24583688
has body: Try this code, You can input valus in to a double array String s1 = "1256,125662"; String []arr=s1.split(","); double []numArr =new double[arr.length]; for (int i = 0; i &lt; arr.length; i++) { numArr[i] = Double.parseDouble(arr[i]); }

http://stackoverflow.com/comment/38088287
has text: On my machine, it takes 649 milliseconds to generate 2205 random floats, initialize an array of 2205 floats with these random values and print them to System.out, 1000 times. So initializing 2205 floats with random values and printing them takes 0.65 milliseconds. I don't see how it could take 100 milliseconds just to initialize 2205 floats on your machine. You're probably not measuring correctly, and you're probably trying to optimize the wrong part. Without code, we can't say nothing more, anyway.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24586308

http://stackoverflow.com/comment/37949749
has text: I just had the chance to check it and it works. Thanks!
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24493467

http://stackoverflow.com/q/24459480
downvote count: 2
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/24459514
type: Question
accepted answer: http://stackoverflow.com/a/24459514
score: -1
tagged with: jtable
answer count: 1
has title: getRowHeight() in java method
favorite count: 0
has body: I dont understand how to implement this method in my table class import javax.swing.table.AbstractTableModel; public class Tabel extends AbstractTableModel{ Object columnNames[]; Object rowData[][]; public Tabel(Object[][] rowData2, Object[] columnNames2) { rowData=rowData2; columnNames=columnNames2; } @Override public int getColumnCount() { return columnNames.length; } public int getRowCount() { return rowData.length; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return rowData[rowIndex][columnIndex]; } public void SetValoare(Object value,int row ,int col) { rowData[row][col]=value; fireTableCellUpdated(row,col); } public int getRowHeight() { } public void ChangeHeight(int row,int column) { int i=rowData.length; } } I don't now what to return because if I write something like this return rowData.height; doesn't work i need this to make a method that changes the height of a specific row and column
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24466183
has answer: http://stackoverflow.com/a/24466312
score: 2
downvote count: 0
has body: public class HandleUI { public static void setUpUI(){ JPanel jPan = new JPanel(); FlowLayout flow = new FlowLayout(); jPan.setLayout(flow); txtFld = new JTextField(); txtFld.setSize(550,5); jPan.add(txtFld); jPan.setSize(10,200); MainClass.mainFrame.add(jPan); int gapX = MainClass.mainFrame.getX()-(txtFld.getX()/2); } //Instance variables. public static JTextField txtFld; public JButton [] buttons; } public class MainClass { public static void main (String [] args){ int frameX = Constants.FRAME_WIDTH; int frameY = Constants.FRAME_HEIGHT; mainFrame = new JFrame(); mainFrame.setSize(frameX,frameY); mainFrame.setResizable(false); mainFrame.setVisible(true); HandleUI.setUpUI(); } //Instance variables public static JFrame mainFrame; } It's supposed to show JTextField, but as you might have guessed - JFrame shows nothing. I didn't type in imports on purpose, but they are all there. I can't find the problem. Can anyone help?
type: UnansweredQuestion
tagged with: awt
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24466295
tagged with: swing
has title: Java: JTextField won't appear
tagged with: java

http://stackoverflow.com/a/24544696
score: 2
has comment: http://stackoverflow.com/comment/38011216
has body: Thanks to EJP who pointed me in correct direction but one has to keep in mind that keys contains serverSocketChannel as well. Anyway following code worked for me on shutdown in case you are looking for a piece of code. if(this.serverChannel != null &amp;&amp; this.serverChannel.isOpen()) { try { this.serverChannel.close(); } catch (IOException e) { log.error("Exception while closing server socket"); } } try { Iterator&lt;SelectionKey&gt; keys = this.selector.keys().iterator(); while(keys.hasNext()) { SelectionKey key = keys.next(); SelectableChannel channel = key.channel(); if(channel instanceof SocketChannel) { SocketChannel socketChannel = (SocketChannel) channel; Socket socket = socketChannel.socket(); String remoteHost = socket.getRemoteSocketAddress().toString(); log.info("closing socket {}", remoteHost); try { socketChannel.close(); } catch (IOException e) { log.warn("Exception while closing socket", e); } key.cancel(); } } log.info("closing selector"); selector.close(); } catch(Exception ex) { log.error("Exception while closing selector", ex); }
downvote count: 0
has comment: http://stackoverflow.com/comment/38011377
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24543675

http://stackoverflow.com/a/24572595
answers question: http://stackoverflow.com/q/24571772
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Your last comment actually clarifies the question a bit. Assuming you are looking for a dot-separated sequence of 1 or 2 digits, externally delimited by whitespace, here's an example: String ok = "CPI WEIGHTS 05.1.2 : CARPETS &amp; OTHER FLOOR COVERINGS"; String notOk = "CPIH INDEX 05.2 : HOUSEHOLD TEXTILES 2005=100"; Pattern p = Pattern.compile("(\\d{1,2}(\\.|\\s)){3}"); Matcher m = p.matcher(ok); while (m.find()) { System.out.printf("Found: %s%n", m.group()); } m = p.matcher(notOk); while (m.find()) { System.out.printf("Found: %s%n", m.group()); } Output Found: 05.1.2
accepted answer of: http://stackoverflow.com/q/24571772

http://stackoverflow.com/comment/37860288
type: AnswerComment
type: Comment
has text: grr...I said to remove .class that you were putting at the end while running command not from system..Just Compile it using javac /users/.../HelloWorld.java after that a .class file will be generated at that location..dont delete that file.its bytecode..now run your program java /users/.../HelloWorld
comment on: http://stackoverflow.com/a/24463557
score: 0

http://stackoverflow.com/q/24513280
has body: here is the asmx method: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public String mtdImporteUsuario() { JavaScriptSerializer ser = new JavaScriptSerializer(); List&lt;UsuarioBO&gt; usuarios = new List&lt;UsuarioBO&gt;(); try { query = new Procedimientos().QSelectAllUsers(); ds = new ConexionBD().mtdEjecutaQuery_DS(query, "Usuarios"); foreach (DataRow dr in ds.Tables[0].Rows) { usuarios.Add(new UsuarioBO { O_COD = 1, O_MENSAJE = "OK", NId_usuario = Convert.ToInt32(dr["idusuario"]), SCod_cuenta = dr["cuenta"].ToString(), SCod_password = dr["password"].ToString(), NNum_rut = Convert.ToInt32(dr["num_RutUsuario"]), SDv_rut = dr["dv_RutUsuario"].ToString(), SGls_nombre = dr["primer_nombre"].ToString(), SGls_apellido_paterno = dr["apellido_paterno"].ToString(), SGls_apellido_materno = dr["apellido_materno"].ToString(), NId_perfil = Convert.ToInt32(dr["idperfil"]) }); } } catch (Exception ex) { throw ex; } return ser.Serialize(usuarios); } and the response is: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;string xmlns="http://tempuri.org/"&gt;[{"O_COD":1,"O_MENSAJE":"OK","NId_usuario":4,"NId_perfil":1155,"NNum_rut":10584082,"SGls_nombre":"Juan","SCod_cuenta":"jancan","SCod_password":"12345","SFoto":"","SFotoOri":"","SGls_apellido_paterno":"Ancan","SGls_apellido_materno":"","SDv_rut":"9"},{"O_COD":1,"O_MENSAJE":"OK","NId_usuario":13,"NId_perfil":1155,"NNum_rut":10584080,"SGls_nombre":"Marco","SCod_cuenta":"msuazo","SCod_password":"msuazo","SFoto":"","SFotoOri":"","SGls_apellido_paterno":"Suazo","SGls_apellido_materno":"","SDv_rut":"2"},{"O_COD":1,"O_MENSAJE":"OK","NId_usuario":15,"NId_perfil":1122,"NNum_rut":10584082,"SGls_nombre":"Administrador","SCod_cuenta":"gallendes","SCod_password":"joi7jiuml","SFoto":"","SFotoOri":"","SGls_apellido_paterno":"","SGls_apellido_materno":"tratos","SDv_rut":"9"},{"O_COD":1,"O_MENSAJE":"OK","NId_usuario":16,"NId_perfil":1155,"NNum_rut":11072809,"SGls_nombre":"Juan","SCod_cuenta":"jchavez","SCod_password":"claudia","…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24513563
has title: Returned List<Object> in JSON from C# and read in java application
type: Question
tagged with: c#
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37951934
answer count: 1
score: 0
tagged with: android

jms
tags question: http://stackoverflow.com/q/24489807
tags question: http://stackoverflow.com/q/24455263
tags question: http://stackoverflow.com/q/24472465
tag name: jms
tags question: http://stackoverflow.com/q/24580794
tags question: http://stackoverflow.com/q/24558158
tags question: http://stackoverflow.com/q/24501329
tags question: http://stackoverflow.com/q/24447170
type: Tag
tags question: http://stackoverflow.com/q/24511060
tags question: http://stackoverflow.com/q/24493900
tags question: http://stackoverflow.com/q/24438906
tags question: http://stackoverflow.com/q/24514240
tags question: http://stackoverflow.com/q/24456438
tags question: http://stackoverflow.com/q/24515631

http://stackoverflow.com/comment/38070561
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24574491
has text: @IanRoberts is Groovy a typed language? The hardest part about this is the mapping of the variables based on their types or classes, and modifying the right variable. I was thinking about this in terms of Reflection, but I couldn't get it right yet. I might tinker with it at home later.
score: 0

http://stackoverflow.com/comment/38222982
type: AnswerComment
has text: Maybe this hint could help : in one of my builds files an error of duplicate definitions of class in the third party library package appear, since this error appear i avoided using that way of importing libraries.@RafaelOsipov
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24624699

http://stackoverflow.com/q/24451124
has title: Spark with Cassandra input/output
type: Question
type: AnsweredQuestion
tagged with: spring-data-cassandra
has comment: http://stackoverflow.com/comment/37882602
has comment: http://stackoverflow.com/comment/37889880
has comment: http://stackoverflow.com/comment/37847467
has comment: http://stackoverflow.com/comment/37847338
answer count: 2
tagged with: apache-spark
accepted answer: http://stackoverflow.com/a/24497658
downvote count: 0
has answer: http://stackoverflow.com/a/24471624
linked to: http://stackoverflow.com/q/27130321
favorite count: 0
tagged with: cassandra
upvote count: 8
has comment: http://stackoverflow.com/comment/37899749
has comment: http://stackoverflow.com/comment/37873500
possible better answer: http://stackoverflow.com/a/24471624
has comment: http://stackoverflow.com/comment/37924323
has body: Picture the following senario: A Spark application (Java implementation) is using Cassandra database to load, convert to RDD and process the data. Also the application is steaming new data from the database which are also processed by a custom receiver. The output of the streaming process is stored in the database. The implementation is using Spring Data Cassandra from the integration with the database. CassandraConfig: @Configuration @ComponentScan(basePackages = {"org.foo"}) @PropertySource(value = { "classpath:cassandra.properties" }) public class CassandraConfig { @Autowired private Environment env; @Bean public CassandraClusterFactoryBean cluster() { CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean(); cluster.setContactPoints(env.getProperty("cassandra.contactpoints")); cluster.setPort(Integer.parseInt(env.getProperty("cassandra.port"))); return cluster; } @Bean public CassandraMappingContext mappingContext() { return new BasicCassandraMappingContext(); } @Bean public CassandraConverter converter() { return new MappingCassandraConverter(mappingContext()); } @Bean public CassandraSessionFactoryBean session() throws Exception { CassandraSessionFactoryBean session = new CassandraSessionFactoryBean(); session.setCluster(cluster().getObject()); session.setKeyspaceName(env.getProperty("cassandra.keyspace")); session.setConverter(converter()); session.setSchemaAction(SchemaAction.NONE); return session; } @Bean public CassandraOperations cassandraTemplate() throws Exception { return new CassandraTemplate(session().getObject()); } } DataProcessor.main method: // Initialize spring application context ApplicationContext applicationContext = new AnnotationConfigApplicationContext(CassandraConfig.class); ApplicationContextHolder.setApplicationContext(applicationContext); CassandraOperations cassandraOperations = applicationContext.getBean(CassandraOperations.class); // Initialize spark context SparkConf conf = new SparkConf().setAppName("test-spark").se…
score: 8
tagged with: java
has answer: http://stackoverflow.com/a/24497658

http://stackoverflow.com/q/24427592
score: 0
has answer: http://stackoverflow.com/a/24428163
answer count: 1
has comment: http://stackoverflow.com/comment/37793710
accepted answer: http://stackoverflow.com/a/24428163
tagged with: android
has title: using Thread multiple times for updating UI
has body: I write some timer. and I want to display it in textview after start button is clicked. What I did. Every time I timer = new Thread(new Runnable() { @Override public void run() { while (!stopedButton ) { time = ""; if (timerMinutes &gt;= 60) { timerMinutes = 0; timerHours++; } if (timerHours &lt; 10) time = "0" + String.valueOf(timerHours) + ":"; else time = String.valueOf(timerHours) + ":"; if (timerMinutes &lt; 10) time += "0" + String.valueOf(timerMinutes); else time += String.valueOf(timerMinutes); runOnUiThread(new Runnable() { public void run() { if (!stopedButton) { mTimeFromStartValue.setText(time); timerMinutes++; } else { timerMinutes = 0; timerHours = 0; } } }); Log.e(TAG, ""+timerHours); Log.e(TAG, ""+timerMinutes); Log.e(TAG, time); try { Thread.sleep(1 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }); so it works fine, but every time after stop and then start and after doing it many times my timer starts working fast. I try to avoid that kind of situation and I thought that i don't need to create new timer every time. But I need to have working timer after stop start too. I wrote some code like this: if(timer.isAlive()){ timer.resume(); }else{ timer.start(); } But I have got this exception: java.lang.IllegalThreadStateException: Thread already started so how to solve this ?
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question

http://stackoverflow.com/a/24529525
answers question: http://stackoverflow.com/q/24528222
has comment: http://stackoverflow.com/comment/37985507
accepted answer of: http://stackoverflow.com/q/24528222
score: 15
type: AcceptedAnswer
has body: Liquibase uses two separate actions for updating directly and generating SQL. use mvn liquibase:update to update the database use mvn liquibase:updateSQL to generate SQL If the goal is bound to a lifecycle, you need to change that.
has comment: http://stackoverflow.com/comment/37988245
type: Answer
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/38023797

http://stackoverflow.com/q/24450874
accepted answer: http://stackoverflow.com/a/24450976
tagged with: java
tagged with: compression
has comment: http://stackoverflow.com/comment/37857951
type: Question
linked to: http://stackoverflow.com/q/736556
has body: I have problem, rather close to Binary search in a sorted (memory-mapped ?) file in Java I want to implement binary search for string in a large file with java MappedByteBuffers but in my case, large file is compressed with bzip2. Let's say that file was compressed with -1 option 100k block. (Actually I don't know exact options but I can repak file). How should I search strings in such MappedByteBuffer? How to decompress 1 block? Is there some standart lib or I should read header, deflate section and crc? And will those block be 100k in compressed state, or 100k it's uncompressed data length? And how last block looks like? Have somebody done BinarySearch over compressed file, maybe not with Java?
tagged with: nio
tagged with: binary-search
score: 0
answer count: 1
has title: How to do Binary Search over memory mapped compressed file in java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24450976

http://stackoverflow.com/q/24470281
favorite count: 0
has comment: http://stackoverflow.com/comment/37872626
has comment: http://stackoverflow.com/comment/37872757
has comment: http://stackoverflow.com/comment/37872714
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37872597
score: -3
tagged with: swing
has title: To sustain the value of a variable
type: Question
has body: My code is as follows: private void okJButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: srcLang=(srcLangJComboBox.getSelectedItem().toString()); targLang=(targLangJComboBox.getSelectedItem().toString()); infoNew.this.setVisible(false); } /** * @param args the command line arguments */ public static String[] newButton() { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(infoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(infoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(infoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(infoNew.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new infoNew().setVisible(true); } }); System.out.println(srcLang); return new String[]{srcLang,targLang}; } There are two functions lower one invoking the upper function as a jframe button the upper function receives the value of two variables which are of public in nature but the values assigned them to here is not available in the lower function. The value assigned …
has answer: http://stackoverflow.com/a/24470307
tagged with: java
downvote count: 3
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24470315

http://stackoverflow.com/comment/38015745
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24547173
score: 2
has text: Possible [duplicate](http://stackoverflow.com/q/3191837/230513).

http://stackoverflow.com/comment/37872617
has text: Well, `ENUM1`, `ENUM2`, and `ENUM3` all have to be constructed, don't they?
type: QuestionComment
comment on: http://stackoverflow.com/q/24470288
score: 3
type: Comment

http://stackoverflow.com/comment/37883034
comment on: http://stackoverflow.com/q/24475818
score: 0
has text: "The problem is that the alghoritm gives me a different output using the same input string" No it doesn't. For input `Test`, it gives output `640ab2bae07bedc4c163f679a746f7ab7fb5d1fa` (which is the correct hash), every time.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38286802
has text: Hi Please tell me y is happening so i searched all around and tryed all the possible ways of adding external lib but still on luck,on cleaning the application error goes and on compilation again it throws error..couldn't find import for class com.android.internal.telephony.OperatorInfo
type: AnswerComment
comment on: http://stackoverflow.com/a/24573593
score: 0
type: Comment

http://stackoverflow.com/comment/37873427
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24469412
has text: I edited 1st post, check it now and tell me if it's ok this time.

http://stackoverflow.com/a/24498542
type: Answer
answers question: http://stackoverflow.com/q/24493525
has body: If the fromUser and toUser columns are both of type Pointer&lt;_User&gt;, and you've confirmed that both user and targetUser are both ParseUser objects then the query should work. Try logging the objectId of each user, and comparing that to what shows in the Data Browser in your Admin Dashboard to confirm a record will match. It sounds like a data issue.
has comment: http://stackoverflow.com/comment/38548002
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24493525

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/24502568
tags question: http://stackoverflow.com/q/24436732

http://stackoverflow.com/a/24578678
has comment: http://stackoverflow.com/comment/38075499
score: 0
answers question: http://stackoverflow.com/q/24578648
type: Answer
has comment: http://stackoverflow.com/comment/38074656
has body: Use a try catch block, and put x = in.nextInt(); inside it

http://stackoverflow.com/comment/38056865
type: Comment
comment on: http://stackoverflow.com/q/24568488
score: 0
type: QuestionComment
has text: I sincerely don't understand the downvote but its fine to me I can trade knowledge for reputation here.

http://stackoverflow.com/comment/37963232
has text: its Java not Javascript
score: 0
comment on: http://stackoverflow.com/q/24519209
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24574179
tagged with: java
has body: In my project which is based on spring with mongodb.When i try to get the video of any particular date(17-05-2014) then i get all video of that date(17-05-2014) alongwith some video from next date(18-05-2014) and when i try to fetch the video of next date(18-05-2014) then those video which is get in previous date(17-05-2014) are not come in this time. The code of query is: SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy"); Calendar c = Calendar.getInstance(); String frd="11082013" c.setTime(sdf.parse(frd)); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); //getting the date in the above format with above hr,min and sec. Date start = c.getTime(); String td= "11082013"; c.setTime(sdf.parse(td)); c.set(Calendar.HOUR, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); Date end = c.getTime(); //creating a query for fatch all video from mongodb on the basis of starting and ending date org.springframework.data.mongodb.core.query.Query query = new org.springframework.data.mongodb.core.query.Query().addCriteria(Criteria .where("creationTime.logtime").gte(start).lte(end)); //sorting data on the basis of logtime in ascending order query.sort().on("creationTime.logtime", Order.ASCENDING); //Getting the Video data in the form of list on the basis of above query and sorting from video collection List&lt;Video&gt; videos = mongoTemplate.find(query, Video.class, "video"); and the mongodb structure is like this "_id" : ObjectId("xxxx"), "_class" : "Video", "videoid" : "2666210586001", "title" : "Trial1", "desc" : "", "creationTime" : { "logtime" : ISODate("2013-09-12T08:39:07.227Z"), "logtimeStr" : "12-09-2013 02:09:07", "day" : 12, "month" : 9, "year" : 2013, "hour" : 14, "min" : 9, "second" : 7 }, "updatetime" : { "logtime" : ISODate("2013-09-12T08:39:07.227Z"), "logtimeStr" : "12-09-2013 02:09:07", "day" : 12, "month" : 9, "year" : 2013, "hour" : 14, "min" : 9, "second" : 7 }, "userName" : "ABC", "userId" : "xxxx" This problem is not …
answer count: 1
has title: Getting wrong output when deploy on server :Getting the video detail between two dates
tagged with: mongodb
type: UnansweredQuestion
tagged with: date
has answer: http://stackoverflow.com/a/24590986
type: Question
tagged with: video
score: 0

http://stackoverflow.com/comment/38049968
has text: If you want to display several pieces of information you just have to concatenate the information. For example: `textView.setText("Country: "+CountryArray[position]+". Capital: "+CapitalArray[position]+"...");`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24565393

http://stackoverflow.com/a/24501980
has comment: http://stackoverflow.com/comment/37932604
has comment: http://stackoverflow.com/comment/37932260
has comment: http://stackoverflow.com/comment/37932516
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24501813
has body: The long and short of it all is, you'll need to use BufferedImage#getSubImage to carve the base image up. You'll need to write some kind of conversion routine that can take a String and either generate a single image or return back the sub images required to generate it, for example import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class FontImage { public static void main(String[] args) { new FontImage(); } public FontImage() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private BufferedImage img; public TestPane() { try { img = ImageIO.read(getClass().getResource("/EwnpgTF.png")); } catch (IOException ex) { ex.printStackTrace(); } } public List&lt;BufferedImage&gt; convert(String text) { List&lt;BufferedImage&gt; images = new ArrayList&lt;&gt;(25); for (char c : text.toCharArray()) { c = Character.toUpperCase(c); int smudge = 1; int offset = -1; if (c &gt;= 48 &amp;&amp; c &lt;= 57) { offset = c - 48; } else if (c &gt;= 65 &amp;&amp; c &lt;= 90) { offset = c - 65 + 10; } else if (c == 32) { offset = 48; smudge = 2; } if (offset &gt;= 0) { BufferedImage sub = img.getSubimage((offset * 8) + smudge, 0, 8 …
answers question: http://stackoverflow.com/q/24501813
has comment: http://stackoverflow.com/comment/37932276
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/38028299
type: Comment
score: 2
has text: This will include \ in name. do `text.lastIndexOf("\\")+1` to remove it.(_BTW Not a Downvoter_)
comment on: http://stackoverflow.com/a/24554116
type: AnswerComment

http://stackoverflow.com/a/24438161
answers question: http://stackoverflow.com/q/24433089
type: Answer
upvote count: 7
has body: By default javax.swing.undo.UndoManager retains each undoable edit, including the one that removes of the original text (your step three). Individual edits are inaccessible, but you can group edits using the approach cited here. Some additional notes on your example: For better cross-platform results, use getMenuShortcutKeyMask() as suggested here. Use a layout; if necessary, invoke setSize() after pack(), as shown here. Swing GUI objects should be constructed and manipulated only on the event dispatch thread. Code: import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.text.Document; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; @SuppressWarnings("serial") public class JTextComponentSetTextUndoEvent extends JFrame { private static final int MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); private JTextArea area = new JTextArea(); private UndoManager undoManager = new UndoManager(); public JTextComponentSetTextUndoEvent() { setDefaultCloseOperation(EXIT_ON_CLOSE); area.setText("Test"); add(area); JButton btnSettext = new JButton("setText()"); btnSettext.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { area.setText("stackoverflow.com"); } }); add(btnSettext, BorderLayout.PAGE_END); Document doc = area.getDocument(); doc.addUndoableEditListener(new UndoableEditListener() { @Override public void undoableEditHappened(UndoableEditEvent e) { undoManager.addEdit(e.getEdit()); System.out.println(e); }…
score: 7
downvote count: 0

http://stackoverflow.com/q/24521836
answer count: 1
has answer: http://stackoverflow.com/a/24521893
tagged with: android
type: AnsweredQuestion
has title: Change Action Bar Title using a string for Android
tagged with: java
accepted answer: http://stackoverflow.com/a/24521893
type: Question
score: 0
has body: I want to change the Action Bar title in the .java file depending on which cell is tapped. When the new activity is called here, I am only able to change the action bar title through the xml file, but I want to use a string from my previous activity (in order to change the action bar title to whatever the cell title was in the previous activity). In this case the String would be sText public class ListViewAndroidExample extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.list_view_android_example, menu); return super.onCreateOptionsMenu(menu); } ListView listView ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view_android_example); try { setContentView(R.layout.activity_list_view_android_example); ListView mlistView = (ListView) findViewById(R.id.list); mlistView.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, new String[] {"#unlv", "#unr", "#ucla", "#usc"})); mlistView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // When clicked, show a toast with the TextView text Game, Help, Home Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT).show(); String sText = ((TextView) view).getText().toString(); Intent intent; intent = new Intent(ListViewAndroidExample.this, ChatRoom.class); startActivity(intent); //else if(sText.equals("Help")) .......... } }); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Created by Jason on 6/30/2014. */ public static class ChatRoom extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.chatlayout); this.getW…

processbuilder
tags question: http://stackoverflow.com/q/24501217
tag name: processbuilder
tags question: http://stackoverflow.com/q/24552261
tags question: http://stackoverflow.com/q/24438941
type: Tag

http://stackoverflow.com/q/24556825
tagged with: java
type: Question
score: 0
has body: I just want to know the difference between "Xpath Splitter"(&lt;int-xml:xpath-splitter&gt;) and "Splitter"(&lt;/int:splitter&gt;) of Spring Integration framework. Can anybody explain please?
answer count: 1
has answer: http://stackoverflow.com/a/24560059
accepted answer: http://stackoverflow.com/a/24560059
tagged with: spring
has title: What is the difference between "Xpath Splitter" and "Splitter" in Spring Integration?
type: AnsweredQuestion
tagged with: spring-integration

http://stackoverflow.com/q/24480382
has title: Java thread lock when trying to lock/unlock with ReetrantLock(true)
tagged with: multithreading
has answer: http://stackoverflow.com/a/24480431
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: locking
answer count: 1
accepted answer: http://stackoverflow.com/a/24480431
tagged with: deadlock
score: 0
has body: I am having some trouble with a ReetrantLock(true) in an application that checks the difference between two images and shows similarity based on a percentage. For some reason my input thread for reading in the minimum percent for being "similar" calls lock.lock() and that particular thread just deadlocks indefinitely but I can't seem to figure out why only that thread is deadlocking. In the SSCCE below in the main method main(String[]) the inline Thread is used to get input from the console and if I type any number in it correctly stores it but as soon as it calls lock.lock() it deadlocks indefinitely and I am unsure why because the ReetrantLock has been told to be fair to caller threads and try to order them for when they called. private static volatile boolean running = false; public static void main(String[] args) { webcam2 webcam = new webcam2(); webcam.start(); (new Thread(new Runnable() { @Override public void run() { Scanner scanner = new Scanner(System.in); while (running) { System.out.print("Enter Double: "); double val = scanner.nextDouble(); lock.lock(); // locks indefinatly here if (val &lt; 0.0D) reset = true; dif = val; System.out.println("Searching for value: " + dif); lock.unlock(); } scanner.close(); } })).start(); } private static double dif = 0.0D; private static boolean reset = false; private static ReentrantLock lock = new ReentrantLock(true); @Override public void run() { try { while (running) { // show image on window lock.lock(); if (reset == true) { reset = false; lock.unlock(); doComplexStuffToImage(); } lock.lock(); doComplexStuffToImage(); lock.unlock(); } } catch (Exception e) { e.printStackTrace(); } } private static void doComplexStuffToImage() { try { Thread.sleep(1000); } catch(InterruptedException ie) { //swallow exception } } public void start() { new Thread(this).start(); running = true; } public void stop() { running = false; }

http://stackoverflow.com/comment/37878219
type: AnswerComment
type: Comment
has text: I tried the Collection.shuffle as you said and it works. I guess that the way I used it before was incorrect, so by that, thanks to you!
comment on: http://stackoverflow.com/a/24473196
score: 0

http://stackoverflow.com/a/24499478
accepted answer of: http://stackoverflow.com/q/24499272
type: Answer
has comment: http://stackoverflow.com/comment/37935157
upvote count: 1
has comment: http://stackoverflow.com/comment/37927923
score: 1
has body: Ok, from your comments we can infer the difference between executing it from eclipse and executing it from a .jar. From eclipse: it works, because all that new File(...) find an actual file in Resources/ From the .jar: it won't work, since there is no file in a relative ./Resources/ path from the execution path of the application. The way to make it work is the next: Make sure Eclipse recognizes Resources/ as a source folder (right-click on project properties, Java Build Path, and add it as a source path) Look for a replacement for your API methods that, instead of File objects, use InputStreams. Once you have it, retrieve all your resources as InputStreams taken from the classpath. If you are inside MyClass.java, do this: MyClass.class.getClassLoader().getResourceAsStream("Resources/inv.txt"), etc. What you have achieved by doing this: instead of File objects built on actual operating system files, you will be retrieving InputStreams read straight from your java application classpath. This way, you can package them into a jar, or into a WEB-INF/classes directory inside a web application, or a library folder in some application servers... wherever you like as long as it is into the application classpath. I would do this if I had to package your application in a portable and usable way.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24499272

http://stackoverflow.com/comment/37997591
type: Comment
type: QuestionComment
has text: so which value gets returned? the value on the left side or right side ? and what is it based on ?
comment on: http://stackoverflow.com/q/24537621
score: 0

http://stackoverflow.com/a/24541159
has body: As @JonSkeet pointed out already, you can't generalize switch statements to do what you're trying to do. In some cases however you can "trick" it: with strings, for example, you can use a switch statement for exact matches. In your case you can also do it in a slightly obfuscated way with regex: Pattern pattern = Pattern.compile("something|else"); Matcher matcher = pattern.matcher(properties.getProperty("my.property")); switch(matcher.find() ? matcher.group() : "") { case "something": doSomething(); break; case "else": doSomethingElse(); break; default: doDefault(); } I don't think the above offers any improvement over the obvious approach with ifs: if(prop.contains("something")) { doSomething(); } else if(prop.contains("else")) { doSomethingElse(); } The second version is both simpler and more readable. Possibly faster, too.
type: Answer
answers question: http://stackoverflow.com/q/24540387
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/24432971
answers question: http://stackoverflow.com/q/24432740
type: Answer
score: 2
upvote count: 2
has body: I want to get location of pointer related to screen after user clicked a button.. On button click: Hide the frame. Get a screenshot of the entire desktop. Show the screenshot in a JLabel in a JWindow Add a MouseListener to the label. Get the Point from the MouseEvent. E.G. similar to what is shown in this answer.
downvote count: 0

http://stackoverflow.com/comment/67136428
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24558850
type: AnswerComment
has text: Why is the fallback `false` for OR and `true` for AND?

http://stackoverflow.com/comment/38060776
comment on: http://stackoverflow.com/q/24571317
type: Comment
type: QuestionComment
score: 0
has text: I'm guessing they are utf-8 values. just make sure you handle them correctly when you print them out. ofcourse based on your output stream sometimes you can't deal with them. for example in command prompt special chars will be some funny shapes.

http://stackoverflow.com/comment/38040270
has text: Can you clarify how exactly you are spawning the child process? I assume if you run the command from the shell (using the generated script) it works, right? Can you provide a snippet the Scala code launching the process that fails?
score: 0
comment on: http://stackoverflow.com/q/24559368
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38014660
type: QuestionComment
has text: really? What OS are you using?
score: 0
comment on: http://stackoverflow.com/q/24544926
type: Comment

http://stackoverflow.com/comment/37804421
comment on: http://stackoverflow.com/q/24430998
has text: Side note : I could not compile this code in `MAPREDUCE` mode because of a missing dependency (see https://issues.apache.org/jira/browse/PIG-3315). Also, I'm having troubles executing the script with grunt in local mode. Could you please tell me if that's the same with you ?
score: 0
type: Comment
type: QuestionComment

jbehave
tags question: http://stackoverflow.com/q/24524308
tag name: jbehave
type: Tag

http://stackoverflow.com/comment/37864772
type: Comment
type: QuestionComment
score: 0
has text: @Tjoudrey: Please, next time write comment to the line where is problem. Now we have to copy your code and check were is line 74. Make it easier for us so we can help you faster ;)
comment on: http://stackoverflow.com/q/24441831

http://stackoverflow.com/comment/37818953
comment on: http://stackoverflow.com/q/24441002
type: Comment
has text: @MadProgrammer yes, I just made sure. I tried FileCopyFromJAR.copy("folder\\test.txt", "c:\\test.txt"); I get a NullPointerException.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/117139482
has text: In my case, the analog ".createPostTransaction () " has no parameters((
type: Comment
comment on: http://stackoverflow.com/a/59249216
score: 3
type: AnswerComment

http://stackoverflow.com/comment/50596460
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24431427
has text: There's a nice example here also: http://www.blog.project13.pl/index.php/coding/1077/runwith-junit4-with-both-springjunit4classrunner-and-parameterized/
score: 2

http://stackoverflow.com/q/24479069
has body: I am presently working on a simple ObjectInputStream and ObjectOutputStream, I have read both the documentation and the Java tutorial and am familiar with the basics; however, in attempting to compile my program, I am encountering an error that may be related to my misunderstanding of the combination of Maps and Object input/output, specifically the input portion. I have a .dat file, from which I am trying to read a list of objects that get mapped into a TreeMap: public class Product implements Serializable { private static final long serialVersionUID = 1L; private int code; private String name; private int quatity; // Setters and Getters } Above, is the code fragment for the Product object, itself - implementing Serializable. I include the fragment in case the problem lies, there. For this question, assume the .dat is not empty and contains properly formatted data. Here is my ObjectInputStream code: try (ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(file))) { while (true) { try { products = (Map&lt;Integer, Product&gt;) inputStream.readObject(); } catch (ClassNotFoundException cnfException { System.out.println("ClassNotFoundException: " + cnfException.getMessage()); } catch (EOFException eofException) { System.err.println("EOFException: " + eofException.getMessage()); } } When attempting to run this code, I get the following error (a Cast error): Here is how I am writing Product objects to the .dat file: try (ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(fileName))) { for (int i = 0; i &lt; products.size(); i++) { outputStream.writeObject(products.get(i)); } } Having isolated the error, I know the error occurs when I hit the products = portion. I am unsure if this is a compound issue or if this is one of two issues: I am not properly grabbing the data from the file in order to populate the TreeMap I am misunderstanding the implementation of ObjectInputStream
type: AnsweredQuestion
tagged with: treemaps
has comment: http://stackoverflow.com/comment/37889301
type: Question
has answer: http://stackoverflow.com/a/24479116
score: 0
answer count: 1
tagged with: objectinputstream
has title: Reading Objects From A File to An Input Stream
has comment: http://stackoverflow.com/comment/37889269
tagged with: java
accepted answer: http://stackoverflow.com/a/24479116

http://stackoverflow.com/comment/73927777
comment on: http://stackoverflow.com/a/24612268
type: Comment
score: 0
type: AnswerComment
has text: You should put it into `MyProject/Web Pages/META-INF/context.xml`

http://stackoverflow.com/a/24520937
answers question: http://stackoverflow.com/q/24520702
accepted answer of: http://stackoverflow.com/q/24520702
has body: It should be android:theme="@style/green" in your manifest.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/24566313
tagged with: java
possible better answer: http://stackoverflow.com/a/24566383
type: Question
has title: Instantiating a interface CharSequence
has body: CharSequence[] items = { “Google”, “Apple”, “Microsoft” }; if CharSequence is an interface then, in the above example aren't we instantiating a interface?
downvote count: 0
has answer: http://stackoverflow.com/a/24566342
accepted answer: http://stackoverflow.com/a/24566342
tagged with: charsequence
has answer: http://stackoverflow.com/a/24566425
answer count: 3
has answer: http://stackoverflow.com/a/24566383
favorite count: 0
tagged with: interface
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38051529
upvote count: 3

http://stackoverflow.com/q/24515940
tagged with: hashmap
downvote count: 0
linked to: http://stackoverflow.com/q/2265503
linked to: http://stackoverflow.com/q/4712139
has comment: http://stackoverflow.com/comment/37956957
possible better answer: http://stackoverflow.com/a/24516003
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24516003
score: 1
favorite count: 0
has title: get() method for HashMap
type: Question
has answer: http://stackoverflow.com/a/24516023
has answer: http://stackoverflow.com/a/24516520
tagged with: java
answer count: 3
has body: I'm trying to get a value with the key. I'm using get() method. My key is an object composed with int and String. So I make and object HashMap&lt;Keys,String&gt; test = readFile(fileName2); Keys myKey = new Keys(2,"SM"); test.get(myKey); And I received null. When I look at debbuging mode or when I print keySet I received something like this [Keys@d9c6e2, Keys@10285d8, Keys@c3dd7e] although my key should be [1,"GM", 2,"SM", 3"PM"] why the key look like this Keys@d9c6e2 instead of 2,"SM"? and how to get the value with the key 2,"SM"? I override toString methid in Keys . It looks better but still i have null value and im sure there is some value. Keys myKey = new Keys(2,"GL-G--T"); System.out.println(myKey.toString()); System.out.println(test.get(myKey.toString())); Set keyset = test.keySet(); System.out.println(keyset); 2,GL-G--T null [3,PNSN--G, 2,GL-G--T, 1,SM]
upvote count: 1
accepted answer: http://stackoverflow.com/a/24516520

http://stackoverflow.com/comment/37907838
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24488855
has text: any advantage of using shuffle, how is it increasing the probability to pick a new element in the list? How is it different from just shuffle and pick fixed indices, say first three?
type: AnswerComment

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/24582485
type: Tag

http://stackoverflow.com/a/24452761
has comment: http://stackoverflow.com/comment/37840062
downvote count: 0
score: 1
has body: If I round the result, I get a whole number. public static void main(String... ignored) { sum(5.1429, 5.1429, 5.1429, 5.1429, 5.1429, 5.1429, 5.1426); sum(0.8333, 0.8333, 0.8333, 0.8333, 0.8333, 0.8335); } private static void sum(double... xs) { double sum = 0; for (double x : xs) { sum += x; } System.out.printf("sum was %.2f%n", sum); } BTW: If you know you expect a whole number, you should round to a whole number, not two decimal places.
answers question: http://stackoverflow.com/q/24452497
upvote count: 1
type: Answer

state
tag name: state
tags question: http://stackoverflow.com/q/24453602
type: Tag

http://stackoverflow.com/comment/37839474
type: QuestionComment
comment on: http://stackoverflow.com/q/24452497
type: Comment
has text: @peter.petrov So, the third item is more frequent than the other ones? ;-)
score: 0

playframework-2.0
tags question: http://stackoverflow.com/q/24443385
tags question: http://stackoverflow.com/q/24464812
tags question: http://stackoverflow.com/q/24473375
tags question: http://stackoverflow.com/q/24428727
tags question: http://stackoverflow.com/q/24451631
tags question: http://stackoverflow.com/q/24545737
tags question: http://stackoverflow.com/q/24542149
type: Tag
tags question: http://stackoverflow.com/q/24452511
tag name: playframework-2.0

http://stackoverflow.com/q/24503732
upvote count: 0
has answer: http://stackoverflow.com/a/24504091
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37935906
has comment: http://stackoverflow.com/comment/37935777
type: UnansweredQuestion
tagged with: sockets
score: -4
has comment: http://stackoverflow.com/comment/37935899
has comment: http://stackoverflow.com/comment/37935173
has comment: http://stackoverflow.com/comment/37935844
has body: I'm trying to convert object type into socket type, so that I can use the properties of socket to get port number of particular node, which is present in my linked list. But I'm getting a class cast exception when I try the below code. I had also tried to convert Node type into Socket, which gave me an error, hence I'm trying to convert Object type into Socket type. Any assistance will be of great help. for(int i=0;i&lt;7;i++) { Socket t; Object obj; obj = Node.List1.get(2); t=(Socket) obj; int p=t.get Port(); }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37935112
has comment: http://stackoverflow.com/comment/37935952
tagged with: casting
has comment: http://stackoverflow.com/comment/37935208
has comment: http://stackoverflow.com/comment/37935211
has title: ClassCastException: Unable to type cast object type into socket
downvote count: 4
has comment: http://stackoverflow.com/comment/37935251

http://stackoverflow.com/comment/38009029
comment on: http://stackoverflow.com/q/24543437
score: 0
has text: You need to call `invalidateOptionsMenu()` when the checkbox is clicked.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24433142
has comment: http://stackoverflow.com/comment/37804609
has comment: http://stackoverflow.com/comment/37804112
has comment: http://stackoverflow.com/comment/37803963
answers question: http://stackoverflow.com/q/24433003
has comment: http://stackoverflow.com/comment/37804004
has body: It's hard to guess where you're getting your error, but I'm assuming here: byte[] byteArray = Base64.decodeBase64(dms_current_message.getBytes()); I don't see dms_current_message being initialized ever, yet you're calling a method on it, which would definitely result in the null pointer exception.
score: 1
has comment: http://stackoverflow.com/comment/37804224
has comment: http://stackoverflow.com/comment/37804838
has comment: http://stackoverflow.com/comment/37803798
accepted answer of: http://stackoverflow.com/q/24433003
has comment: http://stackoverflow.com/comment/37803905
has comment: http://stackoverflow.com/comment/37803738
has comment: http://stackoverflow.com/comment/37805400
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37810209
comment on: http://stackoverflow.com/a/24436661
type: AnswerComment
type: Comment
has text: lol I guess you got me wrong :D What I meant to say is: when the child's `onCreate` is called the parent's `onCreate` is called as well (due to the `super.onCreate()` line) and at that time(inside parent's `onCreate`) it ignores the condition to init/not-to-init the controller's obj and it simply re-inits the obj
score: 0

http://stackoverflow.com/comment/37978276
has text: please suggest me what to keep TableCell value in my case
type: QuestionComment
comment on: http://stackoverflow.com/q/24525517
type: Comment
score: 0

http://stackoverflow.com/a/24445750
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24436239
score: 0
type: Answer
has body: You can try with RollingFileAppender instead of FileAppender and set the RollingPolicy you need. i.e you can try with: ... @Slf4j class Family { static { new RollingFileAppender().with { name = 'file appender' file = 'C:\\tmp\\groovy.log' // the policy to roll files rollingPolicy = new TimeBasedRollingPolicy().with{ context = LoggerFactory.getILoggerFactory() // file name pattern for the rolled files fileNamePattern = 'C:\\tmp\\groovy.%date{yyyy-MM-dd}.%i.log' // the maximum number of files to be keeped. maxHistory = 10 timeBasedFileNamingAndTriggeringPolicy = new SizeAndTimeBasedFNATP().with{ context = LoggerFactory.getILoggerFactory() // the max size of each rolled file maxFileSize = '3MB' } } context = LoggerFactory.getILoggerFactory() encoder = new PatternLayoutEncoder().with { context = LoggerFactory.getILoggerFactory() pattern = "%date{HH:mm:ss.SSS} [%thread] %-5level %logger{35} - %msg%n" start() it } start() log.addAppender(it) } } ... Hope this helps,
accepted answer of: http://stackoverflow.com/q/24436239

http://stackoverflow.com/q/24482763
tagged with: java
type: Question
has body: I'm programming a webserver in Glassfish for ads. Each ad has a category and a place. Each category or place might have subcategories/subplaces. I want to select ads whitin a category-tree and a place-tree. The entity classes I have created for this scenario are shown below. The category entity: @Entity public class Category { @Id private Long id; @OneToMany(mappedBy="category") List&lt;Ad&gt; ads; @Basic private String path; } The place entity: @Entity public class Place { @Id private Long id; @OneToMany(mappedBy="place") List&lt;Ad&gt; ads; @Basic private String path; } The Ad entity: @Entity public class Ad { @Id private Long id; @ManyToOne Category category; @ManyToOne Place place; So I added a field/column named path for the category and the place. This path is a string which must begin with its parents path. So if I wanted to find all ads whitin a category and a place, then I would do this following pseudo-query: SELECT a from Ad a WHERE Category.pathid "STARTS WITH" getCategoryPathByID(PARAMETER 1) AND Place.pathid "STARTS WITH" getPlacePathByID(PARAMETER 2) I have hard time figuring out how to accomplish this with a JPA query because I dont know how to join the category &amp; place tables and how to match the path given the id. Can anyone help me how to build this query?
tagged with: jpa
answer count: 1
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24495654
accepted answer: http://stackoverflow.com/a/24495654
has title: JPA query with several relations and mapped parameters
type: AnsweredQuestion

http://stackoverflow.com/a/24487215
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24484669
has body: change create to create

http://stackoverflow.com/a/24558983
type: Answer
answers question: http://stackoverflow.com/q/24558843
downvote count: 1
score: -1
has body: You do not call the printValues function. You also do not call the sorting function. The code inside a function is only executed once you call it. Also I would suggest indenting the code so that things inside two braces are indented twice etc.
upvote count: 0
has comment: http://stackoverflow.com/comment/38037463

http://stackoverflow.com/q/24581886
tagged with: java
tagged with: keylistener
answer count: 2
has comment: http://stackoverflow.com/comment/38080664
has comment: http://stackoverflow.com/comment/38080307
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/53854426
linked to: http://stackoverflow.com/q/19802434
has body: I spent two hours for the past three days researching and cannot figure this out. This is a simple program that clicks the left mouse button every 2.5 Seconds 50 times and then the program ends. But sometimes I want to end the program sooner by pressing the escape key (not mouse). How do I end the program by clicking the escape button? I don't know what I am doing wrong. If possible please provide code because I am new to Java and don't understand Java terminology well. Thank you for the help. import java.awt.AWTException; import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class TestClass implements KeyListener, ActionListener { static boolean exit = false; public static void main(String[] args) throws AWTException { //Creates robot class Robot r = new Robot(); for(int x = 1; x &lt; 50; x++) { //moves mouse to a cretain point on the screen r.mouseMove(789, 326); //robot class presses the mouse then realases every 2.5 Seconds r.mousePress(InputEvent.BUTTON1_MASK); r.mouseRelease(InputEvent.BUTTON1_MASK); r.delay(2500); System.out.println("This the " + x + "th time."); } } //KeyLisener stuff @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub if(e.getKeyCode() == KeyEvent.VK_ESCAPE) { System.out.println("The key has been pressed"); System.exit(0); } } @Override public void keyReleased(KeyEvent e){} @Override public void keyTyped(KeyEvent e){} // Action Performed stuff @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub if (exit = true) { System.exit(0); } } }
has answer: http://stackoverflow.com/a/24582099
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24582099
upvote count: 3
has title: How to exit a program by pressing the escape button?
type: Question
tagged with: actionlistener
score: 3
possible better answer: http://stackoverflow.com/a/53854426
tagged with: keyboard-hook

http://stackoverflow.com/comment/37882545
type: QuestionComment
score: 0
has text: The prompt for the name of the room should be inside the loop, and not outside, since you want it repeated.
comment on: http://stackoverflow.com/q/24475590
type: Comment

http://stackoverflow.com/comment/37932834
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24502156
has text: Got it! I just forget to change the default version of the Python. `sudo ln -sf /usr/bin/python2.7 /usr/bin/python` It works now.

http://stackoverflow.com/q/24480959
has answer: http://stackoverflow.com/a/24480986
has answer: http://stackoverflow.com/a/24480993
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24480986
tagged with: java
has title: Java compile missing return statement error
has body: I am trying to learning java, by goofing around and creating different things such as this dice example. However, in the class below I am stuck on this missing return, but I am not sure why. All help is appreciated! Test1.java:12: error: missing return statement } ^ 1 error import java.util.Random; class Char { Random r = new Random(); int nSides; public int Die(int sides) { this.nSides = sides; r = new Random(); } public int roll() { return r.nextInt(nSides + 1); } public int roll(int times) { int sum = 0; for (int i = 0; i &lt; times; i++) { sum += roll(); } return sum; } }
type: Question
has answer: http://stackoverflow.com/a/24481000
has answer: http://stackoverflow.com/a/24480979
answer count: 4
tagged with: compiler-errors
tagged with: return
score: 0
accepted answer: http://stackoverflow.com/a/24480979

http://stackoverflow.com/comment/37968114
type: QuestionComment
score: 1
has text: *"Also, the three variables I need (name, email and phone number) are to be entered in the same input box (parsed by the whitespace between)."* I would think that this is the wrong approach and increases the complexity to an almost unmanageable level. Instead, consider prompting for each value separately...
comment on: http://stackoverflow.com/q/24521832
type: Comment

http://stackoverflow.com/q/24516962
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/24516963
type: Question
answer count: 2
downvote count: 0
tagged with: documentation
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I need to display my example code directly in my library's JavaDoc documentation, including its output. But I want to automate this process, so the example code can be unit tested by an external process, and not displayed unless it actually works. I have not figured out a way to do this except by manually copy-pasting the source code (and output) each time a change is made--which is unmanageable given there are now well above a hundred example classes in my various projects. Alternatively I could simply not display those examples, but instead provide a link to them. Both of these solutions are unacceptable, and I am hoping there might be a better way to do this. How do you automate the insertion of your example code, so it is displayed directly in your JavaDoc? Thanks.
has title: How can I display my example code in JavaDoc, without having to manually copy/paste it?
score: 2
has answer: http://stackoverflow.com/a/24548561

http://stackoverflow.com/comment/38020170
score: 0
type: AnswerComment
has text: it seems that changing the version of the plugin to 9.2.1.v20140609 solves the problem.
type: Comment
comment on: http://stackoverflow.com/a/24538318

http://stackoverflow.com/q/24439961
tagged with: arrays
has body: If I have a file that contains the exact byte[] data that I want: [-119, 45, 67, ...] How can I read those values into a byte array? Do I have to read them as a String, and then convert those String values to byte values? This is what I'm currently doing, and it works, but slowly: BufferedReader reader = null; String mLine = null; AssetManager assetManager = CustomApplication.getCustomAppContext().getAssets(); try { reader = new BufferedReader(new InputStreamReader(assetManager.open(fileName))); mLine = reader.readLine(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } String[] byteValues = mLine.substring(1, mLine.length() - 1).split(","); byte[] imageBytes = new byte[byteValues.length]; for (int i = 0; i &lt; imageBytes.length; i++) { imageBytes[i] = Byte.valueOf(byteValues[i].trim()); } return imageBytes; UPDATE: There seems to be a misunderstanding of what I want to accomplish. My file contains the EXACT byte data I want in my final byte array. For example, I want to convert a file with exactly [-119, 45, 67, ...] into a byte[] called result with result[0] = -119 result[1] = 45 result[2] = 67
answer count: 2
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Read byte values contained in file into byte array
tagged with: java
has answer: http://stackoverflow.com/a/24441404
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24440012

http://stackoverflow.com/a/24487499
has comment: http://stackoverflow.com/comment/37906273
answers question: http://stackoverflow.com/q/24485478
score: 0
has comment: http://stackoverflow.com/comment/37907443
has comment: http://stackoverflow.com/comment/37905608
has comment: http://stackoverflow.com/comment/37906100
has comment: http://stackoverflow.com/comment/37907357
has comment: http://stackoverflow.com/comment/37906243
has comment: http://stackoverflow.com/comment/37907236
type: Answer
has comment: http://stackoverflow.com/comment/37907605
has comment: http://stackoverflow.com/comment/37907113
has body: What you want is impossible. Well thats what I think. I've never seen such a http communication before. If it would be possible it would be very interesting though. In one 'session' you want the server to receive something from the client. Send something back. Which the client reads. And then the client sends again data which the server should read.
has comment: http://stackoverflow.com/comment/37906851
has comment: http://stackoverflow.com/comment/37906644
has comment: http://stackoverflow.com/comment/37906911

pdfbox
tag name: pdfbox
type: Tag
tags question: http://stackoverflow.com/q/24513328

http://stackoverflow.com/a/24596518
accepted answer of: http://stackoverflow.com/q/24582047
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24582047
type: Answer
has body: I have tested both queries and the resulting sql was the same. Answering to the second part of your quesion - there is a lot of relevant literature, but I can particularly recommend Pro JPA 2, 2nd Edition by Mike Keith , Merrick Schincariol. If you want test queries manually, you can watch SQL-queries resulting from JPA-queries. One approach would be to get know your JPA provider and see what options he delivers for such purpose (e.g. Hibernate provides option hibernate.show_sql). The second option (in my opinion - much better) is to use tool such as log4jdbc which is an additional layer (simplifying) between your JDBC driver and Persistence Provider and can log all queries sent to database along with their parameters. It can also measure time spend on each query, so I think it is ideal tool for performance testing.

http://stackoverflow.com/comment/37845340
type: QuestionComment
has text: I have the exact same issue with Android Studio Beta... I open the sample project https://github.com/romainguy/google-io-2014, compile and run on emulator, but Android Studio says that some (new L preview) classes doesn't exist ....
score: 0
comment on: http://stackoverflow.com/q/24447942
type: Comment

http://stackoverflow.com/comment/38010686
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24544363
has text: use do while construct
score: 0

http://stackoverflow.com/a/24576590
downvote count: 0
answers question: http://stackoverflow.com/q/24576422
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: Your i variable needs to be reset to 1 each time through the while loop. The current logic will be getColumnClassName(2) on the second record and getColumnClassName(3) on the 3rd record, etc. If you have more records than columns selected, you will get the index out of range error. It is not clear if you are wanting to get the data from the record or just metadata about the columns returned. If you are actually wanting to iterate over all the columns to get type information, you need to get the column count and use that. final int cnt = rs.getMetaData().getColumnCount(); for (int i=0; i&lt;cnt; ++i) { columns.put("id", Integer.toString(i)); columns.put("name", rs.getMetaData().getColumnName()); columns.put("type", rs.getMetaData().getColumnClassName(i)); columns.put("nullable", Integer.toString(rs.getMetaData().isNullable(i))); s.add(columns); }
accepted answer of: http://stackoverflow.com/q/24576422

http://stackoverflow.com/q/24517456
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37959954
answer count: 2
possible better answer: http://stackoverflow.com/a/24517796
has answer: http://stackoverflow.com/a/24517907
has answer: http://stackoverflow.com/a/24517796
tagged with: javascript
score: 0
has body: Is it possible to synchronize two computers in a nanosecond level? What I want is to measure the distance that a signal has travelled. As known light travels really fast. By knowing that the signal went off at 1.0000000001 seconds and reached the destination point at 1.00000000021 seconds we can calculate the distance which is my problem. I found window.performance.now() in java but i am not sure if synchronization can be achieved by using the internet and how is it possible. Thanks for bothering :)
has title: Light measurement with accurate nanosecond synchronization
has comment: http://stackoverflow.com/comment/37961464
tagged with: synchronization
tagged with: c++
accepted answer: http://stackoverflow.com/a/24517907
has comment: http://stackoverflow.com/comment/37959997
has comment: http://stackoverflow.com/comment/37961520
type: AnsweredQuestion

http://stackoverflow.com/q/24533135
has comment: http://stackoverflow.com/comment/37989174
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/24533216
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/37989326
has body: Is there any ready implementations in JDK or popular libraries? I wrote the following function: public static int length(Object array, int level) { if( level &lt; 0 ) { throw new IllegalArgumentException(); } else if( level == 0 ) { if( !array.getClass().isArray() ) { throw new IndexOutOfBoundsException(); } else { return Array.getLength(array); } } else { if( !array.getClass().isArray() ) { throw new IndexOutOfBoundsException(); } else { int length = Array.getLength(array); int nextlength, maxnextlength = 0; Object element; for(int i=0; i&lt;length; ++i) { element = Array.get(array, i); if( element != null ) { nextlength = Array.getLength(element); if( nextlength &gt; maxnextlength ) { maxnextlength = nextlength; } } } return maxnextlength; } } } is it correct and optimal?
has title: How to get the length of any dimension of multidimensional array in Java?
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24534700
type: Question
score: 0

http://stackoverflow.com/comment/38087304
has text: @AlanStokes I explained the reason in my answer, can you check it please?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24580559
type: Comment

http://stackoverflow.com/comment/38027566
has text: the first onsuccess work and i get the data,, but the second async onsuccess doesn'T work
type: Comment
comment on: http://stackoverflow.com/q/24553418
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38052148
score: 0
type: Comment
has text: give the servlet structure?
type: QuestionComment
comment on: http://stackoverflow.com/q/24564684

http://stackoverflow.com/comment/38036422
has text: @JoshuaTaylor sorry you are right I post the code that resolve the problem
comment on: http://stackoverflow.com/a/24555830
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24527240
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24514272
has comment: http://stackoverflow.com/comment/37979738
has body: You need to create a project (jar output) that contains just the classes that are shared between the two consumers. This may seem like an overhead, but it leads to clean well-organised code. If you can't do this, it is an indication that you have a confused dependency hierarchy. I do this regularly to implement web service clients and services, with a shared jar that contains the classes in common (i.e. the client should know nothing about DAO classes, but does need to know the signature of the web service operations. It also needs to have access to the POJO classes that define the data and message structure). Also, do you need the hamcrest dependency at runtime? My experience is that it can usually have its scope set to test, so it never turns up in your compiled artifacts. I'm not a convert to parent poms, and certainly would not consider the two-level parent pom structure you show. My objections are: If you update a parent pom, you then need to update all the child poms that use it, negating the advantage of centralising your dependency information. Putting module declarations in a parent pom seems to produce a circular reference. If you change the parent pom, it tries to compile the modules, which immediately refer back to the parent, which is not yet available in the repository as it hasen't finished building. I've seen systems where there is a "dependency parent" and a "compile all modules parent" to work around this. I do use parent poms sparingly, but only to set the compiler version and to define the versions of external dependencies like Spring and Apache commons jars. I'd like to hear reasoned argument on this topic.
answers question: http://stackoverflow.com/q/24514272
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24583418
answers question: http://stackoverflow.com/q/24583384
has comment: http://stackoverflow.com/comment/38083104
has comment: http://stackoverflow.com/comment/38083169
has comment: http://stackoverflow.com/comment/38083052
has comment: http://stackoverflow.com/comment/38083069
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38083212
has body: For loop implementation of the same, for(String line = reader.readLine(); line != null; line = reader.readLine()){ System.out.println(line); } This make it easy to understand.
type: Answer

http://stackoverflow.com/comment/37933711
has text: Still needs to make the 'dot' character optional in the '`.000.`' sequence, in case it appears at the beginning or end of the string.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24502998

http://stackoverflow.com/q/24444957
tagged with: easymock
type: Question
accepted answer: http://stackoverflow.com/a/24526412
answer count: 1
has body: I am new to development environment in Java and want to understand how to write a UT for this kind of method in Java using EasyMock. public class MyClass{ public ClassB classBObj; public int myMethod(SomeClass someClassObj){ ClassA objA = new ClassA(); objA.addParam(classBObj); ClassC classCObj = objA.getClassCObj(classBObj); return someClassObj.getResult(classCObj); } } I can create mocks of SomeClass, ClassB but how to mock behavior of ClassA and ClassC ? Basically I want to define behaviour of ClassA i.e., "addParam" and " getClassCObj" . How can I do this ? I need to test "myMethod" of this "MyClass" Thanks.
has comment: http://stackoverflow.com/comment/37825696
score: 0
tagged with: unit-testing
type: AnsweredQuestion
has title: EasyMock: How to test this method
tagged with: java
has answer: http://stackoverflow.com/a/24526412

http://stackoverflow.com/q/24449238
tagged with: xstream
has title: xStream changes order of objects in write/readObject with JSON serialization
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/38033610
answer count: 0
downvote count: 0
favorite count: 0
tagged with: serialization
type: Question
has body: We use XStream to serialize objects to JSON and vice versa. We init xStream like this XStream xStream = new XStream(new JettisonMappedXmlDriver(new Configuration(), false)); xStream.ignoreUnknownElements(); xStream.setMode(XStream.XPATH_RELATIVE_REFERENCES); We have test class public static class TestWOWithBI implements Serializable{ private static final long serialVersionUID = -4720678317857471031L; private transient String customerNickname; private transient String customerUuid; private transient BigInteger discussionId; private transient String message; public TestWOWithBI(String customerNickname, String customerUuid, BigInteger discussionId, String message){ this.customerNickname = customerNickname; this.customerUuid = customerUuid; this.discussionId = discussionId; this.message = message; } private final void writeObject(final ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeObject(customerNickname); out.writeObject(customerUuid); out.writeObject(discussionId); out.writeObject(message); } private final void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException{ in.defaultReadObject(); customerNickname = (String) in.readObject(); customerUuid = (String) in.readObject(); discussionId = (BigInteger) in.readObject(); message = (String) in.readObject(); } } After serialization it looks like this: { "somethere.ObjectToJSONSerializerTest$TestWOWithBI": { "@serialization": "custom", "somethere.ObjectToJSONSerializerTest$TestWOWithBI": { "default": "", "string": ["name", "uuid", "message"], "big-int": 1 } } } and deserialization fails with class cast. It was on 1.3.1 and 1.4.7 versions. Looks like bug to me, but may be where is some settings? UPD: Seems like org.codehaus.jettison.mapped.MappedXMLStreamWriter.JSONPropertyObject#withProperty if(old != null) { JSONArray values; // Convert an existing property to an array // and append to the array if (old instanceof JSONArray) { values = (JSONArray)old; } else { va…
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/24540443
tagged with: android
has comment: http://stackoverflow.com/comment/38003110
has comment: http://stackoverflow.com/comment/38003298
favorite count: 0
has comment: http://stackoverflow.com/comment/38003326
has answer: http://stackoverflow.com/a/24540583
has answer: http://stackoverflow.com/a/24559938
has comment: http://stackoverflow.com/comment/38003280
answer count: 4
tagged with: timestamp
has body: I have a class that when its initialized, it records the time of initialization in a private field with a public getter: public class TestClass { private long mTimestamp; public TestClass(){ mTimestamp = System.getCurrentMillis(); } public long getTimestamp(){ return mTimestamp; } } I also have an enum with the name of days: public enum Days implements Serializable { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY } Now the problem is in another class I have to get the timestamp and set a Days field to the day that the class was initialized: public class OtherClass { public Days getDayOfInitialization(TestClass testClass){ //how to do this? Date date = new Date(testClass.getTimestamp()) Days day = Date.getDay(); //Deprecated! //convert to enum and return... } } The getDay() method of Date is deprecated...how should I do this?
possible better answer: http://stackoverflow.com/a/24540719
type: AnsweredQuestion
score: 4
has comment: http://stackoverflow.com/comment/38003164
has answer: http://stackoverflow.com/a/24540719
tagged with: deprecated
tagged with: java
tagged with: date
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24559938
has answer: http://stackoverflow.com/a/24540614
downvote count: 0
has title: Get name of day from timestamp in Android

ical4j
tags question: http://stackoverflow.com/q/24468496
type: Tag
tag name: ical4j

http://stackoverflow.com/a/24545241
downvote count: 1
answers question: http://stackoverflow.com/q/24545184
has body: If you really care about precision, may be you want to use java.math.BigDecimal. See more in How to Use Java BigDecimal: A Tutorial.
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/comment/37832675
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24448137
has text: thanks for your help & advice, it works now, but to use **ActionSupport.getText("name.of.properties.value")** to access value inside properties file, is it okay if I make an object of ActionSupport inside intercept method instead ? or Is there any better way ?

http://stackoverflow.com/comment/37999280
has text: Can you share with use your web.xml, because if you don't use spring mvc and then DispatcherServlet to manage the incoming request, you have to add a Listener in you web xml to manage request,session and global-session scope
type: Comment
comment on: http://stackoverflow.com/q/24532088
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38263860
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24492634
has text: LOL. Sorry. That was a copy-paste-error! So this question might a duplicate of http://stackoverflow.com/questions/21830457/xstartonfirstthread-not-accepted-by-java-7-web-start which is a duplicate of http://stackoverflow.com/questions/13863945/java-7-breaks-swt-app-on-os-x-using-web-start ....
type: Comment

http://stackoverflow.com/a/24433641
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24433591
has body: My solution: public static &lt;T&gt; List&lt;T&gt; cast(List&lt;? super T&gt; list, Class&lt;T&gt; clazz) { if( list.stream().allMatch( clazz::isInstance ) ) return (List&lt;T&gt;) list; else throw new IllegalArgumentException ("Not all inputs are of class " + clazz.getName()); }
downvote count: 0
has comment: http://stackoverflow.com/comment/37804976
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/24433591
type: Answer

http://stackoverflow.com/q/24539475
has comment: http://stackoverflow.com/comment/38002062
answer count: 2
has answer: http://stackoverflow.com/a/24544156
has title: Placing of JPanels on the JFrames is not correct
has body: I wrote a program to compose a GUI using swing/awt framework for my assignment. So far, I am able to get the pieces working together, but when I put them all into a JFrame, they are not coming out as expected. I have recently started working on Java GUI framework, and not sure what is missing in my code. How can I get this working properly? I am also attaching the screen shots (see at the bottom) of the output I am getting. public class MainFrame extends JFrame { public MainFrame() { addComponentsToPane(this.getContentPane()); } private void addComponentsToPane(Container pane) { // Set layout GridBagConstraints gbc = new GridBagConstraints(); this.setTitle("Test tool"); this.setSize(600, 650); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new GridLayout(2, 1)); // Add video JComponent mMainPanel = new MainPanel(); pane.add(mMainPanel, 0); // Add conference screen panel mFeedPanel = new FeedPanel(); pane.add(mFeedPanel, 1); // Add a button panel mButtonPanel = new ButtonPanel(); pane.add(mButtonPanel, 2); this.setResizable(true); this.setVisible(true); this.pack(); } } // In actual output, there is 1 screen in this panel. // mScreen1 is derived from JComponent object. public class MainPanel() extends JPanel { public MainPanel() { addMainPanelComponents(); } private void addMainPanelComponents() { this.setSize(352, 240); setBackground(Color.yellow); setLayout(new GridLayout(1, 2)); add(mScreen); setVisible(true); } } // In actual output, there are 3 screens in this panel. I have shown code for 1 screen only // mScreen1 is derived from JComponent object. public class FeedPanel extends JPanel { public FeedPanel() { addFeedPanelComponents(); } private void addFeedPanelComponents() { String img1 = "images/screen1.png"; setSize(352, 150); setBackground(Color.yellow); setLayout(new GridLayout(1, 3)); Image image1 = ImageIO.read(new File(img1)); mScreen1.setImage(image1); add(mScreen1); setVisible(true); } } public class ButtonPanel extends JPanel { public B…
tagged with: user-interface
has comment: http://stackoverflow.com/comment/38002170
has comment: http://stackoverflow.com/comment/38002026
tagged with: layout-manager
score: 1
possible better answer: http://stackoverflow.com/a/24540379
favorite count: 0
has answer: http://stackoverflow.com/a/24540379
has comment: http://stackoverflow.com/comment/38001943
accepted answer: http://stackoverflow.com/a/24544156
has comment: http://stackoverflow.com/comment/38002066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38001329
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/38002185
has comment: http://stackoverflow.com/comment/38002112
tagged with: java
has comment: http://stackoverflow.com/comment/38002371
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/38001845
type: Question
has comment: http://stackoverflow.com/comment/38003191
downvote count: 0
tagged with: awt

http://stackoverflow.com/comment/37943575
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24508588
has text: sorry for bad formatting.. i m new to stackoverflow

http://stackoverflow.com/q/24585382
has answer: http://stackoverflow.com/a/25077417
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: intellij-idea
has body: I am using IDEA community edition and I have jdk1.7 installed. The problem is that I cant choose Java project in the New Project windows of IDEA. When I select Java in the project window it only shows Groovy. I want to switch from NetBeans to IDEA. Netbeans worked perfectly on my system. Is their any configuration error ? The image of New Project Window
answer count: 2
tagged with: groovy
has answer: http://stackoverflow.com/a/24585438
downvote count: 0
has title: JetBrains Intellij IDEA not showing Java module. It only shows Groovy in Java project
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37962804
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24518610
has text: Yeah was wanting the words to replace the numbers like Joe said. I can see your code does that now :D. Thanks for the help this has been doing my head in all day lol
score: 0

http://stackoverflow.com/comment/38000614
type: AnswerComment
has text: First of all, thank you for the detailed explanation, but isn't `List<Ojbect>` equivalently risky?
type: Comment
comment on: http://stackoverflow.com/a/24530643
score: 0

http://stackoverflow.com/q/24447636
type: Question
has comment: http://stackoverflow.com/comment/37830496
has answer: http://stackoverflow.com/a/24448172
has answer: http://stackoverflow.com/a/24447903
accepted answer: http://stackoverflow.com/a/24447903
has comment: http://stackoverflow.com/comment/37830615
has comment: http://stackoverflow.com/comment/37830613
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/37830304
tagged with: mysql
has title: SQL Order String Primary Key
linked to: http://stackoverflow.com/q/23597482
possible better answer: http://stackoverflow.com/a/24447944
has answer: http://stackoverflow.com/a/24447944
has body: I am wondering how to sort my SQL primary keys which is a VARCHAR composed of three parts. To generate a new key I need to find the largest number for the current year. MC-#Year-#Number e.g. MC-2014-1 Order in the database table: MC-2013-5 MC-2014-1 MC-2014-2 MC-2014-11 Something like ORDER BY CAST(REPLACE(SUBSTRING(MC-2014-11,4),'_','') AS SIGNED) However, the linked java programme could alo retrieve and sort the keys.
has comment: http://stackoverflow.com/comment/37830432
has comment: http://stackoverflow.com/comment/37830913
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/37830635

http://stackoverflow.com/a/24566845
has comment: http://stackoverflow.com/comment/38052703
type: Answer
has comment: http://stackoverflow.com/comment/38052850
score: 2
has comment: http://stackoverflow.com/comment/38052675
upvote count: 2
has body: Adding to Dean's efforts... In the absence of an image, I create a simple arrow shape, which starts out pointing right... public Player(int x, int y, int hp, int lives, String imgpath) { this.x = x; this.y = y; this.hp = hp; this.lives = lives; //img = new ImageIcon(this.getClass().getResource(imgpath)).getImage(); BufferedImage arrow = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = arrow.createGraphics(); g2d.setColor(Color.RED); g2d.drawLine(0, 0, 16, 8); g2d.drawLine(16, 8, 0, 16); g2d.drawLine(0, 16, 0, 0); g2d.dispose(); img = arrow; max_speed = 6; speed = 0; direction = 0; } Now, this rendered fine to start with. When I started moving the player around I had some issues, so I updated the paint code slightly. @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); AffineTransform trans = new AffineTransform(); trans.setToIdentity(); trans.translate(player.x, player.y); trans.rotate(Math.toRadians(player.getDirection()), player.getWidth() / 2, player.getHeight() / 2); g2d.setTransform(trans); g2d.drawImage(player.getImg(), 0, 0, (int) player.getWidth(), (int) player.getHeight(), null); g2d.dispose(); g2d = (Graphics2D) g.create(); g2d.drawString("X: " + player.getX() + " Y: " + player.getY(), 5, 10); g2d.dispose(); trans.setToIdentity(); } Essentially, I made a copy of the Graphics context... Graphics2D g2d = (Graphics2D) g.create(); Using the AffineTransform, I translated the context to the player's current position, this simplified the rotation code as I didn't then need to offset the anchor point... trans.translate(player.x, player.y); trans.rotate(Math.toRadians(player.getDirection()), player.getWidth() / 2, player.getHeight() / 2); This also means that it's easier to draw the image... g2d.drawImage(player.getImg(), 0, 0, (int) player.getWidth(), (int) player.getHeight(), null); The beauty of all this is the fact that all the changes are contextual to the copy of the Grap…
has comment: http://stackoverflow.com/comment/38052885
has comment: http://stackoverflow.com/comment/38052816
has comment: http://stackoverflow.com/comment/38052746
downvote count: 0
answers question: http://stackoverflow.com/q/24565475

http://stackoverflow.com/comment/37897054
type: AnswerComment
has text: What does `StudentForm` represents? Is it a differnt Class for form purpose only? what does it looks like?
type: Comment
comment on: http://stackoverflow.com/a/24438239
score: 0

http://stackoverflow.com/q/24452563
answer count: 1
has comment: http://stackoverflow.com/comment/37844791
score: 0
has title: Flex mxmlc error loading JVM windows 7 64 bit
tagged with: sdk
has body: I'am executing this command in my windows 7 console: mxmlc then I get: Error loading: C:\Program Files (x86)\Java\jre7\bin\client\jvm.dll How to fix this? the jvm.dll exists in that directory, but why the error occurs?, I've tried to reinstall java, but it didn't helped
type: UnansweredQuestion
tagged with: apache-flex
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25872837

http://stackoverflow.com/q/24500517
has answer: http://stackoverflow.com/a/24500556
score: 0
answer count: 1
has title: For every thousand units entered in one variable subtract 1 from another variable?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37929337
has body: I'm writing a program that takes input of degrees and altitude and then returns what state the water is in. so -55 and below it is solid. Boiling water is affected by the altitude so for every 1000ft of altitude the boiling point lowers 1 degree. I have no idea how to express that in code. below is the code that I have so far. I know there are probably easier ways of writing this, but I have stick with switch and/or if statements. public class Water { private final double temperature; private final String degrees; private final int altitude; private final String units; public Water(double temp, String deg, int alt, String unitType) { temperature = temp; degrees = deg; altitude = alt; units = unitType; } public String getState() { switch (degrees) { case "F": if (temperature &gt; -55 &amp;&amp; temperature &lt; 212) { System.out.println("The water is liquid."); } else if (temperature &lt;= -55) { System.out.println("The water is solid."); } else { System.out.println("The water is gaseous."); } break; case "C": if (temperature &gt; -48 &amp;&amp; temperature &lt; 99.98) { System.out.println("The water is liquid"); } else if (temperature &lt;= -48) { System.out.println("The water is solid."); } else { System.out.println("The water is gaseous."); } break; default: System.out.println("Error: Degrees must be in either C (celcius) or F (farenheit)."); break; } return temperature + degrees; } }
tagged with: java
has comment: http://stackoverflow.com/comment/37929342
type: Question
has comment: http://stackoverflow.com/comment/37929438
has comment: http://stackoverflow.com/comment/37930111

http://stackoverflow.com/a/24537933
has body: JTextField inherits off off java.awt.Component which has a method http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#addKeyListener-java.awt.event.KeyListener- where you can register a listener and process what key is being pressed.
has comment: http://stackoverflow.com/comment/37998169
answers question: http://stackoverflow.com/q/24537857
score: 0
type: Answer

http://stackoverflow.com/a/24444850
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24444719
answers question: http://stackoverflow.com/q/24444719
has comment: http://stackoverflow.com/comment/37825604
type: AcceptedAnswer
has body: The fact is you are NOT checking p, the parameter given to the function isPrime(). It should be like that: package jmv; public class euler3 { static int x=1; static long z = 600851475143L; public static void main(String[] args) { System.out.println(isPrime(123454321)); } public static boolean isPrime(int p){ if (p%2 == 0) { return false; } else { for(int y=3 ; y&lt;p ; y=y+2){ if(p%y == 0){ return false; } } } return true; } } You need to check if 2 divides p first, because an even number may be passed to the function. Then you just need to check the odd number >=3. But this is basic mathematics and I'm sure you just forgot it. Doing this you save many tests. If you test with y++ you will be checking for every even number and this is not necessary, for if a number is even and greater than 2, it is NOT prime. Hope it helps!

http://stackoverflow.com/comment/37795820
type: Comment
type: QuestionComment
has text: @Deduplicator aptly said...
comment on: http://stackoverflow.com/q/24428994
score: 0

http://stackoverflow.com/comment/37900868
type: Comment
comment on: http://stackoverflow.com/a/24484808
has text: write this only WriteInts wi = new WriteInts("mydata.dat" , myArr); don't use [ ] and then run the code
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37833884
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24445538
has text: @ErikAllik I've added a mention to it for completeness. Thanks for the suggestion.

http://stackoverflow.com/comment/37896172
type: AnswerComment
comment on: http://stackoverflow.com/a/24480767
score: 0
type: Comment
has text: @user3580294-This was really no sarcasm from my side.Whatever I replied it was internally from my heart.Again,you are mis-understanding me here!

http://stackoverflow.com/q/24433206
has answer: http://stackoverflow.com/a/24433695
has answer: http://stackoverflow.com/a/24435797
has comment: http://stackoverflow.com/comment/37805170
answer count: 3
tagged with: replaceall
has comment: http://stackoverflow.com/comment/37805645
tagged with: regex
has comment: http://stackoverflow.com/comment/37804461
has answer: http://stackoverflow.com/a/24433380
type: UnansweredQuestion
has body: I'm a Java beginner and already asked a similar question last week but notwithstanding your helpful answers I still haven't solved my issue, so I think I should give you the whole story. Given a text like Se excluye arbitraje de ley y [rotura de lunas]Gar_1. Se excluye arbitraje de ley y [rotura de lunas]noGar. Excluimos todas aquellas cosas que [arbitraje de ley]Gar_1. Excluimos todas aquellas cosas que son afinidad de [Arbitraje de ley]Gar_1. I want to replace the string-label 'Gar_1' by 'noGar' only for those strings that have both labels (namely '[rotura de lunas]' in the above ex.). The input from which I take the sentences which I check for the regex and where I eventually do the replacement is a txt file. My code is the following: public class Trial_2 { private static String REGEX = "\\[.*\\](?=(Gar_1|noGar))"; private static String BE_REPLACED = "Gar_1"; // def part of seq that I want to replace private static String REPLACE = "noGar"; // def the replacement string public static void main(String[] args) throws IOException { String input = readFile("corpus_pruebas_multiples_2.txt"); System.out.println("Original input: " + input); Pattern p1 = Pattern.compile(REGEX); // compare string seq to general pattern Matcher m1 = p1.matcher(input); // get a matcher object for this general pattern if(m1.find( )){ System.out.println("Found value: " + m1.group(0)); Pattern p2 = Pattern.compile(BE_REPLACED); // compare string to pattern Matcher m2 = p2.matcher(input); // get a matcher object for this pattern input = m2.replaceAll(REPLACE); // replace // print out new string seq with desired replacement: System.out.println("Replacement: " + input); } else{ System.out.println("NO MATCH"); } } // Method that allows to read from a file by passing it the filename as a param. static String readFile(String fileName) throws IOException { BufferedReader br = new BufferedReader(new FileReader(fileName)); try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while…
has title: Regex and replacement
has comment: http://stackoverflow.com/comment/37805463
tagged with: java
has comment: http://stackoverflow.com/comment/37805066
tagged with: replace
type: Question
has comment: http://stackoverflow.com/comment/37805996
has comment: http://stackoverflow.com/comment/37803884
score: 0

http://stackoverflow.com/comment/37816453
type: Comment
type: QuestionComment
has text: It's an instance of an anonymous subclass. It's not exactly "overridden at an instance level", but it pretty much acts like it, because you have exactly one instance of that subclass, and you can't create any more.
score: 4
comment on: http://stackoverflow.com/q/24439843

http://stackoverflow.com/comment/38031075
comment on: http://stackoverflow.com/q/24554489
score: 0
has text: Exceptions when i debugged in java console:Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at com.apple.laf.AquaMenuPainter.paintSelectedMenuItemBackground(AquaMenuPainter.java:153) at com.apple.laf.AquaComboBoxRendererInternal.paintComponent(AquaComboBoxRenderer.java:151) at javax.swing.JComponent.paint(JComponent.java:1054) at javax.swing.CellRendererPane.paintComponent(CellRendererPane.java:151) at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:227) at javax.swing.plaf.basic.BasicListUI.paintImpl(BasicListUI.java:317)
type: Comment
type: QuestionComment

jstl
tags question: http://stackoverflow.com/q/24476586
tags question: http://stackoverflow.com/q/24530719
tags question: http://stackoverflow.com/q/24559149
tags question: http://stackoverflow.com/q/24507567
tags question: http://stackoverflow.com/q/24546440
type: Tag
tag name: jstl
tags question: http://stackoverflow.com/q/24530581
tags question: http://stackoverflow.com/q/24556976
tags question: http://stackoverflow.com/q/24512068
tags question: http://stackoverflow.com/q/24453762
tags question: http://stackoverflow.com/q/24569786
tags question: http://stackoverflow.com/q/24453176
tags question: http://stackoverflow.com/q/24490270
tags question: http://stackoverflow.com/q/24434650

http://stackoverflow.com/a/24477110
has body: Found the solution: The button is executing a JavaScript when clicked. One can directly call that JavaScript function with the Selenium WebDriver. ((JavascriptExecutor) driver).executeScript("cwc.getCenterWindow().tpzExecute('3',null,'detail');"); Hope this answer helps people having the same troubles.
type: Answer
has comment: http://stackoverflow.com/comment/37890047
upvote count: 2
has comment: http://stackoverflow.com/comment/37922984
has comment: http://stackoverflow.com/comment/37900150
has comment: http://stackoverflow.com/comment/37899411
score: 1
answers question: http://stackoverflow.com/q/24476722
downvote count: 1
has comment: http://stackoverflow.com/comment/37913651
has comment: http://stackoverflow.com/comment/37905513

http://stackoverflow.com/q/24427985
score: 1
favorite count: 0
tagged with: info.plist
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/24455040
has title: Edit the Info.plist after eclipse product build
possible better answer: http://stackoverflow.com/a/33969299
has answer: http://stackoverflow.com/a/33969299
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24455040
has body: I have a feature based product which is built using Eclipse. My problem is that I have integrated the "self-update" feature on the rcp application, and after an update, the application bundle is rewrited (I mean the .app bundle, including the Info.plist). I have to edit the Info.plist, because I have some important keys (like the LSBackgroundOnly which is critical, and the "-vm" eclipse argument, in case clients don't have the JRE installed on their computers). So, after an update, all my modifications are removed, and I would like to keep them. My questions are: is it possible to provide a custom Info.plist to be automatically packaged in the bundle by Eclipse? If so, how can I do it? If not, can I add some properties which will be automatically added to the Default Info.plist by eclipse? If so, how? Thanks for your help. Narutim8
tagged with: eclipse
answer count: 2
downvote count: 0

http://stackoverflow.com/q/24551803
type: Question
has title: JavaFX implement Post render event with initialize method
upvote count: 1
answer count: 1
favorite count: 0
tagged with: javafx-2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38148692
has answer: http://stackoverflow.com/a/24555669
downvote count: 0
score: 1
tagged with: java
has body: I need to update controller with some Text messages as soon as the initialize method was executed. That mean Post sage of the UI (due to user need to see appearing this messages). I have seen some solution with similar post Post render event in JavaFX , How to listen for WindowEvent.WINDOW_SHOWN. But it seems I can not accomplish my task with those solutions. As a solution When I used WindowEvent.WINDOW_SHOWN as following manner, it will try to execute this event handler place which I have declared (with the early stage of the application) that mean when the Stage is initialized (with execution of Application's start(Stage stage)) then I got some Null Pointer Exceptions. My application have number of Controllers and I need to make this while middle of some UI flow. How can I accomplish this task as soon as the particular controller's initialize method was executed (on post render stage). Thanks. @Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(); Parent root = (Parent)loader.load(TestController.class.getResourceAsStream("TestView.fxml")); final TestController controller = (TestController)loader.getController(); stage.addEventHandler(WindowEvent.WINDOW_SHOWN, new EventHandler&lt;WindowEvent&gt;() { @Override public void handle(WindowEvent window) { controller.handleWindowShownEvent(); } } }); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } As following in my application When I add the Event Handler and load the relevant Controller with Spring Context it will produce Null Pointer Exception. With the handleWindowShowEvent method I use all the UI components and resource bundle I have declared. When the method is going to execute it will generate Null Pointer Exception with those UI controllers and resource bundle invocations. Problem is, due to UI was not yet rendered it seems Initialize block was not executed yet but handleWindowShowEvent method going to use those uninitialized components. Add the Even…
linked to: http://stackoverflow.com/q/8944445
linked to: http://stackoverflow.com/q/16917988

http://stackoverflow.com/q/24485109
has title: how to use Linux mincore() in java
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/34110003
favorite count: 0
has body: In java, how to find pages are resident in memory of a file. i have found mincore() in C library, mincore - determine whether pages are resident in memory how to find pages of a file in memory using java?
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/a/24504130
downvote count: 0
answers question: http://stackoverflow.com/q/24460197
type: Answer
accepted answer of: http://stackoverflow.com/q/24460197
has body: This following code solved my problem using Google Books API itself. /////////////////////////////////////////////////// UrlFetchTransport url = new UrlFetchTransport(); final Books books = new Books.Builder( url, jsonFactory, null) .setApplicationName(APPLICATION_NAME) .setGoogleClientRequestInitializer( new GBookRequest()).build(); List volumesList = books.volumes().list("isbn:9780199562855"); // Execute the query. Volumes volumes = volumesList.execute(); if (volumes.getTotalItems() == 0 || volumes.getItems() == null) { log.info("No matches found in GBooks."); return null; } /////////////////////////////////////////////////// public class GBookRequest extends BooksRequestInitializer { private static String apiKey = "xxxxxx"; public GBookRequest() { super(apiKey); } @Override public void initializeBooksRequest(BooksRequest request) throws IOException { request.set("country", "US"); } } ///////////////////////////////////////////////////
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/a/24577128
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24513884
answers question: http://stackoverflow.com/q/24513884
score: 0
has body: Curiously, the kind of HTTP server connector changes the behavior of the code. I've entered an issue for that (https://github.com/restlet/restlet-framework-java/issues/927). As a workaround, I suggest you to precise the path, as follow: getCookieSettings().add(new CookieSetting(0, "k", key, "/", null)); NB: inside a ServerResource; you can use the shortcut "getCookieSettings()", instead of "getResponse().getCookieSettings()".

http://stackoverflow.com/q/24573296
has answer: http://stackoverflow.com/a/24729575
has comment: http://stackoverflow.com/comment/38064074
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38064219
type: Question
has body: I'm trying to send and email programmatically from my Android app, using some known methods which I took from here. The method is working fine with gmail account, but when I try with a different provider account like, hotmail, yahoo, outlook, it throws this error: 07-04 13:18:34.736: I/System.out(32140): ERROR SENDING MESSAGE: javax.mail.MessagingException: Could not connect to SMTP host: smtp-mail.outlook.com, port: 587; 07-04 13:18:34.736: I/System.out(32140): nested exception is: 07-04 13:18:34.736: I/System.out(32140): javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7912c980: Failure in SSL library, usually a protocol error 07-04 13:18:34.736: I/System.out(32140): error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x7387f7d0:0x00000000) I'm using the following credentials to send the mail: User: @hotmail.com Host: smtp-mail.outlook.com Port: 587 Tried with different accounts (all of them non gmail) and I get the same error every time. My MailSender class is: public class MailSender{ public synchronized static void sendMail(String[] dest, String org, String pass, String body, String port, String host){ String[] to = dest; final String user = org; final String password = pass; MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); CommandMap.setDefaultCommandMap(mc); Properties props = new Properties(); props.put("mail.smtp.user", user); props.put("mail.smtp.host", host); props.put("mail.smtp.port", p…
possible better answer: http://stackoverflow.com/a/24573469
has answer: http://stackoverflow.com/a/24573469
downvote count: 0
has answer: http://stackoverflow.com/a/25721837
has title: Error sending email programmatically from non gmail account
answer count: 3
tagged with: email
tagged with: authenticator
favorite count: 0
accepted answer: http://stackoverflow.com/a/25721837
tagged with: android

http://stackoverflow.com/comment/37914808
comment on: http://stackoverflow.com/q/24492428
score: 0
type: Comment
type: QuestionComment
has text: Could you paste the stacktrace? It can help what memory area is related to the error.

http://stackoverflow.com/comment/37860302
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24463768
has text: The error is pretty straight forward: `Class com.badlogic.gdx.graphics.g2d.SpriteBatch does not implement the requested interface com.badlogic.gdx.graphics.g2d.Batch`
type: Comment

http://stackoverflow.com/a/31285895
has comment: http://stackoverflow.com/comment/60460361
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24481238
score: 0
has body: I had nearly the same problem with data encoded in doublebyte charset. Answer 3 above contains already the critical pitfalls you should keep an eye on. Define a Charset for the source encoding. Define a Charset only for the target encoding if it is different from your local sytem encoding. Following code works public static String convertUTF16ToString(byte[] doc) { final Charset doublebyte = StandardCharsets.UTF_16; // Don't need this because it is my local (system default). //final Charset ansiCharset = StandardCharsets.ISO_8859_1; final CharBuffer encoded = doublebyte.decode(ByteBuffer.wrap(doc)); StringBuffer sb = new StringBuffer(encoded); return sb.toString(); } Replace system default by your favorite encoding. public static String convertUTF16ToUTF8(byte[] doc) { final Charset doublebyte = StandardCharsets.UTF_16; final Charset utfCharset = StandardCharsets.UTF_8; final Charset ansiCharset = StandardCharsets.ISO_8859_1; final CharBuffer encoded1 = doublebyte.decode(ByteBuffer.wrap(doc)); StringBuffer sb = new StringBuffer(encoded1); final byte[] result = ansiCharset.encode(encoded1).array(); // alternative to utf-8 //final byte[] result = utfCharset.encode(encoded1).array(); return new String(result); }

keystroke
type: Tag
tags question: http://stackoverflow.com/q/24470164
tag name: keystroke

http://stackoverflow.com/q/24499688
upvote count: 3
has body: I am testing an application in Eclipse with debugging, using a main method, and the application does not terminate. When I look at the debug profile, it seems that Thread DestroyJavaVM is the only thread left. Are there any ideas how I can determine why the app is not stopping? MyApp[Java Application] com.myapp.testing.MyTest at localhost:63807 Thread [DestroyJavaVM] (Running) C:\Program Files\Java\jdk1.7.0\bin\javaw.exe (Jun 30, 2014, 5:50:05 PM) EDIT: If I run my app's main method from the command line it also hangs and does not finish. So obviously I have some bad code. Therefore I have two questions: 1) Why does Eclipse only show the DestryJavaVM Thread? 2) What are some approaches to determine what is causing this app never to terminate?
has comment: http://stackoverflow.com/comment/44842323
has title: DestroyJavaVM only thread left
has answer: http://stackoverflow.com/a/24499830
has comment: http://stackoverflow.com/comment/37928027
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
downvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24552126
has comment: http://stackoverflow.com/comment/38024518
has body: According to my understanding, a method with variable length argument and another method with array as an argument are interchangeable. for eg. void test(int ... ints){} //method-1 is same as void test (int [] ints){} //method-2 and we can't use both in the same class (Compile Time Error). When I use method-1, I can call this method by passing some integers or by passing an array of integers since calling this method using some integers will implicitly create an array of those integers. For eg. test(1,2,3); //ok test(new int[5]); //ok But, When I use method-2, I can't call this method by passing some integers as arguments. test(new int[5]); //ok test(1,2,3); //NOT OK Questions: 1) If java implicitly creates an array of the arguments, why it is not able to call test(1,2,3) in case of method-2. 2) Why java doesn't allow using method-1 and method-2 together when both show different behavior?
type: UnansweredQuestion
has title: How does 'variable length arguments' work in Java?
has answer: http://stackoverflow.com/a/24552182
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38024567
upvote count: 1
has answer: http://stackoverflow.com/a/24552361
has comment: http://stackoverflow.com/comment/38024671
type: Question
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/24552214
tagged with: arrays
tagged with: variadic-functions
favorite count: 0
linked to: http://stackoverflow.com/q/2925153

http://stackoverflow.com/q/24585911
accepted answer: http://stackoverflow.com/a/24586106
has comment: http://stackoverflow.com/comment/38087354
has body: http://www.youtube.com/watch?v=M0cNsmjK33E I want to develop something similar to the link above using Java Swing. I have the sorting method and did while repaint but when I triggered the sorting, instead of showing the bars slowly sorting itself, it freezes and then unfreezes when the array has been fully sorted. How do I fix this? Edit: sorry forgot about the codes. its a very simple gui. and another class for sorting which sorts the whole array public class SortGUI { JFrame frame; int frameWidth = 1000, frameHeight = 1000; int panelWidth, panelHeight; DrawPanel panel; JPanel panel2; JScrollPane scroll; JViewport view; static int[] S = new int[50000]; public static void main(String[] args) throws InterruptedException { SortGUI app = new SortGUI(); initializeArray(); app.go(); } public static void initializeArray() { for (int i = 0; i &lt; S.length; i++) { S[i] = (int) (Math.random() * 16581375); } } public void go() throws InterruptedException { //Frame frame = new JFrame(); frame.setSize(frameWidth, frameHeight); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //panel panel = new DrawPanel(); scroll = new JScrollPane(panel,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //Layout frame.add(scroll); frame.addKeyListener(new keyListener()); while(true) { panel.repaint(); } } public class DrawPanel extends JPanel { public DrawPanel() { this.setPreferredSize(new Dimension(50000,930)); } public void paintComponent(Graphics g) { g.setColor(Color.WHITE); g.fillRect(0, 0, this.getWidth(), this.getHeight()); for(int i = 0; i &lt; S.length; i++) { int red = S[i] / 65025; int green = (S[i] &gt; 65025)? S[i] % 65025 : 0; int blue = green; blue %= 255; green /= 255; g.setColor(new Color(red,green,blue)); g.fillRect(i, 900 - (S[i] / 18500), 1, S[i] / 18500); } } } public class keyListener implements KeyListener{ public void keyTyped(KeyEvent ke) { } public void keyPressed(KeyEvent ke) { if(ke.getKeyChar() == '1')…
favorite count: 0
tagged with: event-dispatch-thread
tagged with: animation
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38087556
tagged with: java
has answer: http://stackoverflow.com/a/24586106
linked to: http://stackoverflow.com/q/940913
type: Question
has title: Java swing repainting while computing: animating sorting algorithm
has comment: http://stackoverflow.com/comment/38087417
answer count: 1
tagged with: sorting
score: 0

http://stackoverflow.com/q/24448505
has comment: http://stackoverflow.com/comment/37832246
has comment: http://stackoverflow.com/comment/37832301
score: 0
has comment: http://stackoverflow.com/comment/37832953
has title: JSON validation is not happening
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37832406
answer count: 0
has comment: http://stackoverflow.com/comment/37832068
has comment: http://stackoverflow.com/comment/37832241
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am facing some problem in JSON validation. The code I am using is import net.sf.json.JSONException; import net.sf.json.JSONObject; String stringToValidate="{'customer':[{'condition':'Matches','value':'nordstrom,nordstromrack,neimanmarcus,neimanmarcuslastcall,tjmaxx,macys,dsw,saksfifthavenue,off5th,bananarepublic,jcrew,bloomingdales'}],'notcustomer':[{'condition':'Matches','value':'neimanmarcuslastcall'}],'daterange':[{'condition':'In the last','value':'6 months'}]}"; try { System.out.println(stringToValidate); JSONObject.fromObject(stringToValidate); /* try { Map&lt;String, Object&gt; tsMap = new Json2Java().getMap(stringToValidate); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return false; }*/ System.out.println(true); } catch (JSONException je) { je.printStackTrace(); System.out.println(false); } and it is validating the syntax fine. As you can see I am using single commas (') for my tag names like 'customer':...... So my problem is, if I remove this ' from the tag still it's printing true and I want to fail the condition in this case.
type: Question
has comment: http://stackoverflow.com/comment/37833177

http://stackoverflow.com/a/24440736
has comment: http://stackoverflow.com/comment/37818180
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37818106
has body: Java is smart enough since Java 7 by usage of diamond operator: FindMiddleStack&lt;Integer&gt; fm = new FindMiddleStack&lt;&gt;(); Note that using this approach: FindMiddleStack&lt;Integer&gt; fm = new FindMiddleStack(); You're initializing your generic class with a raw type, which raises a warning but you can work with Integer elements in fm and the compiler will check it. The other way: FindMiddleStack fm = new FindMiddleStack&lt;Integer&gt;(); You have a raw class initialized with a generic, which also raises a warning. But this case is worse than the first one, since the compiler cannot check the generic elements that will be used in fm.
downvote count: 0
answers question: http://stackoverflow.com/q/24440728
type: Answer

http://stackoverflow.com/q/24519849
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37980352
type: Question
tagged with: jakarta-ee
has title: Is there a way to launch an EAR from maven?
tagged with: java
has body: Is there a maven module that allows you to launch an container and deploy an ear when you build a project? For example you can do this with Tomcat by using the Tomcat plugin for maven and running mvn clean install tomcat:run
answer count: 1
has answer: http://stackoverflow.com/a/24519919
tagged with: maven-3
score: 0
has comment: http://stackoverflow.com/comment/38111861

http://stackoverflow.com/q/24429905
has comment: http://stackoverflow.com/comment/37800137
has comment: http://stackoverflow.com/comment/37797460
has body: I have this dilemma when it is said about two activities having a parent/child relationship in Android ecosystem. So which one is it: Activity-A spawns Activity-B ? Activity-A spawns Activity-B and Activity-B inherits parent Activity-A ? Any idea/pointer is appreciated.
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37801335
has comment: http://stackoverflow.com/comment/37797715
score: 0
tagged with: java
has title: What does having a Parent / Child Relationship really means in Android Ecosystem?
has comment: http://stackoverflow.com/comment/37797595
type: Question
has comment: http://stackoverflow.com/comment/37797507
has comment: http://stackoverflow.com/comment/37797837
tagged with: inheritance
tagged with: parent-child
tagged with: android-activity

http://stackoverflow.com/q/24434421
has comment: http://stackoverflow.com/comment/37853453
has answer: http://stackoverflow.com/a/24440722
has body: I tried to update my Guice version from 4.0-beta to 4.0-beta4 this morning and I started having problems with the MapBinder. I have a base module that extend JerseyServletModule. In the configureServlets() method, I do : MapBinder&lt;String, ExportData&gt; exportDataMapBinder = MapBinder.newMapBinder(binder(),String.class,ExportData.class); binder().requireExplicitBindings(); bindCommonServices(); install(new V8Module(exportDataMapBinder)); I populate the map in private modules, like this : exportDataMapBinder.addBinding(VERSION).to(ExportDataV8.class); ExportData is an interface and ExportDataV8 implements it (I won't paste them to keep the question short). It worked just fine using guice 4.0-beta, but with guice 4.0-beta4, I started having errors like this : 1) Explicit bindings are required and com.coveo.ua.data.export.ExportData annotated with @com.google.inject.multibindings.Element(setName=, uniqueId=2, type=MAPBINDER) is not explicitly bound. while locating com.coveo.ua.data.export.ExportData annotated with @com.google.inject.multibindings.Element(setName=, uniqueId=2, type=MAPBINDER) at com.google.inject.multibindings.MapBinder$RealMapBinder$1.initialize(MapBinder.java:380) at com.coveo.ua.config.UsageAnalyticsBaseModule.configureServlets(UsageAnalyticsBaseModule.java:223) Anybody has an idea what I am doing wrong ? Please tell me if I forgot to include important details.
has title: Explicit binding required with MapBinder - Guice 4.0 beta4
upvote count: 1
accepted answer: http://stackoverflow.com/a/26721001
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37853539
type: Question
answer count: 2
tagged with: dependency-injection
tagged with: guice
downvote count: 0
has comment: http://stackoverflow.com/comment/37849227
favorite count: 0
has answer: http://stackoverflow.com/a/26721001
possible better answer: http://stackoverflow.com/a/24440722

http://stackoverflow.com/a/24441131
has comment: http://stackoverflow.com/comment/37819061
score: 0
has comment: http://stackoverflow.com/comment/37856536
type: Answer
has body: You have at least five options: POST (I am not sure what the limit on App Engine is, but I would guess that up to 10MB should be fine). Datastore (no limit). Google Cloud Storage (no limit). Dedicated memcache (up to 1MB). Regular memcache backed by a datastore (up to 1MB). The last option is probably the most cost-effective assuming your object fits in Memcache. Your backend instance creates a map, puts it in a datastore and puts it into the Memcache. Your front-end instance tries to load it from Memcache. If it's not available there, it loads it from the datastore and puts it into the Memcache in case it needs it again. UPDATE: While your map is large, you can still go with the last, most effective, option. On the backend: ArrayList&lt;Entity&gt; batch = new ArrayList&lt;Entity&gt;(500); for (String key : map.keySet()) { memcache.put(key, map.get(key)); Entity entity = new Entity("Entry", key); entity.setUnindexedProperty("value", map.getKey()); /* or, if a value can be longer than 500 characters * entity.setUnindexedProperty("value", new Text(map.getKey())); */ batch.add(entity); if (batch.size() == 500) { datastore.put(batch); batch.clear(); } } datastore.put(batch); This will work if you don't need to know all keys on the front-end. If you do, then check if your keySet() is smaller than 1MB so you can put it in Memcache as an object. If it's larger, then skip the memcache part and simply use the datastore: Query q = new Query("Entry"); // etc.
answers question: http://stackoverflow.com/q/24440342

http://stackoverflow.com/q/24552261
has comment: http://stackoverflow.com/comment/38053020
type: UnansweredQuestion
has title: How to automate mainframe application using java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38028964
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38024910
has comment: http://stackoverflow.com/comment/38031432
has comment: http://stackoverflow.com/comment/38027708
linked to: http://stackoverflow.com/q/1248510
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38032049
has body: I know this question is asked many times.But i didnt get what i want. I need to automate quick3270 which is used to connect to mainframe using java. First let me tell you what i want. I need my code to open quick3270.exe then open my saved session:---this is done. Now, I have to send commands to the quick3270.Here comes the problem, I dont know how to send command to that software. Third is I am using robot class.So that i can input:TAB,ENTER,F3 etc. inputs. So, the whole thing is I want to send commands to quick3270. I need interval also.Like send one command then delay of 1 second then other and so on. public static void main(String[] args) throws IOException, AWTException { String exeloc = "C:\\Program Files\\Quick3270\\Quick3270.exe "; // my saved session String directory = "C:\\Users\\c111128\\Desktop\\Project\\xyz.ecf"; ProcessBuilder builder = new ProcessBuilder(new String[] { exeloc, directory }); // Starting the process Process p = builder.start(); // For handling keyboard events Robot robot = new Robot(); try { robot.delay(2000); // Passing enter key to top screen robot.keyPress(KeyEvent.VK_ENTER); robot.delay(4000); // Here I want to write the command //Command like:"teleview" which is used in mainframe robot.delay(1000); } catch (Exception e) { System.out.println("Second:" + e); e.printStackTrace(); } }
tagged with: processbuilder
has answer: http://stackoverflow.com/a/36285455

http://stackoverflow.com/comment/37975161
type: Comment
type: QuestionComment
has text: " Eventhough at the end of the my method I return a "Screen" object" this is simply not correct.
score: 0
comment on: http://stackoverflow.com/q/24525727

http://stackoverflow.com/a/24521570
upvote count: 1
score: 1
has body: If I understand your question, you could write a method like String removeFromEnd(String, String) - public static String removeFromEnd(String in, String rem) { if (in != null) { if (in.endsWith(rem)) { return in.substring(0, in.length() - rem.length()).trim(); } return in.trim(); } return null; } public static void main(String[] args) { String person = "Hello, World. more&gt;&gt;"; String toRemove = "more&gt;&gt;"; System.out.printf("'%s'%n", removeFromEnd(person, toRemove)); } Which outputs 'Hello, World.'
downvote count: 0
answers question: http://stackoverflow.com/q/24521401
type: Answer

http://stackoverflow.com/q/24565144
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38049478
has comment: http://stackoverflow.com/comment/38049253
tagged with: java
has title: How to stop applets from being blocked by Java
has comment: http://stackoverflow.com/comment/38049463
has comment: http://stackoverflow.com/comment/38049274
type: Question
has comment: http://stackoverflow.com/comment/38049191
has comment: http://stackoverflow.com/comment/38049225
has comment: http://stackoverflow.com/comment/38049297
score: 0
has comment: http://stackoverflow.com/comment/38049223
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38049234
has body: I am making an applet right now, and I am trying to upload the file to my website. I uploaded the .class file and wrote the HTML code for it: &lt;applet codebase="example.com/files/" code="test.class"&gt; &lt;/applet&gt; After I put it on my site and publish it then run it, it tells me that Java blocked it. I wanted to know how I can prevent Java from blocking the applets that I make for myself and also other people. Do I also need a certification and how do I get it? Thanks!

http://stackoverflow.com/a/24559004
answers question: http://stackoverflow.com/q/24545862
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38040555
has comment: http://stackoverflow.com/comment/38045029
has comment: http://stackoverflow.com/comment/38046069
upvote count: 2
has body: Cassandra, prior to 2.0, was unable to page through results, so your entire query has to fit in server memory. I would highly recommended upgrading to Cassandra 2.0, and use the CQL query engine's iteration in order to perform large queries. If you are unable to do that, then you will need to retrieve your data in smaller chunks. Your heap is too big, but that is not causing this particular problem.
has comment: http://stackoverflow.com/comment/38045235

http://stackoverflow.com/q/24430639
has comment: http://stackoverflow.com/comment/37798990
has body: I have made a custom ArrayAdapter,I am getting an arrayList in taht adapter,I want to put a condition that two values from arrayList(payer_id and Payee_id) are equal or not,If equal print "equal",Else "Not qual"..My Code is as below:but its all time goes to not equal condition..Please help me save me. code public ArrayList&lt;HashMap&lt;String, String&gt;&gt; receivePaymentArray; if (receivePaymentArray.get(paramInt).get(Const.TAG_PAYEE_ID).equalsIgnoreCase(receivePaymentArray.get(paramInt).get(Const.TAG_PAYER_ID))) { System.out.println("::::::::::::::::::::::SAME IDS::::::::::::::::"); } else { System.out.println("::::::::::::::::::::::different ids:::::::::::::::"); }
tagged with: equals
accepted answer: http://stackoverflow.com/a/24431031
type: Question
possible better answer: http://stackoverflow.com/a/24431151
score: 0
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37798999
has title: how to compare two string values from custom adapter in android?
has answer: http://stackoverflow.com/a/24431031
tagged with: string-comparison
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37799366
tagged with: android
has answer: http://stackoverflow.com/a/24431151

http://stackoverflow.com/comment/38376095
type: AnswerComment
comment on: http://stackoverflow.com/a/24612203
type: Comment
score: 0
has text: It's not valid. You have to write extends even if it's an interface.

http://stackoverflow.com/q/24527391
has comment: http://stackoverflow.com/comment/38067462
has comment: http://stackoverflow.com/comment/38314021
has title: How to verify all method calls in Mockito?
score: 9
has body: I've got a JUnit test with a few methods using Mockito testing. I have quite a plenty experience with EasyMock (although not recent) so I've organized it like that: @Before public void before() { myAPI = mock(MyAPI.class); } @After public void after() { verify(myAPI); reset(myAPI); } The methods register some calls on mock, if they need them. But I've got an exception: org.mockito.exceptions.misusing.UnfinishedVerificationException: Missing method call for verify(mock) here: -> at de.datev.shared.spdvz.util.UserInfoUtilTest.after(UserInfoUtilTest.java:45) Example of correct verification: verify(mock).doSomething() I know I could do verify(myAPI).doSomething(someArgs) but: I'd have to do it in each method I'd have to repeat the same arguments, as those used in when Is there any method to simply verify, if all the methods that were registered on when were actually called? EasyMock works that way, and it was very convinient...
answer count: 2
tagged with: mockito
has comment: http://stackoverflow.com/comment/38081042
has answer: http://stackoverflow.com/a/40631289
has comment: http://stackoverflow.com/comment/38069948
has comment: http://stackoverflow.com/comment/37979618
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/59971247
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38311132
has answer: http://stackoverflow.com/a/24554562
has comment: http://stackoverflow.com/comment/37979017
downvote count: 0
has comment: http://stackoverflow.com/comment/38311583
tagged with: java
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/38081044
has comment: http://stackoverflow.com/comment/38067284
type: Question

http://stackoverflow.com/q/24459349
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: eclipse
type: Question
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/24459713
answer count: 3
has body: I'm new to JSON android java eclipse. I am doing a listview with images and parsing json array. I followed this tutorial: http://www.wingnity.com/blog/android-json-parsing-and-image-loading-tutorial/ . In that tutorial, their JSON array contains the array name.However, mine doesn't contain the array name. So my question is how to code JSON Array without the array name? Below is my JSON code. [ { "event_id": "EV00000001", "event_title": "Movie 1", }, { "event_id": "EV00000002", "event_title": "Movie2", } ] Below is my JSON coding for parsing the JSON. protected Boolean doInBackground(String... urls) { try { HttpGet httppost = new HttpGet(urls[0]); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity entity = response.getEntity(); String data = EntityUtils.toString(entity); JSONObject jsono = new JSONObject(data); JSONArray jarray = jsono.getJSONArray("actors"); for (int i = 0; i &lt; jarray.length(); i++) { JSONObject object = jarray.getJSONObject(i); Events event = new Events(); event.setevent_title(object.getString("event_title")); eventList.add(event); } return true; } //------------------&gt;&gt; } catch (ParseException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return false; } What am i suppose to do? This problem is solved. Thus, i will be posting the correct code. protected Boolean doInBackground(String... urls) { try { //------------------&gt;&gt; HttpGet httppost = new HttpGet(urls[0]); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httppost); // StatusLine stat = response.getStatusLine(); int status = response.getStatusLine().getStatusCode(); if (status == 200) { HttpEntity entity = response.getEntity(); String data = EntityUtils.toString(entity); JSO…
has answer: http://stackoverflow.com/a/24459913
accepted answer: http://stackoverflow.com/a/24459618
favorite count: 0
upvote count: 2
has title: how to code json array without array name?
tagged with: android
possible better answer: http://stackoverflow.com/a/24459713
has answer: http://stackoverflow.com/a/24459618
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/38172531
comment on: http://stackoverflow.com/a/24533068
score: 0
type: Comment
has text: @Artem, Yeah.The aggregator returns `List` by default. In my case the aggregator is returning a separate `List` for each split message.For example, Assume the message is split into two parts with the first splitter.Then naturally, I will expect those two messages coming in a single `List` at the aggregator's end rather than each split message in a separate `List`. But, in reality, these two messages are coming in two different `Lists` at the aggregator'e end.
type: AnswerComment

http://stackoverflow.com/q/24570169
type: UnansweredQuestion
has body: I am implementing a Authentication Filter and I am also using it for exception handling. As there is no web.xml in CQ5 so we can't put a mapping like &lt;exception-type&gt;. All my controllers(Servlets) throw Exception back to caller. And I have a filter that is called before each and every one of my Servlets. So I am explicitly throwing new SerlvetException() in one of my servlets. This is ofcourse thrown to the caller i.e my main filter. Exception occurs correctly at chain.doFilter() and I am handling the exception here(in filter). but it just doesn't get handled why? Also,what is this Scope property SlingFilter I dont understand this REQUEST,ERROR, COMPONENT,INCLUDE property of SlingFilter SCOPE Here is my code and stack trace. public class AddNewUserController extends SlingAllMethodsServlet{ /** * @author Oliver Kaunds */ private static final long serialVersionUID = 1L; private final Logger log = LoggerFactory.getLogger(this.getClass()); @Reference protected AddNewUserService addNewUserService; @Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { log.info("VideoJet :: Do GET Called "); String path =request.getRequestURI(); log.info("VIDEOJET PATH :: "+ path); try{ if(path.equals("/services/videojet/v1/AddNewUserController/view")) { List&lt;HRRepresentative&gt; list =addNewUserService.getHRRepresentative(); request.setAttribute("hrList",list ); HttpSession session = request.getSession(); String userOperation =(String)session.getAttribute("userOp"); request.setAttribute("userOp", userOperation); session.removeAttribute("userOp"); throw new Exception("Error Page Test"); // Manuly throw exception } And my main filter package com.videojet.hiresite.filters; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletR…
tagged with: aem
upvote count: 1
has title: SlingFilter does not catch Exceptions?
tagged with: servlet-filters
has comment: http://stackoverflow.com/comment/38120630
tagged with: sling
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/38105533
answer count: 3
has answer: http://stackoverflow.com/a/24650407
has answer: http://stackoverflow.com/a/24632086
favorite count: 0
has answer: http://stackoverflow.com/a/24604706

http://stackoverflow.com/q/24574778
tagged with: http://stackoverflow.com/tag/xml
has title: converting String to XML doc in java
has comment: http://stackoverflow.com/comment/38066754
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has body: Hello I have generated XML content as string. But I have to convert string to XML data type. String str = "<?xml version="1.0" encoding="utf-8"?> 12343322 125145552 54682242 7777332287 " How can I convert this string to xmldoc type?
duplicate of: http://stackoverflow.com/q/33262
has answer: http://stackoverflow.com/a/24574873
has comment: http://stackoverflow.com/comment/38066713
tagged with: java
has comment: http://stackoverflow.com/comment/38066638
type: Question
score: 0
answer count: 1
tagged with: string
favorite count: 0
linked to: http://stackoverflow.com/q/33262

http://stackoverflow.com/a/24563145
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24538517
has body: We resolved it to a proxy issue, and the problem was seemingly unrelated to the nature of the embedded server/standalone server connection.

http://stackoverflow.com/comment/37975431
has text: Thanks for the answer . Can you please help in point 1 you wrote. For eg: I receive the string from UI as "11AA" . Now can you please tell me how to proceed
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24525231
type: Comment

http://stackoverflow.com/a/24566750
has body: If you update your code to print the class, rather than its local name, you'll get slightly more useful results: http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Year http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Publisher http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Language http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Country http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Book http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Author 560855f:146ffa04e87:-7fe2 560855f:146ffa04e87:-7ff9 560855f:146ffa04e87:-7ff7 … Those values at the end (truncated) are blank node identifiers. The ontology has lots of anonymous restriction classes in it. E.g., &lt;Class rdf:about="http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Author"&gt; &lt;rdfs:subClassOf&gt; &lt;Restriction&gt; &lt;onProperty rdf:resource="http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#authorHasAuthorshipOfBook"/&gt; &lt;someValuesFrom rdf:resource="http://www.semanticweb.org/ikop/ontologies/untitled-ontology-46#Book"/&gt; &lt;/Restriction&gt; &lt;/rdfs:subClassOf&gt; … This is the axiom Author subClassOf (authorHasAuthorshipOfBook some Book) The important thing to recognize is that (authorHasAuthorshipOfBook some Book) is a class. It's the class of things that have authorship of a Book. It can have instances, superclasses, subclasses, etc., just like any other class. As such, it appears in listClasses. You can get the results that you want if you only print those that are URI resources: while ( it.hasNext() ) { OntClass klass = it.next(); if ( klass.isURIResource() ) { System.out.println( klass ); } } Of course, Jena's extended iterators let you filter, so you can actually keep the same iteration code, but use a slightly different iterator: import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModelSpec; import com…
type: Answer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24564582
answers question: http://stackoverflow.com/q/24564582
score: 5
type: AcceptedAnswer

c#
tags question: http://stackoverflow.com/q/24536006
tags question: http://stackoverflow.com/q/24480078
tags question: http://stackoverflow.com/q/24513280
tags question: http://stackoverflow.com/q/24434934
tags question: http://stackoverflow.com/q/24476297
tags question: http://stackoverflow.com/q/24550183
tag name: c#
tags question: http://stackoverflow.com/q/24490918
tags question: http://stackoverflow.com/q/24528262
tags question: http://stackoverflow.com/q/24559399
tags question: http://stackoverflow.com/q/24448597
tags question: http://stackoverflow.com/q/24524060
tags question: http://stackoverflow.com/q/24505264
tags question: http://stackoverflow.com/q/24499833
tags question: http://stackoverflow.com/q/24474663
type: Tag
tags question: http://stackoverflow.com/q/24460969
tags question: http://stackoverflow.com/q/24472536
tags question: http://stackoverflow.com/q/24436291
tags question: http://stackoverflow.com/q/24429778
tags question: http://stackoverflow.com/q/24464349
tags question: http://stackoverflow.com/q/24530091
tags question: http://stackoverflow.com/q/24554248

http://stackoverflow.com/q/24468503
tagged with: java
accepted answer: http://stackoverflow.com/a/24468523
has title: How is it possible to pick the last value after hash?
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/24468517
has answer: http://stackoverflow.com/a/24468517
has body: I have a String as shown below How is it possible to pick the last value after hash ?? Fountain#Apple#Big(7) should give Big(7) Fountain#Orange(8) should give Orange(8) I can do this using StringTokienizer , but just want to chek if there is any better and simple way of doing this ??
has answer: http://stackoverflow.com/a/24468523
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24468558

http://stackoverflow.com/comment/37942707
comment on: http://stackoverflow.com/a/24502075
type: AnswerComment
has text: thanks for the effort but unfortunately your answer misses the key point that the files are tarred and then gzipped and hence have to be gzipped into a plain tar before untarring. I now have a solution which I'll post in a minute
score: 0
type: Comment

http://stackoverflow.com/comment/78249952
comment on: http://stackoverflow.com/q/24492795
has text: Because some input fields react as users type, e.g. start a search after 3 characters, cancel it if another character is pressed and start a search for 4-character string, etc. The logic can be quite complex.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/37951778
type: QuestionComment
comment on: http://stackoverflow.com/q/24494573
type: Comment
has text: Looks like when you load an instance of `MyClass1` it will also load an instance for `MyClass2` and `MyClass3` as well, and if each of these instances have mappings to more classes, then they would be loaded as well. Which means that in your query you only load data for a single class but when doing it on Hibernate you're loading data for your 380+ classes (probably).
score: 0

http://stackoverflow.com/comment/38063969
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24573132
has text: Is this from English texts?

http://stackoverflow.com/a/27393801
answers question: http://stackoverflow.com/q/24522148
has body: In my case, same to you blank activity don't generate java&amp;layout but empty activity works well. EditText could use with API20, API21. (BTW blank activity worked well with previous installed).
upvote count: 3
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/comment/37893734
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24481234
has text: @camickr I think because everybody has a different opinion on exactly what is required (left/right alignment, fill, weight ...)

http://stackoverflow.com/q/24477376
accepted answer: http://stackoverflow.com/a/24477448
tagged with: java
has comment: http://stackoverflow.com/comment/37885880
has comment: http://stackoverflow.com/comment/37885842
type: Question
tagged with: filenotfoundexception
has answer: http://stackoverflow.com/a/24477448
has comment: http://stackoverflow.com/comment/37886019
has answer: http://stackoverflow.com/a/24477581
answer count: 2
downvote count: 4
has title: can't read from file, Java
has comment: http://stackoverflow.com/comment/37885848
favorite count: 0
has body: When I try to run the programm, it always throws a FileNotFoundException, although the file exists in the same folder as the project. I tested it with the canRead() method and it returned false, but I can't figure out why it can't read from the file. package sumOfFloats; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class SumOfFloats { public static float sumFloats() throws FileNotFoundException{ File file = new File("floatNumbers.txt"); float[] array = new float[100]; int i = 0 ; float floatSum = 0.0f; Scanner fileReader = new Scanner(file); while(fileReader.hasNextLine()){ array[i] = fileReader.nextFloat(); } for(int j = 0; j &lt; array.length; j++){ floatSum += array[i]; i++; } return floatSum; } public static void main(String[] args) throws FileNotFoundException { System.out.println(sumFloats()); } }
has comment: http://stackoverflow.com/comment/37885855
score: -4
possible better answer: http://stackoverflow.com/a/24477581
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/37972060
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24523828
score: 0
has text: I think you are approaching from the wrong side. Usually Client will invoke a request(ajax or non ajax) and based on response it will update the page.

http://stackoverflow.com/comment/37869627
type: Comment
has text: solved: i typed bad connection url: 8080 instead of 5432, uf and driver class was bad too, thanks guys
type: AnswerComment
comment on: http://stackoverflow.com/a/24465119
score: 0

http://stackoverflow.com/q/24451609
linked to: http://stackoverflow.com/q/6198240
has title: Does using small datatypes reduce memory usage (From memory allocation not efficiency)?
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37837766
has comment: http://stackoverflow.com/comment/37838452
favorite count: 0
accepted answer: http://stackoverflow.com/a/24451873
has body: Actually, my question is very similar with this one, but the post is focus on the C# only. Recently I read an article said that java will 'promote' some short types (like short) to 4 bytes in memory even if some bits are not used, so it can't reduce usage. (is it true ?) So my question is how languages, especially C, C++ and java (as Manish said in this post talked about java), handles memory allocation of small datatypes. References or any approaches to figure out it are preferred. Thanks
has comment: http://stackoverflow.com/comment/37839145
linked to: http://stackoverflow.com/q/14531235
has comment: http://stackoverflow.com/comment/37838097
linked to: http://stackoverflow.com/q/605845
tagged with: c++
score: 2
tagged with: memory-management
possible better answer: http://stackoverflow.com/a/24452229
upvote count: 2
has answer: http://stackoverflow.com/a/24452229
has comment: http://stackoverflow.com/comment/37837938
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24451873
tagged with: java
has comment: http://stackoverflow.com/comment/37838015
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/37837919
has comment: http://stackoverflow.com/comment/37837905

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/24561953
type: Tag
tags question: http://stackoverflow.com/q/24480237

http://stackoverflow.com/comment/37931039
type: Comment
has text: i have reviewed it. that is why i am asking it here. obviously there is something i am missing/not understanding
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24501441

http://stackoverflow.com/comment/37957188
has text: Whatever is changed in first machine by other controller post request is seen by second machine when the get request is invoked
type: Comment
comment on: http://stackoverflow.com/a/24515843
score: 0
type: AnswerComment

http://stackoverflow.com/q/24566749
answer count: 2
has title: number range in comma separated string
score: 0
has comment: http://stackoverflow.com/comment/38052716
has answer: http://stackoverflow.com/a/24567455
has body: I have to create a method that allow user to create offer id range like follows ... 3,4,5 3,,6 3,102, 3,104,* in the above examples there are three type of format (i.e x,x,x OR x,,x OR x,x,), where x is a number in asc order. my problem is in i have to make sure that user is not able to create offer id range with overlap id range. for example ... if offer id 3,102,* already created than user not able to create following combinations ... 3,102,105 similarly if offer id range 3,* is already exists than user not able to create 3,4 Or 3,5 OR 3,10,11 like combinations. i am not able to complete my following method String[] digits1 = range1.split(","); String[] digits2 = range2.split(","); int digits1Len = digits1.length; int digits2Len = digits2.length; if (digits1[digits1Len -1].equals("*")) { --digits1Len; } if (digits2[digits2Len -1].equals("*")) { --digits2Len; } String[] digits1_1 = new String[digits1Len]; String[] digits2_2 = new String[digits2Len];; System.arraycopy(digits1, 0, digits1_1, 0, digits1Len); System.arraycopy(digits2, 0, digits2_2, 0, digits2Len); if(!Arrays.asList(digits1_1).contains("*") || !Arrays.asList(digits2_2).contains("*")) { if (digits1_1[digits1Len -1].equals(digits2_2[digits2Len -1])) { if(digits1Len != digits2Len) { result = false; } else{ // Loop } } else if(false/*Lenght of the array with higher element should be more by 1 as compared to ther array*/) { } } else { String [] normalPatternArr = null; String [] oldPatternArr = null; if(Arrays.asList(digits1_1).contains("*")) { if (digits1_1.length &lt; digits2_2.length) { result = false; } else { normalPatternArr = digits2_2; oldPatternArr = digits1_1; } } else if(Arrays.asList(digits2_2).contains("*")) { if (digits2_2.length &lt; digits1_1.length) { result = false; } else { normalPatternArr = digits1_1; oldPatternArr = digits2_2; } } else { for (int i=0; i &lt; normalPatternArr.length; i++) { if (!normalPatternArr[i].equals(oldPatternArr[i])) { if (!oldPatternArr[i].equals("*")) { result =…
type: UnansweredQuestion
tagged with: range
has comment: http://stackoverflow.com/comment/38052513
tagged with: numbers
tagged with: java
has answer: http://stackoverflow.com/a/24567209
type: Question

http://stackoverflow.com/a/26900848
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24553626
accepted answer of: http://stackoverflow.com/q/24553626
type: Answer
has body: Using Matrix.setXXX() will replace the previous matrix transformations. Instead of setValues, you can use: playerMatrix.postRotate(rotation, bitmap.getWidth()/2, bitmap.getHeight()/2); playerX += xspeed; playerY += yspeed; playerValues[Matrix.MTRANS_X] = playerX; playerValues[Matrix.MTRANS_Y] = playerY; playerMatrix.postTranslate(playerX, playerY);
score: 0

http://stackoverflow.com/q/24530463
has comment: http://stackoverflow.com/comment/37985707
score: 0
has comment: http://stackoverflow.com/comment/37985004
tagged with: java
tagged with: hibernate
has body: My peristance file is: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence sau.se.migration.model.TGridStation sau.se.domain.model.Graph sau.se.domain.model.Role sau.se.domain.model.StationPrincipale sau.se.domain.model.StationSecondaire sau.se.domain.model.User sau.se.domain.model.Incident sau.se.domain.model.Listes sau.se.domain.model.Vip sau.se.domain.model.Feeder <!--<property name="hibernate.archive.autodetection" value="class, hbm" /> --> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="true" /> <property name="use_sql_comments" value="true" /> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> <property name="hibernate.connection.url" value="jdbc:mysql://localhost/semap?zeroDateTimeBehavior=convertToNull" /> <property name="hibernate.connection.useUnicode" value="true" /> <property name="hibernate.connection.characterEncoding" value="UTF-8" /> <property name="hibernate.connection.charSet" value="UTF-8" /> <property name="hibernate.connection.username" value="root" /> <property name="hibernate.connection.password" value="123456789" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> And I am quiet sure that it is the only configuration file in my project because I tried to put wrong password and I got the expected error on connection. I want to change semap db name to any other but in vain. Is there any other configuration that I don't know? UPDATE The real problem is that my application is still working with semap db (the old one)
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37984022
has comment: http://stackoverflow.com/comment/37984897
has title: Changing database in eclipse/hibernate project
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37984869
has comment: http://stackoverflow.com/comment/37999381
answer count: 0
tagged with: data-persistence
type: Question
has comment: http://stackoverflow.com/comment/37984634

http://stackoverflow.com/q/24547335
tagged with: java
tagged with: cors
tagged with: jersey
accepted answer: http://stackoverflow.com/a/24714759
answer count: 1
downvote count: 0
favorite count: 0
tagged with: filter
tagged with: dropwizard
has body: I am trying to get a dropwizard 0.7.0 (Jersey) REST service to send HTML CORS header like "Access-Control-Allow-Origin". I found various tutorials and also learned about the difference how to do it in 0.7.0 and the previous version. The most promising way seems to be the one described in the dropwizard group but when I use the given code, no headers are sent whatsoever. The filter does not seem to be working. When I use a custom filter, it is being initialized but not used as well. Nothing unusual in the log so far. This is my (latest) run method: @Override public void run(BackendConfiguration configuration, Environment environment) throws Exception { // XXX why doesn't this work? FilterRegistration.Dynamic filter = environment.servlets().addFilter("CORS", CrossOriginFilter.class); filter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); filter.setInitParameter("allowedOrigins", "*"); // allowed origins comma separated filter.setInitParameter("allowedHeaders", "Content-Type,Authorization,X-Requested-With,Content-Length,Accept,Origin"); filter.setInitParameter("allowedMethods", "GET,PUT,POST,DELETE,OPTIONS,HEAD"); filter.setInitParameter("preflightMaxAge", "5184000"); // 2 months filter.setInitParameter("allowCredentials", "true"); final DBIFactory factory = new DBIFactory(); final DBI jdbi = factory.build(environment, configuration.getDataSourceFactory(), "h2"); environment.jersey().register(new UserResource(jdbi)); } Is there something I am doing wrong?
has title: Using CORS header filter with dropwizard 0.7.0
upvote count: 1
has answer: http://stackoverflow.com/a/24714759
type: Question
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/24460934
has comment: http://stackoverflow.com/comment/37855286
favorite count: 0
has comment: http://stackoverflow.com/comment/47375659
has comment: http://stackoverflow.com/comment/37855337
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37855112
tagged with: maven
has comment: http://stackoverflow.com/comment/37862483
linked to: http://stackoverflow.com/q/7904756
score: 2
upvote count: 3
tagged with: java
tagged with: hibernate
has title: Cannot load JDBC driver class 'com.postgresql.jdbc.Driver'
downvote count: 1
has answer: http://stackoverflow.com/a/24460995
has comment: http://stackoverflow.com/comment/37855336
has comment: http://stackoverflow.com/comment/37855628
type: Question
has comment: http://stackoverflow.com/comment/37855364
tagged with: postgresql
has comment: http://stackoverflow.com/comment/37855804
duplicate of: http://stackoverflow.com/q/7904756
has comment: http://stackoverflow.com/comment/37857908
has body: org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure HHH000342: Could not obtain connection to query metadata : Cannot load JDBC driver class 'com.postgresql.jdbc.Driver' I'm getting this warning while starting my application, can you help me how to solve it? It's WARN, no error or exception. (it is in my maven,spring,hibernate application), i have exceptions when i want to access my database via hibernate, but i'm not sure if this is causing the problem, thanks.
answer count: 1

http://stackoverflow.com/q/24439612
has comment: http://stackoverflow.com/comment/49055770
has comment: http://stackoverflow.com/comment/37816895
linked to: http://stackoverflow.com/q/23653778
has body: Hi guys, I started to learn developing app for android today. My guide is New Boston: https://buckysroom.org/videos.php?cat=6&amp;video=16731 I passed every tutorial until the 10th because: I did every step, but the app crashes. Here is the XML code: &lt;Button android:id="@+id/bAdd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvDisplay" android:layout_centerHorizontal="true" android:layout_marginTop="50dp" android:text="Add here" /&gt; &lt;TextView android:id="@+id/tvDisplay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="18dp" android:text="The total is: " /&gt; &lt;/RelativeLayout&gt; And here is the JAVA code: package com.example.firstpro; public class MainActivity extends ActionBarActivity { int c = 0; Button add, sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); add = (Button) findViewById(R.id.bAdd); display = (TextView) findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub c+=1; display.setText("You're total is: " + c); setContentView(R.layout.activity_main); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id…
type: AnsweredQuestion
has title: Android Developing App crashes
has answer: http://stackoverflow.com/a/24439992
accepted answer: http://stackoverflow.com/a/24439992
tagged with: java
has comment: http://stackoverflow.com/comment/37816199
tagged with: eclipse
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37816082
has comment: http://stackoverflow.com/comment/37816030
score: 0
tagged with: android

http://stackoverflow.com/q/24467457
favorite count: 0
has title: scanline: finding intersection points
has body: I want to fill a polygon with the scanline algorith. for this I have to know all points where the scanline comes in contact with the polygon. I wrote a loop for this, but its obviously not working (it never adds a point to the list which means it can't find any points which cuts the polygon) I can create a Polygon and have all Edges from it. Here is my code for getting the points of the scanline which intersect the polygon xmin, xmax, ymin and ymax are the max points from the polygon. They are also correct. contains() checks, if a Point is inside the polygon, with using the java.awt.Polygon class. This is working too. wasInside contains a boolean, which saves the old state, if the last point checked was inside the polygon or not. boolean wasInside = false; ArrayList&lt;Point&gt; intersectionPoints = new ArrayList&lt;Point&gt;(); for (int yTemp = ymin; yTemp &lt;= ymax; yTemp++) { for (int xTemp = xmin; xTemp &lt;= xmax; xTemp++) { if (wasInside != this.contains(new Point(xTemp, yTemp))) { intersectionPoints.add(new Point(xTemp, yTemp)); wasInside = !wasInside; } } }
score: 1
accepted answer: http://stackoverflow.com/a/24468144
upvote count: 1
linked to: http://stackoverflow.com/q/5184815
type: AnsweredQuestion
tagged with: scanline
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24468144

http://stackoverflow.com/comment/38017856
type: QuestionComment
type: Comment
has text: Is there any reason why you use [String#matches](http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#matches-java.lang.String-)? Do you have regular expressions in the 2nd list?
comment on: http://stackoverflow.com/q/24548299
score: 0

http://stackoverflow.com/a/24450333
score: 0
has body: You either implement parcelable or put your serialized objecs into ArrayList. ArrayList implements Serializable and would accept as long as your arraylist have serializable objects. putExtra(String name, Serializable value) or public Intent putExtra (String name, Parcelable[] value)
answers question: http://stackoverflow.com/q/24450115
type: Answer

http://stackoverflow.com/q/24549425
has body: I have a scenario where number of columns is 2600. As mentioned in SQLite limits the maximum column supported is 2000. Now I need to update the column numbers during run time, the definition, The maximum number of columns can be lowered at run-time using the sqlite3_limit(db,SQLITE_LIMIT_COLUMN,size) interface. is not clear to me. The code I'm using is, Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:database.db"); conn.setAutoCommit(false); stmt = conn.createStatement(); Where should I use the update column number code snippet and how? I couldnt get any direct examples. Please help. EDIT: The default setting for SQLITE_MAX_COLUMN is 2000. You can change it at compile time to values as large as 32767. How can i do this in sqlite jdbc??
has comment: http://stackoverflow.com/comment/38020559
has comment: http://stackoverflow.com/comment/38021416
has comment: http://stackoverflow.com/comment/38020681
score: 0
has comment: http://stackoverflow.com/comment/38021209
tagged with: java
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/38023486
type: Question
has title: SQlite updating column numbers in java
tagged with: sqlite
has comment: http://stackoverflow.com/comment/38021028
tagged with: jdbc

http://stackoverflow.com/a/24458178
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37850554
upvote count: 1
answers question: http://stackoverflow.com/q/24457626
score: 1
has body: Curious to know behind the scene I came across this article which can prove us completely wrong. The article says The + operator appears innocent, but the bytecode generated produces some surprises. Using a StringBuffer for concatenation can in fact produce code that is significantly faster than using a String. The bytecode generated by String concatenation inturn creates a StringBuffer object, then invokes its append method.After the concatenation is performed on the StringBuffer object, it must be converted back into a String. This is done with the call to the toString method. This method creates a new String object from the temporary StringBuffer object. In summary, String conactenation inturn created three objects: A String object, A StringBuffer object, A String object. However, there is no need to create a temporary StringBuffer in the second case. Pease refer the article link for complete information

http://stackoverflow.com/comment/38020312
comment on: http://stackoverflow.com/a/24549831
score: 0
type: AnswerComment
type: Comment
has text: I've changed and it same thing: No mapping found for HTTP request with URI [/WEB-INF/pages/getMessageStats.jsp] in DispatcherServlet with name 'mvc-dispatcher' . Real path is webapp/WEB-INF/pages/*.jsp. And if I set <property name="prefix" value="/webapp/WEB-INF/pages/"/> it's give same WARN

http://stackoverflow.com/a/28304164
has comment: http://stackoverflow.com/comment/80968314
has comment: http://stackoverflow.com/comment/53376730
has comment: http://stackoverflow.com/comment/70840138
has comment: http://stackoverflow.com/comment/124550275
has body: This was so hard for me to have on item click listener in the activity and also to have click listener for single view of the item that will not trigger on item click listener. After playing around with Jacob Tabak's answer I respect his answer for on item click if no other touch actions inside item are presented. I have a custom OnClickListener interface that have on item click event which holds the clicked item's view and the item position from the adapter. I present an instance of it in the constructor(or it can be with setter) and attach it to the view holder container click listener. I also have other click listener in the Adapter(Can be in the view holder) which will handle current View click from the container. public class MyRecyclerAdapter extends RecyclerView.Adapter&lt;MyViewHolder&gt; { private ArrayList&lt;String&gt; mData; private OnItemClickListener mOnItemClickListener; public interface OnItemClickListener { public void onItemClick(View view, int position); } public MyRecyclerAdapter(ArrayList&lt;String&gt; itemsData, OnItemClickListener onItemClickListener) { mOnItemClickListener = onItemClickListener; this.mData = itemsData; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View layoutView = LayoutInflater.from(mContext).inflate( R.layout.list_item, parent, false); final MyViewHolder viewHolder = new MyViewHolder(layoutView); viewHolder.container.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.onItemClick(v, viewHolder.getAdapterPosition()); } }); viewHоlder.button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //do button click work here with // mData.get( viewHolder.getAdapterPosition() ); } }); return viewHolder; } @Override public int getItemCount() { return mData.size(); }} In the activity you need to initialize the adapter by passing instance of the OnItemClickListener public class FeedActivity extends ActionBarActivi…
has comment: http://stackoverflow.com/comment/103692426
has comment: http://stackoverflow.com/comment/79261127
has comment: http://stackoverflow.com/comment/82588176
has comment: http://stackoverflow.com/comment/51402046
has comment: http://stackoverflow.com/comment/53585279
score: 55
has comment: http://stackoverflow.com/comment/81005240
has comment: http://stackoverflow.com/comment/52112297
type: Answer
upvote count: 56
has comment: http://stackoverflow.com/comment/47604976
has comment: http://stackoverflow.com/comment/87987646
downvote count: 1
has comment: http://stackoverflow.com/comment/70769149
answers question: http://stackoverflow.com/q/24471109

http://stackoverflow.com/q/24515774
accepted answer: http://stackoverflow.com/a/24515819
has body: I'm beginner to java and I'm doing a java project(maze solver) with a GUI. I need to build a grid of squares. I searched over the internet and unable to find any solutions, Someone told me that using java acm packages this can done easily. Please someone help me to do this.
score: 0
tagged with: grid-layout
answer count: 1
has title: java how to create a grid of squares
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24515819
tagged with: acm-java-libraries
tagged with: java
type: Question

http://stackoverflow.com/comment/37962213
type: AnswerComment
has text: You can repackage and redeploy the project but you cannot change the scope of the dependencies because they are "legacy" projects ? Now i'm curious...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24518047

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/24554635
type: Tag

http://stackoverflow.com/comment/37806275
comment on: http://stackoverflow.com/q/24432163
score: 0
type: Comment
type: QuestionComment
has text: Thanks dethorpe for your respond, well I was thinking to reduce the processing time to log n, otherwise it takes long time to process the whole file.

http://stackoverflow.com/q/24493857
answer count: 1
tagged with: apex-code
has answer: http://stackoverflow.com/a/24494155
has body: I'm looking to check the field level security of all of the fields on the Opportunity object. So I'm getting the full map of fields and storing them in a static variable so I can access them from where ever I need. private static Map&lt;String, Schema.SObjectField&gt; myMap; private static void initMaps() { myMap = Schema.SObjectType.Opportunity.fields.getMap(); } I want to iterate over all of the fields on the object and check .isAccessible() on each. I'm a little stuck as to how to iterate over the fields however, and also how to check .isAccessible() on eash. //THIS BIT DOESN'T WORK... private doCheckMap(myMap){ for (Id key : myMap.keySet()) { if(false == Schema.SObjectType.???.fields.isAccessible()) { System.debug('nope!'); } } } Any suggestions or advice would be greatly appreciated. Cheers.
accepted answer: http://stackoverflow.com/a/24494155
tagged with: dictionary
type: AnsweredQuestion
tagged with: java
tagged with: loops
has title: Iterate over map and run method on each result - APEX
type: Question
has comment: http://stackoverflow.com/comment/37917349
has comment: http://stackoverflow.com/comment/37917195
has comment: http://stackoverflow.com/comment/37917819
score: 0

http://stackoverflow.com/a/24570462
upvote count: 14
score: 14
has comment: http://stackoverflow.com/comment/38059188
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24570360
has body: In the second method, you are trying to swap references, which will not work because the references themselves are pass-by-value. The first method works correctly because it changes the object referenced by the array (which is mutable), it does not change the reference itself. Check out this blog post for more details on the differences between pass-by-value and pass-by-reference.
type: Answer
accepted answer of: http://stackoverflow.com/q/24570360

http://stackoverflow.com/comment/38053247
has text: Yup I have seen your answer.
comment on: http://stackoverflow.com/q/24546966
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37896860
type: Comment
comment on: http://stackoverflow.com/q/24481796
has text: @FizzBuzz I was thinking about that, but unfortunately, if I define something like `public <StreamType extends OutputStream & MyByteStream> void write(String string, StreamType stream)`, I get the error "Method write(String, StreamType) has the same erasure write(String, OutputStream) as another method in type StringWriter". So, unfortunately that's a no-go... Unless there is another way to implement this third method? I wish there was a `<StreamType extends OutputStream | MyByteStream>` (with OR rather than AND)...
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37964793
has text: Probably you're viewing the execution of one of the recursive calls of `getItems` method.
score: 1
comment on: http://stackoverflow.com/q/24520017
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37901456
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24485347
type: Comment
has text: Thanks it helped a lot. That was the mayor problem. + that i did not add mysql to my maven dependency when i first tried that url you mentioned

http://stackoverflow.com/q/24429763
favorite count: 0
has comment: http://stackoverflow.com/comment/37797391
has comment: http://stackoverflow.com/comment/37798308
accepted answer: http://stackoverflow.com/a/24433288
tagged with: utf-8
has title: why java code not converting text to utf8 characters?
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: struts-1
type: Question
has comment: http://stackoverflow.com/comment/37797312
score: 3
tagged with: javascript
linked to: http://stackoverflow.com/q/138948
has answer: http://stackoverflow.com/a/24433288
linked to: http://stackoverflow.com/q/7539590
has body: My jsp page has encoding as follows : &lt;%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %&gt; &lt;% response.setHeader("Cache-control", "no-cache"); response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); %&gt; javascript code printing greek characters well in firebug following is the code : function save() { console.log(document.editDistributionListForm.elements['name'].value); //this line prints greek characters document.editDistributionListForm.elements['subAction'].value='submit'; document.editDistributionListForm.submit(); } when 'name' value as above is sent to the struts action, the string is not printing greek characters instead it prints ???????????????? Greek Characters entered were : αβγδεζηθ Struts Bean (Sample code) : public void setName(String name) { this.name = name; } public String getName() { return name; } Struts Action (Sample code) : protected ActionForward updateList(ActionMapping mapping, HttpServletRequest request, EditListForm form) throws CannotOverwriteExistingListException, EmptyListException, ListUpdateException { log.debug("form.getName :: "+form.getName()); //this line when printed prints (???) } when data is sent from html to java i.e. from browser to server the string gets converted from greek to ???? what i am doing wrong. I am not able to identify what i am missing .. . Please help.
answer count: 1
downvote count: 0
tagged with: jsp

http://stackoverflow.com/a/79300125
type: Answer
has comment: http://stackoverflow.com/comment/139844688
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24558080
has body: java.time In March 2014, Java 8 introduced the modern, java.time date-time API which supplanted the error-prone legacy java.util date-time API. Any new code should use the java.time API. Solution using modern date-time API You can get the desired result through below steps: Convert epoch milliseconds to an Instant using Instant#ofEpochMilli. Convert the Instant to a ZonedDateTime at the desired time zone e.g. ZoneId.of("America/Jamaica"). Format the ZonedDateTime using a DateTimeFormatter set with the appropriate pattern. Demo: class Main { public static void main(String[] args) { // Convert epoch milliseconds to Instant Instant instant = Instant.ofEpochMilli(1404327407738L); System.out.println(instant); // Convert Instant to ZonedDateTime at the desired time zone e.g. // ZoneId.of("America/Jamaica") ZoneId zone = ZoneId.of("America/Jamaica"); ZonedDateTime zdt = instant.atZone(zone); System.out.println(zdt); // String representation in a custom format String formatted = zdt.format(DateTimeFormatter.ofPattern( "MM-dd-uuuu 'at' hh:mm:ss a", Locale.ENGLISH)); System.out.println(formatted); } } Output: 2014-07-02T18:56:47.738Z 2014-07-02T13:56:47.738-05:00[America/Jamaica] 07-02-2014 at 01:56:47 PM Online Demo Note: Your pattern has the following problems: You have mistakenly used m for a month. The symbol m is used for a minute-of-hour. The symbol for a month-of-year is M. You have missed the symbol a in your pattern. It is used for am-pm-of-day. Learn more about symbols from the documentation. Make sure you use a Locale with the DateTimeFormatter because you have am/pm marker in the desired output string. Check this answer to learn more about it. Learn more about the modern Date-Time API from Trail: Date Time.
upvote count: 1

autoscaling
tags question: http://stackoverflow.com/q/24511424
tag name: autoscaling
type: Tag

http://stackoverflow.com/comment/37899370
has text: How are you running the Maven build for this project? In eclipse or on the command line?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24482259

http://stackoverflow.com/comment/37871749
type: AnswerComment
has text: Yes, the one at the bottom of that link does.
comment on: http://stackoverflow.com/a/24469412
score: 0
type: Comment

http://stackoverflow.com/a/24556098
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24556037
downvote count: 0
has body: It's a consolidation of this: int temp = sum - in; if (temp == largest){ ...
type: Answer

http://stackoverflow.com/comment/38091189
has text: Check out [CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) for a cleaner approach
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24587919

http://stackoverflow.com/comment/37874080
has text: Looks like you have a class path problem. The answer to this question may help you http://stackoverflow.com/questions/1914493/add-jar-file-to-buildpath-in-windows-command-line
score: 0
comment on: http://stackoverflow.com/q/24470945
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24494074
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24494303
tagged with: eclipse
has answer: http://stackoverflow.com/a/24494402
score: 0
has title: Type safety warning when using synchronizedList
favorite count: 0
linked to: http://stackoverflow.com/q/2770321
has answer: http://stackoverflow.com/a/24494119
accepted answer: http://stackoverflow.com/a/24494119
answer count: 4
possible better answer: http://stackoverflow.com/a/24494402
type: AnsweredQuestion
tagged with: java
has body: I define a class member as below : private static List abc = Collections.synchronizedList(new ArrayList()); But Eclipse gives me the warning : Type safety: Unchecked invocation synchronizedList(ArrayList) of the generic method synchronizedList(List&lt;T&gt;) of type Collections Is there another way to write this declaration statement to avoid the warning?
has answer: http://stackoverflow.com/a/24494121
upvote count: 1

http://stackoverflow.com/comment/38004509
type: Comment
has text: This is (should be?) a compile time error. You can't put booleans in a switch.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24541102

http://stackoverflow.com/q/24514510
tagged with: jsni
accepted answer: http://stackoverflow.com/a/24532856
tagged with: gwt
type: AnsweredQuestion
has body: I'm calling in JS some javaMethod(java.util.Date date). I can't change code on java-side. How can I create java.util.Date object from JS-side (at least empty date)?
has comment: http://stackoverflow.com/comment/37984304
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24514538
type: Question
has title: How to return from JavaScript object with type java.util.Date?
has answer: http://stackoverflow.com/a/24514538
tagged with: javascript
tagged with: date
has answer: http://stackoverflow.com/a/24532856
answer count: 2
has comment: http://stackoverflow.com/comment/37954865
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37902512
type: Comment
has text: Is this 'pool creation' specific for strings? Because if I have a ` `class 'Car' and: car1 = Car('Toyota'); car2 = Car('Toyota'); then car1 == car2 // returns false`
type: AnswerComment
comment on: http://stackoverflow.com/a/24485633
score: 0

http://stackoverflow.com/q/24538957
has body: I am trying to add listview to my layout from a class which extends fragments. The problem is, when the data is coming, the layout is showing null pointer exception. Here is the code: TopStoriesFragment.java public class TopStoriesFragment extends Fragment { public String thehindu = "http://www.thehindu.com/news/?service=rss"; public String toi = "http://timesofindia.feedsportal.com/c/33039/f/533965/index.rss"; public String reuters = "http://feeds.reuters.com/reuters/topNews"; public String deccanherald = "http://www.deccanherald.com/rss-internal/top-stories.rss"; public String currenturl = thehindu; AlertDialog levelDialog; public String fakingnews = "http://thepuntended.wordpress.com/"; public LayoutInflater inflater; ListView listView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false); feedTitle = (TextView) rootView.findViewById(R.id.feedtitle); feedDescribtion = (TextView) rootView.findViewById(R.id.feeddescribtion); listView = (ListView) rootView.findViewById(android.R.id.list); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { Intent intent = new Intent(getActivity(), ShowDetails.class); Bundle bundle = new Bundle(); bundle.putString("keyTitle", myRssFeed.getItem(position).getTitle()); bundle.putString("keyDescription", myRssFeed.getItem(position) .getDescription()); bundle.putString("keyLink", myRssFeed.getItem(position).getLink()); bundle.putString("keyPubdate", myRssFeed.getItem(position).getPubdate()); intent.putExtras(bundle); startActivity(intent); } }); startReadRss(); return rootView; } public class RssLoadingTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub displayRss(); } @Override protected void onPreExecute…
accepted answer: http://stackoverflow.com/a/24539188
score: 0
tagged with: nullpointerexception
tagged with: android-listview
answer count: 1
has comment: http://stackoverflow.com/comment/38000259
tagged with: android
has comment: http://stackoverflow.com/comment/38000309
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24539188
has comment: http://stackoverflow.com/comment/38000256
tagged with: java
has title: Null Pointer exception on layout inflator
type: Question
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/38000257

http://stackoverflow.com/comment/38094343
score: 0
has text: You mean Random.nextGaussian()? How'd you do the truncating - a loop that generates numbers until some falls within range?
type: AnswerComment
comment on: http://stackoverflow.com/a/24581302
type: Comment

http://stackoverflow.com/q/24519668
has comment: http://stackoverflow.com/comment/37978095
has comment: http://stackoverflow.com/comment/129776079
score: 4
tagged with: modality
answer count: 2
has answer: http://stackoverflow.com/a/77146282
has comment: http://stackoverflow.com/comment/37980122
tagged with: window
has answer: http://stackoverflow.com/a/77195090
downvote count: 0
favorite count: 0
has body: If I create a javafx dialog using the following method: public static void showDialog(Event event) throws IOException { dialogStage = new Stage(); GridPane grid = (GridPane) Start.createLoader().load(Start.class.getResource("file.fxml").openStream()); dialogStage.setScene(new Scene(grid)); dialogStage.setTitle("Title"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(((Node) event.getSource()).getScene().getWindow()); dialogStage.showAndWait(); } the ower window moves in case it is maximized. This also happens if I use: Modality.APPLICATION_MODAL It works if I combine: dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage.getOwner()); but in this case the owner window is not blocked. I want my dialog showing up on a maximized window without moving it. The maximized window should be blocked while the dialog is open. How can I do this? Btw. I am using java 8 and javafx on linux. Tanks!
has comment: http://stackoverflow.com/comment/37973943
has comment: http://stackoverflow.com/comment/129958069
tagged with: linux
has comment: http://stackoverflow.com/comment/37978896
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37978555
has comment: http://stackoverflow.com/comment/129772321
has title: javafx maximized window moves if dialog shows up
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/37972835
type: Question
upvote count: 4

http://stackoverflow.com/q/24571363
tagged with: string
has comment: http://stackoverflow.com/comment/38061532
has comment: http://stackoverflow.com/comment/38061064
type: UnansweredQuestion
tagged with: interpreter
answer count: 0
tagged with: java
type: Question
has body: I have a table of information (.csv-file) that I take each row of and convert into instances of a Java class. One of the columns in the table (currently not filled in) should contain scripts of some kind to modify another type of object. I need the script to be able to call a selection of methods with parameters (some have return types), optionally only if a condition is true. Calling a method several times with different receivers is also essential (like with a for-loop). The more I think about it, the more it looks like a separate programming language. At first I was going to create a simple interpreter, but then I thought of more and more features that I would need and it quickly became a too large project for me. I hope I explained my problem well enough. Can anyone point me in the direction of something that I can use to accomplish my goal? The only thing I can think of would be a library of some kind, but other solutions are more than welcome.
has title: Modify Java objects based on script
score: 0

http://stackoverflow.com/comment/37809955
score: 0
comment on: http://stackoverflow.com/q/24436611
has text: Scanner keyboardScanner = new Scanner(System.in); double[] array = new double[12]; // creates for loop for (int i=0; i<12; i++) { System.out.println("Enter Rental for month[" + i + "]")); array[i] = keyboardScanner.nextDouble(); } for (int i=0; i<array.length; i++) { System.out.println(array[i]); } PS: I dont know how to do proper formatting of code in comment. Try this
type: Comment
type: QuestionComment

struts-1
tags question: http://stackoverflow.com/q/24568703
type: Tag
tag name: struts-1
tags question: http://stackoverflow.com/q/24429763
tags question: http://stackoverflow.com/q/24501341

http://stackoverflow.com/comment/38062823
has text: after InputStream stream = f.retrieveFileStream(/*url_ftp + "/photo/"+ft*/ft); Reply code is 550
comment on: http://stackoverflow.com/q/24571571
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37987804
score: 0
has text: Ok, i had to do something wrong - now it's working
comment on: http://stackoverflow.com/q/24532295
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37855356
has text: [Nope.](http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html#UNNECESSARY)
type: Comment
comment on: http://stackoverflow.com/a/24461025
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38066081
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24573861
type: QuestionComment
has text: @AndrewThompson updated my question .tell me now what to do ?

http://stackoverflow.com/comment/38055083
comment on: http://stackoverflow.com/q/24568147
type: Comment
type: QuestionComment
has text: BTW `String _name` is a reference to an object just like `person next` is.
score: 0

http://stackoverflow.com/q/24548246
score: 0
answer count: 5
has body: This is more of a theoretical question. Suppose I have 3 classes A, B and C. What I want to do is this: public class A { B b = new B(c); C c = new C(b); } public class B { public B(C c) { } } public class C { public C(B b) { } } I know this code wont work. So, is there another way to do it?
has answer: http://stackoverflow.com/a/24548423
tagged with: reference
tagged with: constructor
has answer: http://stackoverflow.com/a/24548542
has title: Java: how to create instances of two different classes in a third class and pass references to each other through the constructors
has answer: http://stackoverflow.com/a/24548433
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24548542
tagged with: java
has answer: http://stackoverflow.com/a/24548473
has answer: http://stackoverflow.com/a/24548431
has comment: http://stackoverflow.com/comment/38017748
tagged with: instances
type: Question
accepted answer: http://stackoverflow.com/a/24548473
has comment: http://stackoverflow.com/comment/38017403

http://stackoverflow.com/a/45339100
score: 0
answers question: http://stackoverflow.com/q/24560917
type: Answer
has body: Here is a complete example. straight forward once you get the dependencies right. https://github.com/robmayhew/embedded-tomcat-websocket-example

mahout
tags question: http://stackoverflow.com/q/24512144
tag name: mahout
tags question: http://stackoverflow.com/q/24530884
type: Tag

http://stackoverflow.com/q/24509546
has title: Could anyone explain SimpleExpandableListAdapter 's parameters and how they are implementing and working
has body: I am new to android. Could anyone PLEASE explain the parameters inside SimpleExpandableListAdapter. i can tell "this" means this context, "groupData" &amp; "childData" are obviously variable declared. please explain the rest why they are used like this and how they are working? mAdapter = new SimpleExpandableListAdapter( this, groupData, android.R.layout.simple_expandable_list_item_1, new String[] { "parent" }, new int[] { android.R.id.text1, android.R.id.text2 }, childData, android.R.layout.simple_expandable_list_item_2, new String[] {"child"}, new int[] { android.R.id.text1 } ); setListAdapter(mAdapter);
tagged with: java
has answer: http://stackoverflow.com/a/24509704
answer count: 1
tagged with: android
type: UnansweredQuestion
score: 0
type: Question

http://stackoverflow.com/a/24527744
type: Answer
has body: You can look at application-dev.yml or application-prod.yml and set database configuration there. You have to create database first before invoking mvn spring-boot:run
answers question: http://stackoverflow.com/q/24524419
score: 0

http://stackoverflow.com/a/24511938
answers question: http://stackoverflow.com/q/24511270
type: Answer
has body: To answer my own question, one just have to use the ShapePickSupport.Style.HIGHEST, as in the code below (generics parameters were changed for clarity): VisualizationViewer&lt;V, E&gt; vv = new VisualizationViewer&lt;V, E&gt;(visualizationModel, preferredSize); ... ShapePickSupport pickSupport = (ShapePickSupport) vv.getPickSupport(); pickSupport.setStyle(ShapePickSupport.Style.HIGHEST); Also, here's useful resource that is related to the matter: Understanding the JUNG Visualization System.
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24511270

http://stackoverflow.com/q/24500048
upvote count: 5
tagged with: java
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/24500121
has body: I have a button click event on which i am getting a column value, if a Table row is selected. But if i don't select the row and click the button i get the error: java.lang.ArrayIndexOutOfBoundsException:-1 my question is how can i check to see if a row has been selected pseudocode: if(Row == selected) { execute } java code i have: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { try { int row = Table.getSelectedRow(); String Table_click = (Table.getModel().getValueAt(row, 0).toString()); //... implementation hire } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } Thank you for your help.
tagged with: jtable
answer count: 3
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24500121
has title: How can i check to see if a row has been selected?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24500116
has answer: http://stackoverflow.com/a/24500120
tagged with: selected
type: Question
possible better answer: http://stackoverflow.com/a/24500120
score: 5
tagged with: if-statement

http://stackoverflow.com/a/24471410
has comment: http://stackoverflow.com/comment/82588354
has comment: http://stackoverflow.com/comment/48729003
has comment: http://stackoverflow.com/comment/87453609
has comment: http://stackoverflow.com/comment/100782961
score: 525
has comment: http://stackoverflow.com/comment/42009628
has comment: http://stackoverflow.com/comment/100781951
has comment: http://stackoverflow.com/comment/87250209
accepted answer of: http://stackoverflow.com/q/24471109
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54586514
has comment: http://stackoverflow.com/comment/93334840
has comment: http://stackoverflow.com/comment/57533414
has comment: http://stackoverflow.com/comment/83162995
has comment: http://stackoverflow.com/comment/51055794
has comment: http://stackoverflow.com/comment/76652532
type: Answer
has comment: http://stackoverflow.com/comment/68431786
has comment: http://stackoverflow.com/comment/66901532
has comment: http://stackoverflow.com/comment/117560176
has comment: http://stackoverflow.com/comment/87722108
upvote count: 542
has comment: http://stackoverflow.com/comment/82588542
has comment: http://stackoverflow.com/comment/46622165
has comment: http://stackoverflow.com/comment/87183755
has comment: http://stackoverflow.com/comment/53491748
has comment: http://stackoverflow.com/comment/99574765
has comment: http://stackoverflow.com/comment/52689553
has body: As the API's have radically changed, It wouldn't surprise me if you were to create an OnClickListener for each item. It isn't that much of a hassle though. In your implementation of RecyclerView.Adapter&lt;MyViewHolder&gt;, you should have: private final OnClickListener mOnClickListener = new MyOnClickListener(); @Override public MyViewHolder onCreateViewHolder(final ViewGroup parent, final int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.myview, parent, false); view.setOnClickListener(mOnClickListener); return new MyViewHolder(view); } The onClick method: @Override public void onClick(final View view) { int itemPosition = mRecyclerView.getChildLayoutPosition(view); String item = mList.get(itemPosition); Toast.makeText(mContext, item, Toast.LENGTH_LONG).show(); }
has comment: http://stackoverflow.com/comment/75772964
has comment: http://stackoverflow.com/comment/47444369
has comment: http://stackoverflow.com/comment/66383821
has comment: http://stackoverflow.com/comment/47443823
answers question: http://stackoverflow.com/q/24471109
downvote count: 17
has comment: http://stackoverflow.com/comment/51009591

http://stackoverflow.com/q/24566566
has answer: http://stackoverflow.com/a/24578175
linked to: http://stackoverflow.com/q/24061672
tagged with: scala
has answer: http://stackoverflow.com/a/24582323
linked to: http://stackoverflow.com/q/9880805
has body: I have read an answer to a question about converting Scala code to Java code. It says: I don't think it's possible to convert from scala back to standard java since Scala does some pretty low-level byte-code manipulation. I'm 90% sure they do some things that can't exactly be translated back into normal Java code. So what Scala statements or code can produce bytecode which can not be translated to java? P.S. I generally agree with that answer, but want a concrete example for learning purposes.
type: Question
linked to: http://stackoverflow.com/q/6827363
upvote count: 9
tagged with: bytecode
tagged with: java
answer count: 6
has comment: http://stackoverflow.com/comment/38072046
has answer: http://stackoverflow.com/a/24568643
has comment: http://stackoverflow.com/comment/38069040
score: 9
has title: What scala statements or code can produce a byte-code which can not be translated to java?
downvote count: 0
has answer: http://stackoverflow.com/a/24566691
linked to: http://stackoverflow.com/q/11677750
has answer: http://stackoverflow.com/a/24575518
favorite count: 0
has comment: http://stackoverflow.com/comment/38060587
has comment: http://stackoverflow.com/comment/38052240
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24566814

http://stackoverflow.com/comment/137181318
type: Comment
comment on: http://stackoverflow.com/a/24510283
score: 1
has text: You can also add `-XX:HeapDumpPath=<path>`
type: AnswerComment

http://stackoverflow.com/comment/38466934
type: Comment
comment on: http://stackoverflow.com/a/24784244
has text: So did you try the steps above? There is a world of difference between reading how something should work or fail and observing it working or failing.
score: 0
type: AnswerComment

google-plugin-eclipse
tags question: http://stackoverflow.com/q/24431005
type: Tag
tags question: http://stackoverflow.com/q/24498609
tag name: google-plugin-eclipse

http://stackoverflow.com/q/24575489
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24628275
tagged with: javafx-2
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
has title: Draw circle in border of rectangle in JavaFX
type: Question
tagged with: javafx-8
has body: I want add some circles in border of a rectangle in event onMouseMoved. Need to develop a graph using JavaFX and these circles will serve to connect the edges to the graph nodes. See the image below: I'm using JavaFX. See you the code: public class SampleDragAndDrop extends Application { public static void main(String[] args) throws Exception { launch(args); } @Override public void start(final Stage stage) throws Exception { DoubleProperty entity1X = new SimpleDoubleProperty(100); DoubleProperty entity1Y = new SimpleDoubleProperty(100); Entity entity1 = new Entity(Color.STEELBLUE, entity1X, entity1Y); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.setWidth(bounds.getWidth()); stage.setHeight(bounds.getHeight()); stage.setTitle("Draw circle in rectangle"); stage.setScene(new Scene(new Group(entity1), 400, 400, Color.ALICEBLUE)); stage.show(); } class Anchor extends Circle { Anchor(Color color, DoubleProperty x, DoubleProperty y) { super(x.get(), y.get(), 20); setFill(color.deriveColor(1, 1, 1, 0.5)); setStroke(color); setStrokeWidth(2); setStrokeType(StrokeType.OUTSIDE); x.bind(centerXProperty()); y.bind(centerYProperty()); } class Entity extends Rectangle { Entity(Color color, DoubleProperty x, DoubleProperty y) { setX(x.get()); setY(y.get()); setWidth(120); setHeight(50); setFill(color.deriveColor(1, 1, 1, 0.5)); setStroke(color); setStrokeWidth(2); setStrokeType(StrokeType.OUTSIDE); setArcWidth(20); setArcHeight(20); x.bind(xProperty()); y.bind(yProperty()); enableDrag(); } private void enableDrag() { final Entity.Delta dragDelta = new Entity.Delta(); setOnMousePressed(new EventHandler&lt;MouseEvent&gt;() { @Override public void handle(MouseEvent mouseEvent) { // record a delta distance for the drag and drop operation. dragDelta.x = getX() - mouseEvent.getX(); dragDelta.y = getY() - mouseEvent.getY(); getScene().setCursor(Cursor.MOVE); } }); setOnMouseReleased(ne…
answer count: 1

http://stackoverflow.com/q/24460480
has comment: http://stackoverflow.com/comment/37854282
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37854363
has comment: http://stackoverflow.com/comment/37855449
has answer: http://stackoverflow.com/a/24460752
accepted answer: http://stackoverflow.com/a/24460752
tagged with: arraylist
has title: Permutation of an ArrayList of numbers using recursion
answer count: 2
has answer: http://stackoverflow.com/a/24462114
linked to: http://stackoverflow.com/q/25704754
downvote count: 0
favorite count: 0
has body: I am trying to learn recursion by creating a permutation of an ArrayList: {1,2,3} but the concept of recursive calls just keeps going over my head. I know how to do an iterative solution. but is there a systematic way to convert my iterative solution to recursive? private static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; permutate(ArrayList&lt;Integer&gt; list) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; result = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); result.add(new ArrayList&lt;Integer&gt;()); for (int i = 0; i &lt; list.size(); i++) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; current = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for (ArrayList&lt;Integer&gt; l : result) { for (int j = 0; j &lt; l.size()+1; j++) { l.add(j, list.get(i)); ArrayList&lt;Integer&gt; temp = new ArrayList&lt;Integer&gt;(l); current.add(temp); l.remove(j); } } result = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(current); } return result; }
has comment: http://stackoverflow.com/comment/78926469
has comment: http://stackoverflow.com/comment/37855220
tagged with: recursion
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4240080
score: 1
possible better answer: http://stackoverflow.com/a/24462114
tagged with: java

http://stackoverflow.com/a/24482701
has comment: http://stackoverflow.com/comment/37896594
score: 0
answers question: http://stackoverflow.com/q/24482503
type: Answer
has body: Two things jump out at me.... First Math.round can round DOWN, so a value of 5.22 would be rounded down to 6, instead of up to 7 Now you can use (int)totalcost + 1 which basically trims off the decimal elements or Math.ceil(totalcost) depending on your needs. The second is you don't seem to understand how formatter are using decimalFormat.format(totalcost); Won't do anything, numbers are free from formatting information. Instead, you use a formatter to return a representation of the value in the specified format... With all that tucked under our belts, something like... String tipFormat = decimalFormat.format((tip_cal) DecimalFormat decimalFormat = new DecimalFormat("$0.00"); decimalFormat.setMinimumFractionDigits(2); try { double amount = Double.parseDouble("5.21"); double tip_per = Double.parseDouble("20"); double tip_cal = (amount * tip_per) / 100; double totalcost = amount + tip_cal; double rounded = (int)totalcost + 1; double roundtotal = rounded - totalcost; System.out.println("Tip Amount : " + decimalFormat.format((tip_cal))); System.out.println("Total Cost: " + decimalFormat.format(totalcost)); System.out.println("Tip: " + decimalFormat.format(roundtotal) + " to round bill"); System.out.println("Bill Tally: " + decimalFormat.format(totalcost + roundtotal)); } catch (NumberFormatException e) { e.printStackTrace(); } Will output... Tip Amount : $1.04 Total Cost: $6.25 Tip: $0.75 to round bill Bill Tally: $7.00 Having said all that, double and float are not well suited for monetary calculations. You can use long or BigDecimal as alternatives, for example... NumberFormat nf = NumberFormat.getCurrencyInstance(); try { BigDecimal amount = new BigDecimal(Double.parseDouble("5.21")); BigDecimal tip_per = new BigDecimal(Double.parseDouble("20")); BigDecimal tip_cal = amount.multiply(tip_per).divide(new BigDecimal(100)); BigDecimal totalcost = amount.add(tip_cal); BigDecimal rounded = totalcost.setScale(0, RoundingMode.CEILING); BigDecimal roundtotal = rounded.subtrac…

http://stackoverflow.com/comment/38008772
has text: You are using layout(xml) for both activity and fragment same `fragment_create_exercise_activiy.xml` then populate spinner in activity or add click function inside fragment.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24543328
score: 0

http://stackoverflow.com/comment/38128576
has text: Yep did all shorts of things, but still not able to understand whats the issue !!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24569767
type: Comment

http://stackoverflow.com/q/24549832
type: Question
answer count: 2
downvote count: 0
tagged with: jsp
has title: How to get the root path of my project?
has answer: http://stackoverflow.com/a/24550023
favorite count: 0
has comment: http://stackoverflow.com/comment/38020861
has answer: http://stackoverflow.com/a/59848758
upvote count: 2
has body: I have JSP projects that run in Tomcat developed in Eclipse. I want to have some files which I store inside the project. Here is the project structure that I have: .settings build data ImportedClasses src WebContent .classpath .project I want to access the data folder from my code in JSP file which located in WebContent. Tried some code below: File userDataDirFile = new File ( "data" ); String path = userDataDirFile.getAbsolutePath(); prints C:\Program Files\eclipse\data\users Then this.getClass().getClassLoader().getResource("").getPath() prints C:/Workspaces/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/survey/WEB-INF/classes/ Another one: System.getProperty("user.dir") prints C:\Program Files\eclipse There is no code that I tried (I think the 2nd solution supposed to work, but it doesn't) can locate me to root folder of my project. Anyone can advise?
has comment: http://stackoverflow.com/comment/38020445
possible better answer: http://stackoverflow.com/a/59848758
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24550023
has comment: http://stackoverflow.com/comment/38020840

http://stackoverflow.com/comment/61567193
has text: This comment would have been more useful if you swapped this around from 'compositeTopic' to 'compositeQueue' with forwardTo 'topic' rather than 'queue'... That would actually solve the problem of mapping an ActiveMQ queue to an MQTT topic.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/35595077
type: AnswerComment

http://stackoverflow.com/a/24508557
downvote count: 1
has comment: http://stackoverflow.com/comment/37943884
answers question: http://stackoverflow.com/q/24508424
type: Answer
has body: No, this is blocked for security reasons. Browsers hide the full path because it's a breach in security if the website could see the full path to a file you've selected.
score: 0
upvote count: 1

http://stackoverflow.com/q/24471700
has comment: http://stackoverflow.com/comment/37875844
tagged with: java
downvote count: 3
upvote count: 1
tagged with: formatter
type: Question
has body: I have a double (e.g: 123.45) and I need generate a string like 0000012345. I'm trying to do it using only String.format (Formatter). I could use DecimalFormat and then replaceAll, but I was wondering if I could achieve the same result using formatter. The reason is that I will use it with FormatterLineAggregator (spring batch). [EDIT] - Emphasis on the question reason. Tagged as spring batch also. Included link to spring batch documentation. From Spring Batch doc: "... The underlying implementation is built using the same Formatter added as part of Java 5. The Java Formatter is based on the printf functionality of the C programming language. Most details on how to configure a formatter can be found in the javadoc of Formatter.". Spring Batch itemWriter link
has comment: http://stackoverflow.com/comment/37885987
score: -2
has title: String.format decimal with fixed width, zero padded and no decimal separator
answer count: 1
linked to: http://stackoverflow.com/q/21407486
favorite count: 0
tagged with: spring-batch
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37882772
has answer: http://stackoverflow.com/a/24471918

http://stackoverflow.com/a/24473283
answers question: http://stackoverflow.com/q/24473260
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37878372
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37933010
has comment: http://stackoverflow.com/comment/37878410
has body: You don't. You could do it via Java interfaces, but doing that for every class would be bad design. Interfaces should only be used when you expect multiple classes to implement them, or when used as a callback function description. Really the point of separating the code from the .h file in C++ is 1)To prevent bloating the binary as compilers would make multiple versions of each function for each file its included in 2)To make it easier to read for those who just want the implementation. In java, 1 isn't an issue. And Java prefers to solve 2 via automated documentation tools (JavaDoc). TLDR- you don't.
has comment: http://stackoverflow.com/comment/37933327

http://stackoverflow.com/comment/37898301
comment on: http://stackoverflow.com/a/24481270
has text: In pipe java doc write about possible deadlock
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38055787
type: Comment
comment on: http://stackoverflow.com/a/24556143
has text: try this if it works `var name=document.getElementById('username').value; alert(name);`
type: AnswerComment
score: 0

http://stackoverflow.com/a/24563448
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38046375
has comment: http://stackoverflow.com/comment/38046363
has body: You could do it with regex. string.replaceAll("_.*_", "_")
type: Answer
answers question: http://stackoverflow.com/q/24563420
has comment: http://stackoverflow.com/comment/38046214

http://stackoverflow.com/comment/38132113
has text: Sorry, I am not familiar with eclipse. But you could try to clean your cleanup(delete) your "gs-rest-service-0.1.0.jar" file and your build directory. Rebuilding the project may recreate this jar file.
comment on: http://stackoverflow.com/a/24575135
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38015839
type: AnswerComment
has text: @user3693550 - This is the example to illustrate the cause. Check your table about the actual values that it has and replace in place of `121` or `122` in program.
comment on: http://stackoverflow.com/a/24546872
type: Comment
score: 0

http://stackoverflow.com/comment/37993624
type: QuestionComment
comment on: http://stackoverflow.com/q/24535303
has text: dataType expects a json response from server where as you are not responding with any response.
score: 0
type: Comment

http://stackoverflow.com/a/24564534
has comment: http://stackoverflow.com/comment/38048243
answers question: http://stackoverflow.com/q/24564486
upvote count: 5
has comment: http://stackoverflow.com/comment/38048381
type: AcceptedAnswer
downvote count: 0
has body: In your example, req-1 will not block req-2 from being heard. ServerSocket.accept() only blocks application-level handling of new connections, and it is triggered when a connection is established. If a connection with req-1 hasn't been established, it's not exposed to the application level yet. accept() will happily unblock as req-2 is connected. (Spawning a new thread for every single connection may be a problem though. What if you accept 10 000 connections? I'm not sure modern JVMs and/or kernels can efficiently handle this amount of threads.)
accepted answer of: http://stackoverflow.com/q/24564486
score: 5
type: Answer

http://stackoverflow.com/a/24500260
answers question: http://stackoverflow.com/q/24500201
has comment: http://stackoverflow.com/comment/37928916
score: 0
has body: Because string are immutable. When you call subString on a instance you create new object. So in case of performance is better to pass the whole String and the indexes of start and end, but instead passing the String you may want to pass char[]. In Java 7 you can use class Segment for representation. You could also use the CharSequence as attribute for methods. This will assure that you will not mutate the object and still have the flexibility of array of chars.
has comment: http://stackoverflow.com/comment/37929862
has comment: http://stackoverflow.com/comment/37955666
has comment: http://stackoverflow.com/comment/37929737
type: Answer
has comment: http://stackoverflow.com/comment/37928949

inner-classes
tags question: http://stackoverflow.com/q/24535962
type: Tag
tags question: http://stackoverflow.com/q/24493276
tags question: http://stackoverflow.com/q/24446661
tags question: http://stackoverflow.com/q/24506971
tag name: inner-classes

http://stackoverflow.com/a/24517696
has body: Based on the title of this question and described behavior, what is happening is explained in this line: DateFormatter formatter = (DateFormatter) ftf.getFormatter(); formatter.setAllowsInvalid(false); // here is the key As per DefaultFormatter#setAllowsInvalid() docs: public void setAllowsInvalid(boolean allowsInvalid) Sets whether or not the value being edited is allowed to be invalid for a length of time (that is, stringToValue throws a ParseException). It is often convenient to allow the user to temporarily input an invalid value. As you set this property in false you are not allowing users type an invalid value (for instance by deleting some character, or in this particular case by inserting some non digit character) and thus the formatter is trying to get the closest valid value. It is not an unexpected behavior but necessary to keep consistency with the contract offered by this method.
answers question: http://stackoverflow.com/q/24514060
accepted answer of: http://stackoverflow.com/q/24514060
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37989635
score: 1
upvote count: 1

http://stackoverflow.com/q/24441868
tagged with: list
has body: How can I search an arraylist on Java by a keyword in a way that it returns me all of the objects attributes? For example, I have a List called Employee, that has a code, name and salary. I would like to get its salary and code searching by his Name. How can I do that? Thank you
has title: Search in an arraylist by keywords
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24441934
has comment: http://stackoverflow.com/comment/37820099
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/37820173
answer count: 3
has answer: http://stackoverflow.com/a/24441929
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24441940

http://stackoverflow.com/q/24562029
has comment: http://stackoverflow.com/comment/38055077
has answer: http://stackoverflow.com/a/24562598
tagged with: arraylist
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/38044054
tagged with: serialization
tagged with: swing
accepted answer: http://stackoverflow.com/a/24562598
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38044276
type: Question
has title: Data not loading back to Jtable (using Serializable objects)
has body: I have an arraylist of objects displayed on a Jtable. For Jtable i've implemented a model which extends AbstractTableModel. I want the user to be able to save and load from a .txt file. For now, i'm able to create and save the file, but when i try to load the data back into the jTable, nothing happens. Please see my code. Any suggestions are appreciated! Thank you! The model package cartedetelefon; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.table.AbstractTableModel; public class CarteDeTelefon extends AbstractTableModel implements Serializable { private static List&lt;Abonat&gt; listaContacte = new ArrayList&lt;Abonat&gt;(); public static File f; private static final long serialVersionUID = 1L; private static final Logger fLogger = Logger.getLogger(CarteDeTelefon.class.getPackage().getName()); /** * @return the listaContacte */ public static List&lt;Abonat&gt; getListaContacte() { return listaContacte; } /** * @param aListaContacte the listaContacte to set */ public static void setListaContacte(List&lt;Abonat&gt; aListaContacte) { listaContacte = aListaContacte; } private final String[] numeColoane = { "Nume", "Prenume", "CNP", "Numar telefon" }; // add contact to list public void adaugareContact(String nume, String prenume, String cnp, String tel) { try { Long s = Long.valueOf(tel); getListaContacte().add(new Abonat(nume, prenume, cnp, new NrTel(s))); fireTableDataChanged(); } catch (NumberFormatException numberFormatException) { } } @Override pu…
answer count: 1

http://stackoverflow.com/comment/37832733
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24447170
has text: Sorry it was copy mistake, values is within quotes. and in log I can see clientId is server1 or server2

http://stackoverflow.com/comment/38027071
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24552909
type: AnswerComment
has text: thanks again. unfortunately using jjmpeg would mean that i have to spend more time to do reverse engineering to get to know how to use it (no dcumentation at all available) than spending time on the actual tasks i have to perform. maybe some other answer will pop up with interesting solutions. but thx!

http://stackoverflow.com/a/24549723
downvote count: 0
type: Answer
has body: I faced the same problem and solved it. You need to uninstall the Android plugin entirely from within Eclipse (from the "about" section..), including trace view.. Then added the ADT Plugin again (https://dl-ssl.google.com/android/eclipse/) and install it. The problem is solved! I guess it's a bug with the SDK manager or ADT Plugin update mechanism...
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24437564

http://stackoverflow.com/comment/38059315
comment on: http://stackoverflow.com/a/24570043
score: 0
type: Comment
has text: After all I found `"page = 1"` which sould be `"page == 1"`. Thanks for the support and the simplified expression.
type: AnswerComment

http://stackoverflow.com/q/24443841
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37824773
score: 3
has answer: http://stackoverflow.com/a/24463402
has comment: http://stackoverflow.com/comment/37824859
downvote count: 0
has comment: http://stackoverflow.com/comment/37825014
has title: BufferedWriter doesn't throw any error, but file is blank
tagged with: java
has comment: http://stackoverflow.com/comment/37824967
type: Question
has comment: http://stackoverflow.com/comment/37824523
upvote count: 3
has body: I'm brand new to using Java for web servers, and I'm writing a very basic application that writes micro-posts to a file, which will later be called and displayed. ( I know a database would be better for this, but this is for an assignment and we are using file-I/O to keep things simple.) Here is the method in my servlet that receives the form post and writes data to my file: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String content = request.getParameter("postContent"); Calendar cal = new GregorianCalendar(); int day = cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH) + 1; //add one because the Calendar class numbers months 0-11 int year = cal.get(Calendar.YEAR); int hour = cal.get(Calendar.HOUR); int minutes = cal.get(Calendar.MINUTE); String dateTime = Integer.toString(month) + "/" + Integer.toString(day) + "/" + Integer.toString(year) + " " + Integer.toString(hour) + ":" + Integer.toString(minutes); String user = request.getSession().getAttribute("username").toString(); ServletContext servletContext = request.getSession().getServletContext(); String path = servletContext.getRealPath("/posts.txt"); //String path = getServletContext().getRealPath("/posts.txt"); try { BufferedWriter writer = new BufferedWriter(new FileWriter(path, true)); writer.write(user); writer.newLine(); writer.write(dateTime); writer.newLine(); writer.write(content); writer.close(); }catch(IOException ex){ System.out.println(ex.getMessage()); } response.sendRedirect("listPosts.jsp"); } When I run the application, everthing goes smoothly and I end up redirected to listPost.jsp, but my file is blank. I've looked at other questions but I'm doing everything everything right that I know of. Am I setting up the BufferedWriter wrong? Could I have posts.txt in the wrong place? (it is in the WebContent folder). Thanks in advance. UPDATE The value of the path variable is as follows: /home/[myusername]/workspace…
tagged with: file-io
has comment: http://stackoverflow.com/comment/37825511
answer count: 1
has comment: http://stackoverflow.com/comment/37825038
has comment: http://stackoverflow.com/comment/37825391
favorite count: 0
has comment: http://stackoverflow.com/comment/37824468

http://stackoverflow.com/comment/37959942
score: 1
comment on: http://stackoverflow.com/q/24454760
has text: just replace canvas.drawBitmap(Bitmap, Matrix, Paint) with canvas. concat(Matrix) and do your drawing...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24464289
type: Answer
answers question: http://stackoverflow.com/q/24452890
accepted answer of: http://stackoverflow.com/q/24452890
upvote count: 1
has comment: http://stackoverflow.com/comment/37915833
has comment: http://stackoverflow.com/comment/37979812
score: 1
has body: Use the wire tap eip http://camel.apache.org/wire-tap then you can process the tapped message independently, and your CXF web service can terminate asap.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37810924
score: 0
comment on: http://stackoverflow.com/q/24437078
type: QuestionComment
has text: Amount of items is dynamic, which may be an issue if there are more items (things could get crowded). However, this may work if I can set a minimum size for each item I think. I will give it a shot and come back with my result
type: Comment

http://stackoverflow.com/comment/37891959
comment on: http://stackoverflow.com/q/24480466
type: Comment
score: 0
type: QuestionComment
has text: Have you tried displaying the strings you're trying to parse??

http://stackoverflow.com/q/24530091
downvote count: 0
tagged with: arabic
has comment: http://stackoverflow.com/comment/37983266
has body: I'm trying to convert "combined arabic characters" (like ﻼ ) in the different individual characters that compose that "combined" character (e.g. ﻝ ا). I wasnt able to do this in JAVA or C#, because I need split the complete list of characters. In C# i'm trying to get the Unicode character, convert it to Windows-1256 waiting to get 2 o 3 bytes that are the individual characters and that combined character uses, but I wasnt able to do this. String unicodeWord = (char)sc; byte[] arabicBytes = System.Text.Encoding.GetEncoding(1256).GetBytes(unicodeWord); but the result is always ?. Can you help me with this? I have not problem to use either java or c#. Thanks a lot!
has title: Split combined arabic characters in individual characters
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/24530143
tagged with: c#
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24530143
answer count: 1

http://stackoverflow.com/comment/37936727
type: Comment
has text: I'll give it a try. Anyway I think i'm facing some weird context problem or JVM bug. Launching the event from a Quartz task or launching it from a web thread (the event is handled by the same event handler thread), got different results. The event created from Quartz, fails with this exception. The event created from web thread, runs successfully.
comment on: http://stackoverflow.com/a/24504480
type: AnswerComment
score: 0

http://stackoverflow.com/q/24428652
tagged with: deployment
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24431166
type: Question
has title: How to automatically execute deployed war file in Jboss?
tagged with: jboss
has body: I am running jsf application on Jboss. Every time I start JBoss, the war file is successfully deployed, but I have to manually open the browser and enter the URL to start the application. The problem is that this app should start automatically when the server is restarted. I have a shell script that starts JBoss, but the app is started only when I open the browser and enter the url. How can I achieve this?
tagged with: jsf-2
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24428695
has answer: http://stackoverflow.com/a/24431166
possible better answer: http://stackoverflow.com/a/24428695

http://stackoverflow.com/comment/37911910
type: Comment
comment on: http://stackoverflow.com/a/24490613
type: AnswerComment
score: 0
has text: @Sourabh - Can you make that a new question?

http://stackoverflow.com/a/25120778
has body: I just answered this for another question, very similar to yours. You need to add the JavaScript "nature" to the project (basically, tell Eclipse to treat it as a JavaScript project). Right-click on the project and choose Configure > Convert to JavaScript Project.... After doing that you should see a Builder named "JavaScript Validator" and have the JavaScript section in the properties.
type: Answer
answers question: http://stackoverflow.com/q/24505993
upvote count: 22
downvote count: 0
has comment: http://stackoverflow.com/comment/39130552
has comment: http://stackoverflow.com/comment/75637741
score: 22
has comment: http://stackoverflow.com/comment/39161939
has comment: http://stackoverflow.com/comment/39119287
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24505993
has comment: http://stackoverflow.com/comment/39133413

http://stackoverflow.com/comment/37875396
type: QuestionComment
comment on: http://stackoverflow.com/q/24471752
type: Comment
has text: I open and close connections to DB as soon as query has been executed.
score: 0

http://stackoverflow.com/q/24445343
type: Question
has body: I have a problem to find nested self referred records from DB. How can retrieve all the nested self referred records from mysql database.. consider example below ID RefID Name Value 1 NA A 10 2 NA B 20 3 1 C 30 (it refering ID 1) 4 1 D 40 (it refering ID 1) 5 2 E 50 (it refering ID 2) 6 3 F 60 (it refering ID 3) 7 6 G 70 (it refering ID 6) input --&gt; ID=1 output ---&gt; ID= 3,4,6,7 ID -&gt; 1 |-&gt; ID 3, 4 |-&gt; ID 6 |-&gt; ID 7 like that i want to find all sub levels.... Now i want to find self referred nested sub records from DB... If i want to find ID=1 means it should display all the sub records of it. i.e wherever RefID = 1 and its referred ID have any RefID means that also come to display How can i retrieve the data from DB.. Is it any SQL Query can able to retrieve the records from DB
has comment: http://stackoverflow.com/comment/37826828
has comment: http://stackoverflow.com/comment/37826815
has comment: http://stackoverflow.com/comment/37826445
answer count: 1
has title: Find Nested self referred records in same table
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24445900
has comment: http://stackoverflow.com/comment/37826329
score: 0
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24445900

http://stackoverflow.com/comment/37901131
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24484205
has text: try this one: double a=12.34; double b=-12; System.out.println(String.format("%.2f" , a+b)); output:0.34
score: 0

http://stackoverflow.com/comment/38345392
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24583064
type: QuestionComment
has text: @vanOekel Are you sure that ThreadPool Executor Creates the new one when old thread dies. I never find this anywhere. Any link would really be very helpful.

http://stackoverflow.com/a/24508096
downvote count: 0
has body: I could only confirm your findings. Since the setup required to reproduce this is minimal, with no loose ends, the only reasonable conclusion so far is that this is a bug in the wsimport tool packaged with the OpenJDK 8. This tool has simply not been updated to reflect the new restrictions imposed by the javadoc tool of the same JDK package.
answers question: http://stackoverflow.com/q/24495579
accepted answer of: http://stackoverflow.com/q/24495579
upvote count: 2
has comment: http://stackoverflow.com/comment/37942665
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37942630
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37942812

http://stackoverflow.com/q/24528412
downvote count: 0
accepted answer: http://stackoverflow.com/a/24531248
score: 1
favorite count: 0
type: Question
tagged with: android
tagged with: c++
has comment: http://stackoverflow.com/comment/37980270
has title: OpenCV for android different results with openCV for windows
upvote count: 1
has body: I am writing an android application which is doing image processing- I am using same jpg image for Android and PC. My code consists of library code with JNI access which accepts Mat object and returns the mean values for RGB Code in library is cv::Scalar Lum_Y, stDEV_Y, Lum_BGR, stDEV_BGR; double Lum_Y_orig, stDEV_Y_orig, Slope_orig; meanStdDev(ROIImage,Lum_Y,stDEV_Y); Logger::getInstance()-&gt;log("Origin_Mean_R",Lum_Y.val[2]); Logger::getInstance()-&gt;log("Origin_Mean_G",Lum_Y.val[1]); Logger::getInstance()-&gt;log("Origin_Mean_B",Lum_Y.val[0]); When I am running this method from my PC i get results which are correspondant to Photoshop and ImageJ. When i am running the same exact code from android the results are diffrent - how much ? by +- 1. This different in crucial to my algorithm. I verified both images are loaded as BGR , in the Android part i do this: Bitmap bim = BitmapFactory.decodeStream(imageStream); Mat ImageMat = new Mat ( bim.getHeight(), bim.getWidth(), CvType.CV_8UC4, new Scalar(4)); Bitmap myBitmap32 = bim.copy(Bitmap.Config.ARGB_8888, true); Utils.bitmapToMat(myBitmap32,ImageMat); //ImageMat.convertTo(m, rtype);. Mat mat2 = new Mat(); Imgproc.cvtColor(ImageMat, mat2, Imgproc.COLOR_RGBA2BGR); I even tried running opencv mean calc directly from android and the results were exactly the same as running from JNI. Can someone help on this issue ? it seems to me as this is way big of a difference to originate from truncation. Thanks in advance.
answer count: 1
tagged with: opencv
tagged with: java
tagged with: image-processing
has answer: http://stackoverflow.com/a/24531248
type: AnsweredQuestion

http://stackoverflow.com/comment/37997375
type: AnswerComment
comment on: http://stackoverflow.com/a/24510409
type: Comment
score: 1
has text: Thanks. This is a good way to sort the intervals by start time - http://stackoverflow.com/questions/16986888/sort-joda-time-intervals

http://stackoverflow.com/a/24482447
has comment: http://stackoverflow.com/comment/37896402
has comment: http://stackoverflow.com/comment/37896421
has comment: http://stackoverflow.com/comment/37896090
has comment: http://stackoverflow.com/comment/37896379
has comment: http://stackoverflow.com/comment/37895925
has comment: http://stackoverflow.com/comment/37909796
answers question: http://stackoverflow.com/q/24482430
score: 0
has comment: http://stackoverflow.com/comment/37896085
has comment: http://stackoverflow.com/comment/37896014
has body: You can definitely put that kind of code in the onCreate method. But looks like ScoreText is not initialized. Check the logs, and put them here if possible. That would give more details about the problem. Caused by: java.lang.NullPointerException 06-29 23:12:43.462: **E**/AndroidRuntime(20281): at com.example.thewordgame.LevelActivity.onCreate(LevelActivity.java:34) What's the code on LevelActivity.onCreate(LevelActivity.java:34) (Line 34)?
type: Answer

http://stackoverflow.com/comment/37966278
score: 0
has text: Thanks for your help! My table has five columns and I will specify them so it can insert the values correctly.
type: AnswerComment
comment on: http://stackoverflow.com/a/24520642
type: Comment

http://stackoverflow.com/comment/37971596
comment on: http://stackoverflow.com/q/24523764
has text: Have you add your directory to the classpath? Which IDE o you use?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37855368
has text: @E.Doroskevic I ran it with Terminal It gave the following error Could not find or load main class .Users.Sri.Desktop.Messenger.jar
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24460923
type: Comment

http://stackoverflow.com/q/24522148
has answer: http://stackoverflow.com/a/27314805
tagged with: java
accepted answer: http://stackoverflow.com/a/24522411
upvote count: 21
type: Question
type: AnsweredQuestion
score: 21
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24522411
favorite count: 0
has comment: http://stackoverflow.com/comment/37969074
has title: Android Empty Activity and Blank Activity
possible better answer: http://stackoverflow.com/a/27393801
has comment: http://stackoverflow.com/comment/37969139
has answer: http://stackoverflow.com/a/27393801
has comment: http://stackoverflow.com/comment/37971087
tagged with: android
tagged with: android-activity
has body: I am trying to make an android project and there are many types of activities, from there I see blank activity and empty activity. Does anyone know the difference between the two? Blank activity is not creating main_activity.xml but is created by empty activity. In empty activity, I am unable to add EditText Field, Does anyone know why I am not able to add it? Error says : Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V Exception details are logged in Window &gt; Show View &gt; Error Log And when I open error log, there is no error

http://stackoverflow.com/comment/38027903
type: QuestionComment
has text: possible duplicate of [javac is not recognized as an internal or external command, operable program or batch file](http://stackoverflow.com/questions/7709041/javac-is-not-recognized-as-an-internal-or-external-command-operable-program-or)
score: 1
comment on: http://stackoverflow.com/q/24553930
type: Comment

http://stackoverflow.com/q/24492500
has comment: http://stackoverflow.com/comment/37945397
tagged with: struts2
has title: How to send strings to server using Java?
score: 0
tagged with: http-post
answer count: 1
tagged with: apache-commons-httpclient
linked to: http://stackoverflow.com/q/7181534
favorite count: 0
has answer: http://stackoverflow.com/a/24493669
accepted answer: http://stackoverflow.com/a/24493669
has body: I need to send a lot of strings to a web server using Java. I have a List&lt;String&gt; with huge amount of strings and I need to send it via POST request to the Struts2 action on the server side. I have tried something starting with HttpPost httppost = new HttpPost(urlStr); but don't know how to use it. On other side I have a Struts2 action, and getting the POST request is easy to me. I think this solution is too close, but it doesn't solve my problem because it's using just one string : HTTP POST using JSON in Java So, how to send many strings to a server using Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37954775
tagged with: struts-action
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37914768
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37927383

http://stackoverflow.com/comment/38135339
comment on: http://stackoverflow.com/a/24608498
type: AnswerComment
has text: Also, i want to ask you something, do you have any toturial, or any tips to help me out with an problem? I need to parse in a listview all playlists containing an username, and on clicking a playlist row to open an new listview with all video's from that playlist. I made the implementation for video's list view but im stuck on the playlist listview.
score: 0
type: Comment

http://stackoverflow.com/comment/37957821
has text: Thanks! So do I have to add that to the XML file every time?
comment on: http://stackoverflow.com/a/24516389
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38067526
type: Comment
comment on: http://stackoverflow.com/a/24575142
score: 0
type: AnswerComment
has text: ActionBar is not a small thing and so is difficult to tell here. I recommend you read tutorial like http://www.grokkingandroid.com/adding-actionviews-to-your-actionbar/

http://stackoverflow.com/comment/37803265
has text: Mentally replace `A` with `Animal` and B with `Bat`. This should make it clearer why java gets upset when you try to put an `Animal` in a `Bats` variable; you call the `.fly()` method on it (which `Bat` has but `Animal` doesn't) and and all hell breaks loose. [I'm assuming your use of static here is accidental, if not there is a lot more wrong here]
score: 1
comment on: http://stackoverflow.com/q/24432620
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38013444
has text: Hi Greg, I have - and it's not that. It still shows the same error
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24530251

http://stackoverflow.com/q/24515631
has comment: http://stackoverflow.com/comment/37956450
type: Question
has body: I'm trying to have a response back to a message driven bean but for an unknown reason I am not able to make work the communication correctly. here is it the stateful bean. It send an object message and after create a temporary queue where receive the response. @Stateful public class BookingManagerBean implements BookingManagerBeanInterface { @Inject @JMSConnectionFactory("jms/reservationProcessorQueueFactory") private JMSContext context; @Resource(mappedName = "jms/bookingProcessorQueueReceiver") private Queue bookingProcessorQueueReceiver; private Queue tempQueue; private JMSProducer messageProducer = null; private JMSConsumer messageConsumer = null; private String id_reservation = null; private Map&lt;String,Object&gt; map; @Override public String purchase() { try { sendMessageToBookingProcessorBean(object1, object2); // invia il messaggio contenente la prenotazione e il numero di punti utilizzati receiveMessageFromBookingProcessorBean(); // ricevi il messaggio dal MDB } catch(JMSException jmse) { System.err.println("An error occured " + jmse.toString()); return (id_reservation); } return id_reservation; } private void sendMessageToBookingProcessorBean(Object object1, int object2) throws JMSException { messageProducer = context.createProducer(); messageProducer.send(bookingProcessorQueueReceiver,createMessageForBookingProcessorBean(object1, object2)); } private Message createMessageForBookingProcessorBean(Object object1, int object2) throws JMSException { ObjectMessage msg = context.createObjectMessage(); tempQueue = context.createTemporaryQueue(); //create la queue temporanea dove sarà inviata la risposta messageConsumer = context.createConsumer(tempQueue); msg.setJMSReplyTo(tempQueue); map = new HashMap&lt;&gt;(); map.put("object1", object1); map.put("object2", object2); msg.setObject((Serializable) map); return msg; } private void receiveMessageFromBookingProcessorBean() throws JMSException { Message msg = messageConsumer.receive(); if(msg instanceof TextMessag…
score: 0
tagged with: message-queue
has comment: http://stackoverflow.com/comment/37956320
tagged with: jms
has title: Send a message to and get back a response from a message driven bean
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/38079029
has text: "x represents the width of the box, and y represents the width." - you probably meant "y represents the height" right ?
comment on: http://stackoverflow.com/q/24580873
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37826425
type: QuestionComment
has text: ORA-01756: quoted string not properly terminated Cause: A quoted string must be terminated with a single quote mark ('). Action: Insert the closing quote and retry the statement.
comment on: http://stackoverflow.com/q/24445117
score: 0
type: Comment

http://stackoverflow.com/q/24467439
tagged with: recursion
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
accepted answer: http://stackoverflow.com/a/24467493
type: Question
downvote count: 0
has title: Reversing a linked-list
has answer: http://stackoverflow.com/a/49193737
has body: I am writing a simple recursive code to reverse a linked-list in Java. Strangely it returns the same node. Node reverse(Node ptr) { if (ptr.link == null) return ptr; Node second = ptr.link; ptr.link = null; Node rest = reverse(second); rest.link = ptr; return rest; } Why isn't this working?
favorite count: 0
possible better answer: http://stackoverflow.com/a/24468104
answer count: 3
tagged with: reverse
has answer: http://stackoverflow.com/a/24468104
score: 1
has answer: http://stackoverflow.com/a/24467493
upvote count: 1

http://stackoverflow.com/comment/37962168
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24518476
has text: In your project properties, in the *Sources* section, verify that the *Source/Binary Format* is JDK8, and in the *Libraries* section, check that the *Java Platform* is also JDK8

http://stackoverflow.com/comment/38018648
has text: @white Suppose it is application context bean. Will ConfigurableApplicationContext.refresh() refresh also all autowired dependencies which depends on this bean? Also I think it will cause some performance and memory leak issues
comment on: http://stackoverflow.com/q/24547766
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38039479
score: 3
has text: You don't appear to be passing the same coordinates? It looks like the image is at `(x,y)` and the oval is at `(x*10,y*10)`. Why would those two lines be the same?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24559981

http://stackoverflow.com/q/24473430
has comment: http://stackoverflow.com/comment/37887593
has answer: http://stackoverflow.com/a/24473708
has comment: http://stackoverflow.com/comment/37878510
has comment: http://stackoverflow.com/comment/37882099
linked to: http://stackoverflow.com/q/19689214
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37887828
has comment: http://stackoverflow.com/comment/37881975
tagged with: java
possible better answer: http://stackoverflow.com/a/24474180
score: 10
has answer: http://stackoverflow.com/a/75168463
linked to: http://stackoverflow.com/q/11227809
has comment: http://stackoverflow.com/comment/37879156
has answer: http://stackoverflow.com/a/24474180
answer count: 8
has body: An interview question I was asked last week: I need a function to print out whether a number is positive or negative without using conditional statements like if else while for switch a? b:c etc. How can i do that. I told the interviewer that it's impossible cuz the question is 'conditional' in nature. He told me it's possible but didn't tell me how. I did quite a bit of search but no good answers.
has comment: http://stackoverflow.com/comment/37893743
has comment: http://stackoverflow.com/comment/37878518
has title: check positive or negative without using conditional statements in java
favorite count: 0
has answer: http://stackoverflow.com/a/24473650
has comment: http://stackoverflow.com/comment/37879176
has answer: http://stackoverflow.com/a/24476028
has answer: http://stackoverflow.com/a/24473433
has answer: http://stackoverflow.com/a/24476295
has comment: http://stackoverflow.com/comment/37881589
has answer: http://stackoverflow.com/a/24473544
upvote count: 11
accepted answer: http://stackoverflow.com/a/24473433
type: AnsweredQuestion

http://stackoverflow.com/comment/37865614
score: 1
has text: Write the code. You can do it ad-hoc, knowing each "snake_case" (interesting term) key you want converted, or as a general routine that will convert all of them. For the general case you'd need to put "snake_case" and "snake_skin" in the same outer object, requiring some thought.
comment on: http://stackoverflow.com/q/24465668
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24558674
has comment: http://stackoverflow.com/comment/38039363
accepted answer: http://stackoverflow.com/a/24559992
has comment: http://stackoverflow.com/comment/38037017
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38037143
tagged with: file
upvote count: 1
has comment: http://stackoverflow.com/comment/38038883
tagged with: text
tagged with: object
type: AnsweredQuestion
has title: I have to read numbers from a text file and store each one in a different object, Help Please. java
tagged with: java
has comment: http://stackoverflow.com/comment/38036935
score: -1
has answer: http://stackoverflow.com/a/24559992
has comment: http://stackoverflow.com/comment/38036944
type: Question
possible better answer: http://stackoverflow.com/a/24558883
answer count: 2
has answer: http://stackoverflow.com/a/24558883
has body: EDIT: Found out what I was doing wrong. The double array in the StockDataBase class was declared static. :( sorry for the trouble everyone. I have to read from a text file. It basically contains numbers in two columns. I have to store the left column in an object and the right in another. I've tried to do this, but it's storing the right column in both. Please Help, could you please tell me what I'm doing wrong? values.txt: 100.0 110 100.0 100.0 100.0 105.0 100.0 120.0 100 101.0 100.0 100.0 100.0 90.0 100.0 70.0 100.0 83.0 100 80.0 100.0 99 100.0 50.0 Here is my code: import java.io.File; import java.io.IOException; import java.util.Scanner; public class StockAnalysis { public static void main(String[] args) { StockDataBase startingValue = new StockDataBase(); StockDataBase endingValue = new StockDataBase(); try { Scanner input= new Scanner(new File("values.txt")); int i = 0; while(input.hasNext()){ startingValue.setStockValue(i,input.nextDouble()); endingValue.setStockValue(i, input.nextDouble()); i++; } input.close(); /* Scanner input2 = new Scanner(new File("values.txt")); i=0; while(input2.hasNext()){ double temp = input2.nextDouble(); endingValue.setStockValue(i, input2.nextDouble()); i++; }*/ for(int z = 0; z &lt; 12; z++){ System.out.println(endingValue.getStockValue(z)); } } catch (IOException e) { System.out.println("Unable to open or read from file."); } } } This just prints out the same values for both of them. I tried to create another scanner and do each one separately where one would skip the first or the second line by storing it in a temporary double variable. That didn't work either. Thanks for helping
has comment: http://stackoverflow.com/comment/38039125

http://stackoverflow.com/q/24435989
possible better answer: http://stackoverflow.com/a/24439598
has answer: http://stackoverflow.com/a/24439598
type: Question
has answer: http://stackoverflow.com/a/36839811
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37809770
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/37820728
accepted answer: http://stackoverflow.com/a/24437199
answer count: 3
has title: How to force commit Spring - hibernate transaction safely
tagged with: spring
tagged with: transactions
has body: We are using spring and hibernate for an web application: The application has a shopping cart where user can place items in it. in order to hold the items to be viewed between different login's the item values in the shopping cart are stored in tables. when submitting the shopping cart the items will be saved into different table were we need to generate the order number. When we insert the values into the table to get the order number, we use to get the max order number and add +1 to it. we are using spring transaction manager and hibernate, in the code flow we get the order number and update the hibernate object to hold the order num value. when i debug, i noticed that only when the complete transaction is issued the order number entity bean is being inserted. Issue here is when we two request is being submitted to the server at the same time, the same order number is being used, and only one request data is getting inserted. could not insert the other request value which is again a unique one. The order num in the table is a unique one. i noticed when debugging the persistant layer is not getting inserted into the database even after issuing session flush session.flush() its just updating the memory and inserting the data to db only at the end of the spring transaction . i tried explicitly issuing a commit to transaction session.getTransaction().commit(); this inserted the values into the database immediately, but on further code flow displayed message that could not start transaction. Any help is highly appreciated. Added: Oracle database i used. There is a sequence number which is unique for that table and also the order number maps to it.
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37808877
has comment: http://stackoverflow.com/comment/37809407
has comment: http://stackoverflow.com/comment/37814115
score: 2
tagged with: database
downvote count: 0
has answer: http://stackoverflow.com/a/24437199

http://stackoverflow.com/a/24476572
accepted answer of: http://stackoverflow.com/q/24475489
answers question: http://stackoverflow.com/q/24475489
type: Answer
has body: Maybe a tiny bit better than re-inlining the code would be to Extract Method on the entire body of the new code, with Replace Additional Occurrences checked, and then inline the new method from the original call. That way you run less risk of choosing the wrong lines to extract. Update: Here's an example: You start with extractableCode(1); extractableCode(2); extractableCode(3); and extract the original block, leaving you with extractedMethod(1); extractableCode(2); extractableCode(3); ... function extractedMethod(int i) { extractableCode(i); } Your way would be to inline extractedMethod, then repeat the extraction with Replace All Occurrences. I'm suggesting instead that you extract from inside extractedMethod(): extractedMethod(1); secondExtractedMethod(2); secondExtractedMethod(3); ... function extractedMethod(int i) { secondExtractedMethod(i); } function secondExtractedMethod(int i) { extractableCode(i); } Then inline your original call to the first extracted method: secondExtractedMethod(1); secondExtractedMethod(2); secondExtractedMethod(3); ... function secondExtractedMethod(int i) { extractableCode(i); } And then, probably rename the second extracted method. It's only a tiny bit different from what you originally suggest, but it might be a little more reliable.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37884654
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24749697
answers question: http://stackoverflow.com/q/24549944
has comment: http://stackoverflow.com/comment/38610984
upvote count: 1
type: Answer
has body: In the Hibernate Settings (Properties -> Hibernate Settings): Check the option Enable Hibernate Support. Under Default Hibernate Console Configuration, if config is already defined select it else go to Run -> Run Configurations and define new configuration in Hibernate Console Configuration. Specify the project name. Select JPA Project Configured Connection in the Database connection, click Apply and return to the Hibernate Settings settings page. Restart eclipse or Clean your project. Update: Try this as well: Open .project file in the imported project from svn and any references you find in nature and build parameters remove them. &lt;\nature>org.hibernate.eclipse.console.hibernateNature&lt;\nature> //or on the lines myconf. Do same thing in .classpath file as well.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38403015

http://stackoverflow.com/comment/113510673
type: QuestionComment
has text: Amir's link is now https://dzone.com/articles/why-future-generations-will
comment on: http://stackoverflow.com/q/24581818
score: 0
type: Comment

http://stackoverflow.com/q/24454009
tagged with: java
has body: Situation: Spring Security currently does not have a feature I need and it is a simple change to implement the feature. As a quick and dirty proof of concept (before getting the change approved through Spring), I want to pull the source of Spring Security and make the change and put reference it directly in my application. The app is not a multi module project and has just one project that compiles into a war. This is the Maven artifact org.springframework.security spring-security-ldap ${spring.security.version} but I don't want it to be grabbed from Maven Central since I will provide it (just not sure where I need to put it).
type: Question
possible better answer: http://stackoverflow.com/a/24454086
answer count: 2
has answer: http://stackoverflow.com/a/24454086
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24454099
accepted answer: http://stackoverflow.com/a/24454099
tagged with: maven
upvote count: 1
tagged with: spring
has title: Instead of using Maven to pull in a third party dependency, how can I implement the source of that dependency directly into my project?
has comment: http://stackoverflow.com/comment/37842172
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/24485687
has body: Here's a scenario: I have a 'data-feed' - a REST/JSON service that updates periodically (let's say - every 10 seconds or so), and if a change in the data set occurs - then all subscribed listeners need to be updated. It's currently implemented using long-polling over HTTP, which is a technicality - but the main concept is that clients don't bother the server, and the server doesn't bother the clients - unless there's something to bother about. When there is something new, all clients get notified immediately. The technology consists of Java/Tomcat7, async IO (asyncResponse). I think it works great: I can drive 10K concurrent sessions for ~ $0.07 per hour (AWS M3.Medium instance). (Question - I think it works great, but I would like to hear some benchmark numbers to verify. Or in other words - do you think it's a good bang for the buck? please share !!) If all my clients receive the same data set (the same JSON), is there a way I could optimize even more? I'm thinking about IP V6 'multicast' - this would minimize my bandwidth consumption by orders of magnitude - but is this practical? For supporting 1 million concurrent users, for example, assuming there's an update every 10 seconds, I would need to support 100K 'hits' (or responses) per second. If the response size is 10K, the bandwidth starts becoming a big issue here: 10K * 100K * 60 * 60 * 24 --> 86 Giga per 24h. There isn't really a single, focused question here (besides IPv6) - I would like to hear your thoughts, experience, and alternative approaches - I hate re-inventing the wheel, and I'm sure that the collective wisdom out there far surpasses my own. Thanks.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24597238
favorite count: 0
tagged with: multicast
type: UnansweredQuestion
tagged with: architecture
tagged with: java
type: Question
tagged with: performance
score: 4
has title: Design and architecture for multiple concurrent users subscribing to a data feed
tagged with: optimization
upvote count: 4

http://stackoverflow.com/comment/37983933
type: QuestionComment
comment on: http://stackoverflow.com/q/24530246
has text: Wrap them in another panel. It's not illegal to nest panels inside panels. And don't tag AWT when you're using Swing. Learn the different [Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) to get the effect you want. Each panel can have a different LM
score: 0
type: Comment

http://stackoverflow.com/q/24517487
has comment: http://stackoverflow.com/comment/37960113
has body: I am trying to create a Java Applet that outputs information to a text file located in the same directory as the java applet. I understand Java Applets are not ideal, but I have spent a great deal of time on this and if possible want to solve this through applets. Here is some of my code on how I could read code from a file into a text box. I assume it would be something similar to this, but outputted. public void readFile() { String line; URL url = null; try { url = new URL(getCodeBase(), fileToRead); } catch(MalformedURLException e) { } try { InputStream in = url.openStream(); BufferedReader bf = new BufferedReader (new InputStreamReader(in)); strBuff = new StringBuffer(); while((line = bf.readLine()) != null){ strBuff.append(line + "\n"); } a1.append("File Name : " + fileToRead + "\n"); a1.append(strBuff.toString()); } catch(IOException e) { e.printStackTrace(); } }
tagged with: outputstream
has comment: http://stackoverflow.com/comment/37960406
type: UnansweredQuestion
has title: Java Applet Output File
upvote count: 1
has answer: http://stackoverflow.com/a/24517661
type: Question
score: 1
tagged with: java
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
tagged with: file-io
tagged with: japplet

http://stackoverflow.com/comment/41609739
score: 2
comment on: http://stackoverflow.com/q/24486589
has text: i ended up using the jackson object mapper
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/45989498
comment on: http://stackoverflow.com/q/24499509
score: 0
has text: Sorry, I didn't spot the fact that this question was 7 months old...
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24527437
answer count: 2
has comment: http://stackoverflow.com/comment/37978367
has comment: http://stackoverflow.com/comment/37981960
has comment: http://stackoverflow.com/comment/37978629
tagged with: javascript
has title: Regex help to get value from the outer most brackets
has comment: http://stackoverflow.com/comment/37978646
score: 0
upvote count: 1
downvote count: 1
tagged with: regex
favorite count: 0
has comment: http://stackoverflow.com/comment/38295185
has answer: http://stackoverflow.com/a/24530173
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37982163
has comment: http://stackoverflow.com/comment/37981675
has answer: http://stackoverflow.com/a/24527899
has body: Can you help me to get the values from the outermost braces, the search string can vary? String search = "hostProductLineCode:eq(YB) || hostProductLineCode:eq(PB) || (readyDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00))"; Want get the below values from above YB PB readyDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00) search = "(readyDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00)) || (liveDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00))"; Want get the below values from above readyDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00) liveDate:ge(2014-01-13T05:00:00);StartDate:ge(2014-01-13T05:00:00) search = "hostProductLineCode:eq(YB);hostProductLineCode:eq(PB);(readyDate:ge(2014-01-13T05:00:00)||StartDate:ge(2014-01-13T05:00:00))"; Want get the below values from above YB PB readyDate:ge(2014-01-13T05:00:00)||StartDate:ge(2014-01-13T05:00:00) search = "hostProductLineCode:eq(YB);hostProductLineCode:eq:eq(V);(readyDate:ge(2014-01-13T05:00:00)||StartDate:ge(2014-01-13T05:00:00));(status:eq(V)||status:eq(P))"; Want get the below values from above YB V readyDate:ge(2014-01-13T05:00:00)||StartDate:ge(2014-01-13T05:00:00));(status:eq(V)||status:eq(P) I have tried below Pattern p = Pattern.compile("\\((.*?)\\)"); Matcher m = p.matcher(search); while (m.find()) { System.out.println(m.group()); }
has comment: http://stackoverflow.com/comment/37982091
tagged with: java
type: Question

http://stackoverflow.com/comment/38037444
type: AnswerComment
has text: I would say standard practice doesn't involve printing from within the insertionSort method. Looks fine otherwise.
comment on: http://stackoverflow.com/a/24558978
type: Comment
score: 0

http://stackoverflow.com/comment/38055386
score: 0
has text: Do you have a question?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24567776

http://stackoverflow.com/comment/40105879
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24489424
type: AnswerComment
has text: Can you try this? It is working for me! * Stop the JBoss * Refresh the target directory (right click on target directory and click Refresh) * Redeploy and start the JBoss

http://stackoverflow.com/q/24553076
tagged with: spring-mvc
has body: The custom error message is not getting displayed when I try to override the NotEmpty annotation error message. Case: 1 @NotEmpty(message="{username}") private String username; message.properties: NotEmpty.username=test Works fine. Output in jsp page: test Case 2: @NotEmpty(message="{error.required.username}") private String username; message.properties: NotEmpty.user.error.required.username=test Where user is the pojo class. Output in jsp page: {error.required.username} Can I know what I made wrong in the above sample code.
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38026264
answer count: 1
tagged with: jsp
has title: Validator Annotation in Spring MVC
has answer: http://stackoverflow.com/a/24553350
tagged with: spring-validator
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/24509361
answer count: 2
has title: java.io.FileNotFoundException and (No space left on device)
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/37947884
downvote count: 4
tagged with: file-io
accepted answer: http://stackoverflow.com/a/24512710
tagged with: inode
has body: I have this Java code, which should read a 0.5M files and write after removing some useless information(I’m using Enron E-mails Dataset) public void getInboxFiles(File directory){ File[] usersFolders; File[] userFolders; File[] inboxFiles; usersFolders = directory.listFiles(); for(File temp:usersFolders){ userFolders = temp.listFiles(); for(File temp2:userFolders){ inboxFiles = temp2.listFiles(); for(File tmp3:inboxFiles){ if(tmp3.isDirectory()) continue; readNPrase(tmp3, new File("/media/ADATA SH12/datasets/parsedEnron/"+temp.getName()+tmp3.getName()+".txt")); } } } } the function readNParse is: public void readNPrase(File in,File out){ BufferedReader br=null; BufferedWriter bw =null; try{ br = new BufferedReader(new FileReader(in)); bw= new BufferedWriter(new FileWriter(out)); boolean messageContent = false; String line = null; while((line = br.readLine()) != null){ if(line.trim().equals("")) messageContent = true; if(messageContent &amp;&amp; !isHeader(line) &amp;&amp; !line.trim().equals("")){ bw.write(line); bw.newLine(); } } bw.flush(); br.close(); bw.close(); } catch (IOException e) { e.printStackTrace(); }finally{ try{ bw.close(); br.close(); }catch(Exception e){ e.printStackTrace(); } } } after running this code for 10 minuets it stops working and gave me this error: java.lang.NullPointerException java.io.FileNotFoundException: /media/ADATA SH12/datasets/parsedEnron/causholli-m98.txt (No space left on device) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:221) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:171) at java.io.FileWriter.&lt;init&gt;(FileWriter.java:90) at EnronMailParser.readNPrase(EnronMailParser.java:16) at EnronMailParser.getInboxFiles(EnronMailParser.java:71) at EnronMailParser.main(EnronMailParser.java:84) I checked the space on the drive but there is a too much of empty space some of people said it is related to file name, and some said it is related to inode …
favorite count: 0
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/24511007
has answer: http://stackoverflow.com/a/24511007
tagged with: java
has answer: http://stackoverflow.com/a/24512710
upvote count: 7
linked to: http://stackoverflow.com/q/466521
type: Question

http://stackoverflow.com/comment/38081542
type: QuestionComment
has text: Nikhil, is there a way to disable warning from java side?
score: 0
comment on: http://stackoverflow.com/q/24566413
type: Comment

http://stackoverflow.com/a/24543732
has body: Calling remove() when you already know the queue is empty doesn't make any sense whatsoever. And catching NoSuchElementException on a method that doesn't throw it, ditto. Just delete all that code. But your code is not thread-safe. The method that calls add() needs to synchronize on the queue, and the method that calls isEmpty() and poll() ditto, and it should wait on the queue while it is empty. Or use a java.util.concurrent queue.
type: Answer
answers question: http://stackoverflow.com/q/24527419
has comment: http://stackoverflow.com/comment/38016267
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/37798594
score: 0
type: Comment
type: QuestionComment
has text: @Java Learner I am using poi from apache
comment on: http://stackoverflow.com/q/24430222

http://stackoverflow.com/comment/37807235
type: Comment
has text: Yeah I was wondering if there was a way for the JVM to change the hard coded variable after each game but didn't think it was possible, thanks for your help.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24434444

http://stackoverflow.com/comment/37944290
comment on: http://stackoverflow.com/q/24504383
score: 0
has text: @Jens yes it helped me. See my answer for details. Thanks...
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24526483
score: 0
answers question: http://stackoverflow.com/q/24526398
type: Answer
has body: Basically only the type differs. When you use List Object you are using the Object type (in this case). When you dont say the list will be default made to be RAW type. Hope this helps.

http://stackoverflow.com/comment/37801850
type: AnswerComment
has text: Now it is showing wrong output ,exception is removed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24431897

http://stackoverflow.com/comment/37832079
type: Comment
has text: I misunderstood the question in the same way you did. The question includes "Object array = .... // multidimensional array with number of dimensions X" and it is the right hand side there that is the thing that cannot be done. You can't create an array with a dynamic number of dimensions, which is what I think she is after. Maybe I am wrong about what she is after.
comment on: http://stackoverflow.com/a/24448596
score: 0
type: AnswerComment

http://stackoverflow.com/q/24515798
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/24516048
type: Question
tagged with: java
has title: Eclipse web servers - What is the difference between locations?
tagged with: eclipse
answer count: 1
downvote count: 0
has body: I have servers like tomcat and glassfish intalled in my eclipse kepler. When I right click and see properties of any server, I see a property called location under the general options in eclipse. There is a switch location button next to it. I can switch the location to - [Workspace metadata] Installation folder of my web server What is the difference between these two ? How do I decide which one is better ?
favorite count: 0
type: UnansweredQuestion
tagged with: eclipse-kepler

http://stackoverflow.com/comment/38037000
score: 0
has text: Furthermore, all your questions have been asked and answered *many* times. Search before posting. You will learn to avoid the j.u.Date & .Calendar classes, to never make productive use of the toString method of j.u.Date because of its awful format and default time zone, to use Joda-Time or the new java.time libraries, to use the 3 different classes in Joda-Time that handle spans of time in different ways.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24558448

http://stackoverflow.com/q/24537207
tagged with: applet
score: -6
favorite count: 0
has answer: http://stackoverflow.com/a/24537398
accepted answer: http://stackoverflow.com/a/24537398
has comment: http://stackoverflow.com/comment/37996857
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: I am stuck with the missile part. How do I add a method fire() (from Missile.java) in the Player class when keyPressed occurred. Once I press space the missile shoots and adds to ArrayList of missile objects. But it's not happening. private ArrayList&lt;Missilies&gt; missilies; public Player (MainClass mc){ url = mc.getDocumentBase(); player = mc.getImage(url,"spaceship1.png"); } public void paint(Graphics g, MainClass mc){ g.drawImage(player, x, y, mc); } @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()){ case KeyEvent.VK_SPACE:{ // fire a missile; missilies.add(new Missilies(x, y)); ArrayList ms = (Missilies). missilies.add(new Missilies(getX(), getY())); break; } and here's the Missile class public class Missilies { // New missile object //////// public Missilies(int x, int y){ this.x=x; this.y=y; visible=true; } // Moving missiles //////// public void update(MainClass mc, Player p){ x +=missile_speed; if (x&gt;mc.getWidth()) visible = false; } // Painting //////// public void paint(Graphics g, MainClass mc, Player p) { for (int i = 0; i &lt; missilies.size(); i++ ) { Missilies m = (Missilies) missilies.get(i); g.drawImage(missile, p.getX(), p.getY(), mc); } } // Firing new missile /////////// public void fire(Player p){ missilies.add(new Missilies(p.getX(), p.getY())); } // Action performed ////////// public void action(MainClass mc, Player p){ for (int i = 0; i &lt; missilies.size(); i++) { Missilies m = (Missilies) missilies.get(i); if (visible == true) update(mc, p); else missilies.remove(i); } } } Main class public void init() { setSize(800, 600); p = new Player(this); e = new Enemy(this); } { while(running) { repaint(); p.update(this); e.update(this, p); try { Thread.sleep(20); } catch(InterruptedException e) { System.out.println("Error has occured"); } } } public void update(Graphics g){ dbImage = createImage(800,600); dbg = dbImage.getGraphics(); paint(dbg); g.drawImage(dbImage, 0, 0, this); } public void paint(Graphics g){ //g.setCol…
has title: Missile don't fire
has comment: http://stackoverflow.com/comment/37996904
has comment: http://stackoverflow.com/comment/37997199
type: Question
has comment: http://stackoverflow.com/comment/37996938
downvote count: 6
answer count: 1

http://stackoverflow.com/comment/37911326
comment on: http://stackoverflow.com/a/24490458
score: 0
type: AnswerComment
has text: Oh indeed! (note that while this makes sense I have not tested it as I have since installed from the project itself after making some other changes)
type: Comment

http://stackoverflow.com/a/24474014
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24471102
type: Answer
has comment: http://stackoverflow.com/comment/37879710
upvote count: 4
has body: Before Java 8, the usual answer to your question was "use Joda Time" http://joda-time.sourceforge.net/faq.html But the author of Joda Time (Stephen Colebourne) was deeply involved in the new Java 8 time classes and methods. Here are two very good articles: http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html For your specific question, you might want to consider Java 8 "Duration" and "LocalTime", "LocalDate" and/or "LocalTimeDate" (among other options): // A duration of 3 seconds and 5 nanoseconds Duration duration = Duration.ofSeconds(3, 5); Duration oneDay = Duration.between(today, yesterday); // Tomorrow LocalDate tomorrow = LocalDate.now().plusDays(1); // Yesterday LocalDate yesterday = LocalDate.now().plusDays(-1); // before 5 houres and 30 minutes LocalDateTime dateTime = LocalDateTime.now().minusHours(5).minusMinutes(30);
has comment: http://stackoverflow.com/comment/37891244

http://stackoverflow.com/comment/37800610
comment on: http://stackoverflow.com/a/24431351
type: AnswerComment
score: 0
type: Comment
has text: +1, although I would say this is their **main** problem, it still wouldn't work because their final int variable a has not been initialized before the constructor finishes.

http://stackoverflow.com/q/24516165
has comment: http://stackoverflow.com/comment/37958214
has body: I'm having a bad time with Type Parameters in Java. I have an abstract class that required a Type parameters as class that inherit from BaseModel class and I would pass this class as a Type Parameters to an another inner object This is my class. package com.gift.app.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import com.gift.app.client.AsyncCollectionHandler; import com.gift.app.interfaces.OnFetchCollectionInterface; import com.gift.app.model.BaseModel; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.List; /** * Created by andreaascari on 01/07/14. */ public abstract class InjectedListFragment&lt;T extends BaseModel&gt; extends InjectedFragment implements OnFetchCollectionInterface&lt;T&gt; { private static final String TAG = InjectedListFragment.class.getSimpleName(); private List&lt;T&gt; mCollection; private AsyncCollectionHandler&lt;T&gt; asyncCollectionHandler = new AsyncCollectionHandler&lt;T&gt;("") { @Override public void onSuccess(List&lt;T&gt; res) { mCollection = res; fetchCompleted(true); } }; @Override @SuppressWarnings("unchecked") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!mFetchDataIsDisabled) fetchData(asyncCollectionHandler); } public Class&lt;T&gt; getBaseModelExtensionClass() { Class klass = ((Object) this).getClass(); Type type = klass.getGenericSuperclass(); ParameterizedType paramType = (ParameterizedType) type; if (paramType.getActualTypeArguments() != null &amp;&amp; paramType.getActualTypeArguments().length &gt; 0) { if (BaseModel.class.isAssignableFrom(paramType.getActualTypeArguments()[0].getClass())) { return (Class&lt;T&gt;) paramType.getActualTypeArguments()[0]; } } return null; } protected void fetchData() { fetchData(asyncCollectionHandler); } @Override protected void canPopulateView() { populateView(mCollection); } } This method: getBaseModelExtensionClass() return the right class. Thi…
has answer: http://stackoverflow.com/a/24534284
has comment: http://stackoverflow.com/comment/37974558
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37970928
score: 0
answer count: 1
has title: Passing Type paramters as Type parameters in Java
has comment: http://stackoverflow.com/comment/37958621
has comment: http://stackoverflow.com/comment/37957722
has comment: http://stackoverflow.com/comment/37957346
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37971079
tagged with: reference
tagged with: reflection

http://stackoverflow.com/comment/37859231
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24463140
has text: What do you do in `pd.novoProduto()` ?

http://stackoverflow.com/q/24578458
has comment: http://stackoverflow.com/comment/38073811
type: Question
has comment: http://stackoverflow.com/comment/38075577
has body: I am coding a little game in which i have taken a grid of JButtons in a JFrame and i want to refresh the colors of the buttons contained in a JFrame,which is already visible.As explained below void foo(){ mainFrame.setVisible(true);//mainFrame is defined at class level. //color update code for the buttons. mainFrame.setVisible(true); } Result i am getting is not as expected and my screen gets freeze .Isn't it the right way to achieve what i wanted? EDIT ok i am explaining it in detail what i want to achieve.i have a class,as:- import javax.swing.*; import java.awt.*; import java.util.*; class Brick extends JButton{ public void setRandomColors(){ int random = (int) (Math.random()*50); if(random%13==0){ this.setBackground(Color.MAGENTA); } else if(random%10==0){ this.setBackground(Color.red); } else if(random%9==0){ this.setBackground(Color.yellow); } else if(random%7==0){ this.setBackground(Color.orange); } else if(random%2==0){ this.setBackground(Color.cyan); } else{ this.setBackground(Color.PINK); } } public void setBlackColor(){ this.setBackground(Color.black); } } class Grid { JFrame mainGrid = new JFrame(); ArrayList&lt;Brick&gt; bunchOfBricks = new ArrayList&lt;&gt;(); int gridLength = 8;//gridlenth is equals to gridweight as i have considered a Square grid. int totalBricks = gridLength*gridLength; public void formBunchOfBricks(){ for(int i=0;i&lt;totalBricks;i++){ bunchOfBricks.add(new Brick()); } } public void formColoredGrid(){ Brick aBrick; mainGrid.setLayout(new GridLayout(8,8)); for(int i=0;i&lt;totalBricks;++i){ aBrick = (bunchOfBricks.get(i)); aBrick.setRandomColors(); mainGrid.add(aBrick); } mainGrid.setVisible(true);//its ok upto here iam getting randomly colored Frame of Bricks or so called JButtons. delay(15);//Sorry for this one,i warn you not to laugh after looking its defination. } /* I want following function to do following things:- 1.it should firstly display the Grid whose all buttons are black Colored. 2.After some time the original colored,…
has comment: http://stackoverflow.com/comment/38075618
accepted answer: http://stackoverflow.com/a/24578483
has comment: http://stackoverflow.com/comment/38075542
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24578483
favorite count: 0
has comment: http://stackoverflow.com/comment/38075632
linked to: http://stackoverflow.com/q/24599565
has comment: http://stackoverflow.com/comment/38075590
has comment: http://stackoverflow.com/comment/38075657
type: AnsweredQuestion
downvote count: 0
score: 1
has title: how to refresh the colors of button contained in a JFrame?
tagged with: java
tagged with: swing

http://stackoverflow.com/a/24577527
upvote count: 1
answers question: http://stackoverflow.com/q/24571463
score: 1
downvote count: 0
type: Answer
has body: They're also good for implementing things like C#'s 'out' keyword with a String. Example public int getInt(StringBuilder error) { int retVal = 0; if (someErrorOccured) error.append("Couldn't get int because of..."); else retVal = whatItsSupposedToBe; return retVal; }

http://stackoverflow.com/comment/37912142
has text: I'm trying to do the following: when a method has to return validation messages via REST, I want the method to return Messages object, but if everything is good, it should return a Person.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24490775

http://stackoverflow.com/a/24455003
downvote count: 0
has body: You're supposed to call notify only from a thread that owns the object's monitor. From the documentation: This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways: By executing a synchronized instance method of that object. By executing the body of a synchronized statement that synchronizes on the object. For objects of type Class, by executing a synchronized static method of that class. (My emphasis)
type: Answer
answers question: http://stackoverflow.com/q/24454960
score: 4
upvote count: 4

http://stackoverflow.com/a/24474745
upvote count: 1
has comment: http://stackoverflow.com/comment/37881541
has comment: http://stackoverflow.com/comment/37881671
has comment: http://stackoverflow.com/comment/37882122
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24474492
has comment: http://stackoverflow.com/comment/37882215
has comment: http://stackoverflow.com/comment/37881874
score: 1
has body: What I would do is provide a singleton which can be accessed anywhere in you application with the confidence only a single instance of the data exists. This is achieved via a private constructor and a public static get(...) method like so... public class SongStore { private static SongStore sSongStore; private Context mContext; private ArrayList&lt;Song&gt; mSongList; private SongStore(Context context) { mContext = context; loadData(); } public static SongStore get(Context context) { if (sSongStore == null) { sSongStore = new SongStore(context.getApplicationContext()); } return sSongStore; } private void loadData() { // load the data } public ArrayList&lt;Song&gt; getSongs() { ... } } In which ever activity you may be in, you simply do -> SongStore.get(YourClass.this).getSongs(); to get the Songs.

http://stackoverflow.com/a/24473194
has comment: http://stackoverflow.com/comment/37878123
has body: import R.java com.erinkabbash.coolmeter.R; //Your.base.pkg.com.R /* You base package .R*/ And clean your project. it might be work, If you working with your base package domain ,then there is no need of importing R.java. just Clean your project or workspace. . It will work. Only use lowercase and underscore for res/, drawables/ and others res fies
has comment: http://stackoverflow.com/comment/37878385
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37878322
upvote count: 1
answers question: http://stackoverflow.com/q/24473153
score: 1
accepted answer of: http://stackoverflow.com/q/24473153
has comment: http://stackoverflow.com/comment/37878465
has comment: http://stackoverflow.com/comment/37878169

http://stackoverflow.com/q/24430346
has answer: http://stackoverflow.com/a/24430425
has body: In this small app, I have used @Autowired annotation along with @Qualifier annotation to config the dependencies, but still an exception is thrown as mentioned below. Pizaa class public class Pizza { private Address deliverydest; @Autowired @Qualifier("ForPizza") public void setDeliverydest(Address deliverydest) { this.deliverydest = deliverydest; } } Spring Context Configuration &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: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-4.0.xsd"&gt; &lt;bean id="pizza" class="com.test.Shopping.Pizza" /&gt; &lt;bean id="Cust1Address" class="com.test.Shopping.Address" /&gt; &lt;bean id="dest1" class="com.test.Shopping.Address" &gt; &lt;qualifier value="ForPizza" /&gt; &lt;property name="buildingno" value="flat1/door2" /&gt; &lt;/bean&gt; &lt;bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" /&gt; &lt;/beans&gt; The exception thrown is Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pizza': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.test.Shopping.Pizza.setDeliverydest(com.test.Shopping.Address); nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.test.Shopping.Address] is defined: expected single matching bean but found 2: Cust1Address,dest1 Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.test.Shopping.Pizza.setDelivery…
downvote count: 0
has answer: http://stackoverflow.com/a/55912373
possible better answer: http://stackoverflow.com/a/24430619
favorite count: 0
accepted answer: http://stackoverflow.com/a/24430425
has comment: http://stackoverflow.com/comment/37798477
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has title: Why NoUniqueBeanDefinitionException: No qualifying bean of type is defined: expected single matching bean but found 2
type: Question
has comment: http://stackoverflow.com/comment/37799642
tagged with: beancreationexception
has answer: http://stackoverflow.com/a/24430619
answer count: 3

http://stackoverflow.com/a/24484177
score: 2
has body: lookslike you want to get nearby place so you can goto:https://developers.google.com/places/documentation/search#PlaceSearchRequests feel free to ask any doubts you get while implementing this
downvote count: 0
answers question: http://stackoverflow.com/q/24483813
type: Answer
upvote count: 2

http://stackoverflow.com/q/24500845
upvote count: 5
has comment: http://stackoverflow.com/comment/37929906
answer count: 1
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/37930389
favorite count: 0
has answer: http://stackoverflow.com/a/24523341
has comment: http://stackoverflow.com/comment/37930037
has body: I have a set of over 500 jar files for a whole range of plugins that we have from a third party, and for each of these jar files there is a source jar file as well. But they have not provided the javadoc. I want to be able to build the javadocs from the provided source jar files, but can't tell if javadoc.exe will do this for me. I haven't used it manually for years, so not familiar with the command line options. One of the guys here showed me how to import the source file into Eclipse so I could browse the Source. but doing that over 500 times is a very time consuming exercise. Cheers
type: AnsweredQuestion
tagged with: java
tagged with: javadoc
has title: How to generate javadoc from many plugin jar files containing source
accepted answer: http://stackoverflow.com/a/24523341
type: Question
score: 5

http://stackoverflow.com/comment/38049527
has text: @kolossus I'm not sure what is the problem, but I found in several sources that CPU utilization used to be a problem with Mojarra, mainly because of overhead caused by state serialization/deserialization of complex component tree structure. It might be the problem here as well, as my pages are complex and have a lot of components. However, I'm not sure if the number of components can be reduced significantly. I thought that going stateless for part of the page might be helpful, but it seems that I can't make only some forms stateless, while other forms remain stateful on the same page.
comment on: http://stackoverflow.com/q/24457872
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37868158
type: AnswerComment
score: 0
type: Comment
has text: These tutorials specifies that, it should be like: ClassName.class.. http://www.tutorialspoint.com/html/html_applet_tag.htm http://www.w3schools.com/tags/tag_applet.asp But it is mentioned that it is not supported in HTML5.
comment on: http://stackoverflow.com/a/24458545

email-attachments
tags question: http://stackoverflow.com/q/24445574
tags question: http://stackoverflow.com/q/24455672
tags question: http://stackoverflow.com/q/24505264
tags question: http://stackoverflow.com/q/24517938
tag name: email-attachments
type: Tag

http://stackoverflow.com/a/24431566
has comment: http://stackoverflow.com/comment/37809816
type: Answer
has body: Compiling isn't the issue; this is a runtime problem. The Tomcat docs are clear: the JDBC driver JAR belongs in the Tomcat server /lib, not the WEB-INF/lib for your application. That exception usually means that the driver class was loaded, but the syntax of the connection URL string is incorrect. Open the MySQL admin console and make sure you can access that database with the credentials you're providing to the app.
score: 0
has comment: http://stackoverflow.com/comment/37801126
has comment: http://stackoverflow.com/comment/37814252
answers question: http://stackoverflow.com/q/24431386

http://stackoverflow.com/q/24466594
tagged with: java
has comment: http://stackoverflow.com/comment/37871350
has comment: http://stackoverflow.com/comment/37896953
type: Question
has comment: http://stackoverflow.com/comment/37897020
has title: xmpp/smack chat using facebook application scoped id
score: 0
tagged with: xmpp
tagged with: facebook-graph-api
tagged with: smack
has body: I am trying to develop a facebook application so that it will retrieve user information and if i need i can raise chat with the user using xmpp/smack api using java. I have succeeded in sending facebook chat using the original Id. For example: for the user facebook.com/xxxxxxxxx the original Id is "10000xxxxxxxxxx" .(As we can get that using graph.facebook.com/xxxxxxx) and we can rise chat with the user by :-10000xxxxxxxxx@chat.facebook.com But the issue is, by using facebook app we cannot get the original Id of the user. From the facebook apps created after 30th April 2014 we cannot get the Original user Id from the facebook app's even though the user gave permission to access his original data. Refer to facebook documention: developers.facebook.com/docs/apps/upgrading [ 1. App-scoped User IDs Facebook will begin to issue app-scoped user IDs when people first log into an instance of your app coded against v2.0 of the API. With app-scoped IDs, the ID for the same user will be different between apps. ] So how to do chat with the facebook user using app scoped Id even though we get permission from the user to chat??? For the user "10000xxxxxxxxx" i get the app scoped ID "764965xxxxxxxxxx". These are the JSON data which i get when user accepts my request for chatting. { "id": "7649xxxxxxx", "bio": "....", "email": "xxxxxxxxx\u0040gmail.com", "first_name": "xxxxxxxxxxx", "gender": "male", "last_name": "xxxxxxxx", "link": "facebook.com/app_scoped_user_id/7649xxxxxxxx/", "locale": "en_US", "name": "xxxxxxxxxxx", "timezone": 5.5, "updated_time": "2014-06-07T06:49:04+0000", "verified": true } Kindly do me the favour and give solutions for raising chat with app scoped ID's(any how I am not violating facebook terms, I am informing the user and with his permission i get user informations,). Thanks in advance,
type: UnansweredQuestion
tagged with: facebook
answer count: 0

http://stackoverflow.com/comment/93333973
type: AnswerComment
comment on: http://stackoverflow.com/a/40345908
type: Comment
has text: Link to the master branch (as 10.x is getting old): https://github.com/wildfly/quickstart/tree/master/ejb-remote
score: 1

http://stackoverflow.com/comment/38076504
score: 0
comment on: http://stackoverflow.com/a/24558543
type: AnswerComment
has text: OK, thats it!! This is the MAGIC I was missing ==> **list="%{@foo.bar.package.iMyStaticStuff@myStaticList}"** Now, my last question was/is where is this syntax documented? %{@class@static_var} isn't something I'd be able to guess... :) Thanks!
type: Comment

http://stackoverflow.com/comment/38060163
type: Comment
has text: @stripybadger Making it into a json object is easy, but I need to send a string of this type to server with escaped quotes. Getting back such a string from JSONObject will be a pain I think
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24570807

http://stackoverflow.com/a/24465618
has comment: http://stackoverflow.com/comment/37863973
has body: Please refer to http://www.oracle.com/technetwork/java/javamail/faq/index.html#installcert which states: Q: When connecting to my mail server over SSL I get an exception like "unable to find valid certification path to requested target". A: Your server is probably using a test certificate or self-signed certificate instead of a certificate signed by a commercial Certificate Authority. You'll need to install the server's certificate into your trust store. The InstallCert program will help. Alternatively, you can set the "mail.protocol.ssl.trust" property to the host name of your mail server. See the javadocs for the protocol provider packages for details. Other common causes of this problem are: There's a firewall or anti-virus program intercepting your request. There's something wrong in your JDK installation preventing it from finding the certificates for the trusted certificate authorities. You're running in an application server that has overridden the JDK's list of trusted certificate authorities. As you're connecting to Gmail which should have all the needed certificates present in the default truststore, the cause could likely be an anti-virus blocking your SMTP calls.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37863753
score: 2
answers question: http://stackoverflow.com/q/24465235
upvote count: 2
has comment: http://stackoverflow.com/comment/37863796
has comment: http://stackoverflow.com/comment/37864832

http://stackoverflow.com/comment/38039870
has text: How do you know the type of name is String. In my case I will not know that and hence I cant call getString. For example one row will be James,25,10/10/1988 - How will I know that first one is String next is int and third is date...The number of columns is configurable and it can vary... I may know the column name and type..
comment on: http://stackoverflow.com/a/24554681
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24504070
score: 3
type: Answer
has body: If you need just to highlight one word you don't need all the addHighlight() and removeHighlight() calls. Just figure out the word's offset (and length) and use setSelectionStart()/setSelectionEnd() method of the JTextPane passing the word start and start + length UPDATE as requested the working code import javax.swing.text.*; import java.awt.*; public class FindAWord extends javax.swing.JFrame { public static void main(String args[]) { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) { ex.printStackTrace(); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new FindAWord().setVisible(true); } }); } Highlighter.HighlightPainter myHighLightPainter=new FindAWord.MyHighightPainter(Color.LIGHT_GRAY); // Variables declaration - do not modify private javax.swing.JScrollPane scrollPane; private javax.swing.JTextField searchText; private javax.swing.JTextPane textPane; private javax.swing.JButton search; public FindAWord() { initComponents(); } public void highLight(JTextComponent component,String patteren){ try { Document doc=component.getDocument(); String text=component.getText(0,doc.getLength()); int pos=component.getCaretPosition(); if (pos==doc.getLength()) { pos=0; } int index=text.toUpperCase().indexOf(patteren.toUpperCase(),pos); if (index&gt;=0) { component.setSelectionStart(index); component.setSelectionEnd(index+patteren.length()); component.getCaret().setSelectionVisible(true);…
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24503954
accepted answer of: http://stackoverflow.com/q/24503954

http://stackoverflow.com/comment/37815077
score: 0
type: Comment
has text: please remove the -1, you may use URL.getFile()
comment on: http://stackoverflow.com/a/24438962
type: AnswerComment

http://stackoverflow.com/comment/37809844
score: 0
comment on: http://stackoverflow.com/a/24436621
has text: No, this will not work like you think. We need input.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24553621
score: -7
has comment: http://stackoverflow.com/comment/38027275
has title: Calling CMD command through JAVA
answer count: 1
has body: I have a method called taskkill() written in java. I want to implement the cmd command taskkill in the selected field (as shown). I don't know how to apply this command in java. Please help. public static Timer taskkill() { TimerTask timerTask = new TimerTask() { @Override public void run() { // TO APPLY CMD COMMAND [ TASKKILL /F /FI "WINDOWTITLE ne File1" /FI "WINDOWTITLE ne File2" ] } }; Timer timer = new Timer("MyTimer"); //create a new Timer timer.scheduleAtFixedRate(timerTask, 30, 10000); //this line starts the timer at the same time its executed return timer;
tagged with: cmd
tagged with: taskkill
has answer: http://stackoverflow.com/a/24553703
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38032786
tagged with: java
downvote count: 7
type: Question
linked to: http://stackoverflow.com/q/24545819
has comment: http://stackoverflow.com/comment/38027183

http://stackoverflow.com/comment/38041055
score: 0
type: Comment
type: QuestionComment
has text: @OleKristianMøller-Hansen `Found` is not set to the index `i` but to the value in the `ConnectionCount` array at the index `i`. How this value in the `ConnectionCount` array is set or updated is not shown in the code you posted.
comment on: http://stackoverflow.com/q/24559843

http://stackoverflow.com/comment/37990915
comment on: http://stackoverflow.com/q/24533493
has text: A valid question but as this is only a simple demo application, I'm not really concerned with concurrency issues. bookId is the key anyway so that should never change.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24580720
has comment: http://stackoverflow.com/comment/38078104
linked to: http://stackoverflow.com/q/2971315
has body: if stringBuffer &amp; StringBuilder are much usefull over String, why String class is not depreciated
has answer: http://stackoverflow.com/a/24580789
upvote count: 0
has comment: http://stackoverflow.com/comment/38078148
tagged with: java
has comment: http://stackoverflow.com/comment/38078198
type: Question
has answer: http://stackoverflow.com/a/24580753
answer count: 2
downvote count: 7
score: -7
tagged with: string
has comment: http://stackoverflow.com/comment/38078183
favorite count: 0
has title: In what cases String is usefull than StringBuffer & StringBuilder
duplicate of: http://stackoverflow.com/q/2971315
type: UnansweredQuestion

http://stackoverflow.com/comment/37921399
comment on: http://stackoverflow.com/q/24494543
has text: The GET version is working fine, as far as i can tell the ajax call is being posted to the same url i added a console.log to the url variable and its as it should be /ProjectPortfolioTracker/app/projects/createProject
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24471109
has answer: http://stackoverflow.com/a/37243390
has comment: http://stackoverflow.com/comment/100406632
has answer: http://stackoverflow.com/a/43104544
has answer: http://stackoverflow.com/a/44539557
tagged with: onclick
possible better answer: http://stackoverflow.com/a/26196831
has title: RecyclerView onClick
tagged with: java
has answer: http://stackoverflow.com/a/26826692
has answer: http://stackoverflow.com/a/31899338
has answer: http://stackoverflow.com/a/54705414
has answer: http://stackoverflow.com/a/60183045
has answer: http://stackoverflow.com/a/27270887
has answer: http://stackoverflow.com/a/31562573
has answer: http://stackoverflow.com/a/32410966
has answer: http://stackoverflow.com/a/56520924
has answer: http://stackoverflow.com/a/31490598
type: Question
has answer: http://stackoverflow.com/a/31941289
has answer: http://stackoverflow.com/a/26553536
has answer: http://stackoverflow.com/a/56580557
has answer: http://stackoverflow.com/a/56922155
has answer: http://stackoverflow.com/a/59371495
has comment: http://stackoverflow.com/comment/48417277
has answer: http://stackoverflow.com/a/58836873
upvote count: 680
has answer: http://stackoverflow.com/a/51608201
has answer: http://stackoverflow.com/a/54365722
has answer: http://stackoverflow.com/a/24471410
accepted answer: http://stackoverflow.com/a/24471410
favorite count: 0
has answer: http://stackoverflow.com/a/30382415
has answer: http://stackoverflow.com/a/32051054
has answer: http://stackoverflow.com/a/27712009
has answer: http://stackoverflow.com/a/63431273
linked to: http://stackoverflow.com/q/57068321
has answer: http://stackoverflow.com/a/26196831
has answer: http://stackoverflow.com/a/32985479
tagged with: android
has answer: http://stackoverflow.com/a/31671289
has answer: http://stackoverflow.com/a/28304164
has answer: http://stackoverflow.com/a/74769006
answer count: 49
has answer: http://stackoverflow.com/a/49194472
has answer: http://stackoverflow.com/a/42018980
has comment: http://stackoverflow.com/comment/78004035
has body: Has anyone using RecyclerView found a way to set an onClickListener to items in the RecyclerView? I thought of setting a listener to each of the layouts for each item but that seems a little too much hassle I'm sure there is a way for the RecyclerView to listen for the onClick event but I can't quite figure it out.
has answer: http://stackoverflow.com/a/26701352
has answer: http://stackoverflow.com/a/35937137
has answer: http://stackoverflow.com/a/26597650
has comment: http://stackoverflow.com/comment/43728230
has comment: http://stackoverflow.com/comment/65791102
has answer: http://stackoverflow.com/a/24931398
has comment: http://stackoverflow.com/comment/92505002
has answer: http://stackoverflow.com/a/33031936
has answer: http://stackoverflow.com/a/24746411
tagged with: onclicklistener
linked to: http://stackoverflow.com/q/24562744
has answer: http://stackoverflow.com/a/44177077
has answer: http://stackoverflow.com/a/53427849
downvote count: 2
has answer: http://stackoverflow.com/a/61311576
has answer: http://stackoverflow.com/a/31908459
linked to: http://stackoverflow.com/q/37786796
score: 678
has answer: http://stackoverflow.com/a/31158321
has answer: http://stackoverflow.com/a/43889536
tagged with: android-recyclerview
has answer: http://stackoverflow.com/a/27717705
has answer: http://stackoverflow.com/a/26940812
has answer: http://stackoverflow.com/a/37846392
has answer: http://stackoverflow.com/a/30612284
has answer: http://stackoverflow.com/a/38090900
type: AnsweredQuestion

http://stackoverflow.com/q/24439799
downvote count: 0
has comment: http://stackoverflow.com/comment/37818380
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37816470
has title: Parse.com Android Images not showing on actual device. Shows on emulator
has body: I am making an app in Android Studio using Parse SDK. When I run the device on the emulator, its works fine. On the actual device, it will not show the images. Here's is the code: public class ImageLoader { MemoryCache memoryCache = new MemoryCache(); FileCache fileCache; private Map&lt;ImageView, String&gt; imageViews = Collections .synchronizedMap(new WeakHashMap&lt;ImageView, String&gt;()); ExecutorService executorService; // Handler to display images in UI thread Handler handler = new Handler(); public ImageLoader(Context context) { fileCache = new FileCache(context); executorService = Executors.newFixedThreadPool(5); } final int stub_id = R.drawable.ic_launcher; public void DisplayImage(String url, ImageView imageView) { imageViews.put(imageView, url); Bitmap bitmap = memoryCache.get(url); if (bitmap != null) imageView.setImageBitmap(bitmap); else { queuePhoto(url, imageView); imageView.setImageResource(stub_id); } } private void queuePhoto(String url, ImageView imageView) { PhotoToLoad p = new PhotoToLoad(url, imageView); executorService.submit(new PhotosLoader(p)); } private Bitmap getBitmap(String url) { final File f = fileCache.getFile(url); Bitmap b = decodeFile(f); if (b != null) return b; // Download Images from the Internet try { Bitmap bitmap = null; URL imageUrl = new URL(url); HttpURLConnection conn = (HttpURLConnection) imageUrl .openConnection(); conn.setConnectTimeout(30000); conn.setReadTimeout(30000); conn.setInstanceFollowRedirects(true); InputStream is = conn.getInputStream(); OutputStream os = new FileOutputStream(f); Utils.CopyStream(is, os); os.close(); conn.disconnect(); bitmap = decodeFile(f); return bitmap; } catch (Throwable ex) { ex.printStackTrace(); if (ex instanceof OutOfMemoryError) memoryCache.clear(); return null; } } // Decodes image and scales it to reduce memory consumption private Bitmap decodeFile(File f) { try { // Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; FileInpu…

http://stackoverflow.com/comment/37979856
type: AnswerComment
comment on: http://stackoverflow.com/a/24512043
score: 0
type: Comment
has text: Thank you very much. It is working now. Also thanks for your layout manager advice

http://stackoverflow.com/comment/38052500
comment on: http://stackoverflow.com/q/24566760
has text: Note that you should generally prefer `StringBuilder` to `StringBuffer`, as the latter is unnecessarily synchronized.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24562975
has answer: http://stackoverflow.com/a/26111549
tagged with: lambda
upvote count: 11
has answer: http://stackoverflow.com/a/76814874
score: 11
has title: Hibernate and java 8 lambda's
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38062398
accepted answer: http://stackoverflow.com/a/26111549
possible better answer: http://stackoverflow.com/a/76814874
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
downvote count: 0
has body: Since the introduction of Java 8, is Hibernate waiting some changes? specially Is there any way to write queries with lambdas in Hibernate? (i.e. like a .net Linq-to-SQL style) If not, when it's coming (If it's planned to come). for example something like these: User u1 = dbo.Users.firstOrDefault(f -&gt; f.userId = 10); List&lt;User&gt; users = dbo.Users.selectMany(w -&gt; w.userId &gt; 5);
favorite count: 0
has comment: http://stackoverflow.com/comment/39263719

http://stackoverflow.com/a/72537236
has comment: http://stackoverflow.com/comment/128137663
answers question: http://stackoverflow.com/q/24539026
score: 0
has body: dont work for me to exit cmd from java i have come with a solution i added "exit" in my .bat file at the end and it works now example : this is my "adservice.google.com.bat" bat file which dont exit after executing from java netsh advfirewall firewall add rule name="adservice.google.com.bat" protocol=any dir=out action=block remoteip=2404:6800:4009:80f::2002,216.58.203.34 so i have to add "exit" in it , in the last line netsh advfirewall firewall add rule name="adservice.google.com.bat" protocol=any dir=out action=block remoteip=2404:6800:4009:80f::2002,216.58.203.34 exit
type: Answer

http://stackoverflow.com/a/24543830
answers question: http://stackoverflow.com/q/24543594
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24543594
has body: In Java everything needs to be in a class. When you "run" a program, you tell Java to load a class and call its main() method. In this case, the only thing the program does is display the deck, so while making a Deck class with a display() method is conceptually clearer, it might be extraneous for the present purposes. Think of DisplayDeck as a class representing not a deck of cards, but the program itself - this little program which spits out text and pretends to display a deck of cards. Java teaching code often has situations like this, e.g. a HelloWorld class. What is a HelloWorld? I don’t know, but you’ve gotta have one in order to say hello (i.e., load the class and call its main() method).

http://stackoverflow.com/a/51171212
score: 0
type: Answer
has body: You can use the jenkins-client-api project to access Jenkins from java application. It is quite standard and definitely of great help when interacting from Java application to Jenkins. https://github.com/jenkinsci/java-client-api
answers question: http://stackoverflow.com/q/24440297

http://stackoverflow.com/q/24467423
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37867212
tagged with: android-layout
tagged with: android-fragments
score: 0
has title: Android - android.view.InflateException: Binary XML file Error inflating class fragment
has comment: http://stackoverflow.com/comment/37886740
has comment: http://stackoverflow.com/comment/38019847
type: UnansweredQuestion
tagged with: android
has body: I am trying to place a fragment in my main activity(ReportFormActivity),which contains a customised listview.I want to inflate a custom layout containing 5 buttons and one spinner into it.I kEEP GETTING THE above error.Following is my complete code. public class ReportFormActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_report_form); this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //forces the activity to be displayed in landscape mode. } @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; } } public class ButtonRowFragment extends Fragment implements android.view.View.OnClickListener{ Button optionA; Button optionB; Button optionC; Button optionD; Button optionN; Spinner interactiveTaskSpinner; ListView list; ButtonAdapter adapter; public ButtonRowFragment CustomListView = null; public ArrayList&lt;ListModel&gt; CustomListViewValuesArr = new ArrayList&lt;ListModel&gt;(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //watch out here View view= inflater.inflate(R.layout.listview, container, false); CustomListView = this; setListData(); Resources res = getResources(); list = (ListView)getView().findViewById(R.id.list); adapter = new ButtonAdapter(CustomListView, CustomListViewValuesArr,res); list.setAdapter(adapter); optionA=(Button)view.findViewById(R.id.button1); optionB=(Button)view.findViewById(R.id.button2); optionC=(Button)view.findViewById(R.id.button3); optionD=(Button)view.findViewById(R.id.button4); optionN=(Button)view.findViewById(R.id.button5); optionA.setOnClickListener(this); optionB.setOnClickListener(this); optionC.setOnClickListener(this); optionD.setOnClickListener(this); optionN.setOnClickListener(this); int…
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/37983850
has text: Thanks for the help. It doesn't look like the getter methods are being used though. Also, i'm not allowed to use HTML:/ But this gave me some things to think through!
type: Comment
comment on: http://stackoverflow.com/a/24523500
type: AnswerComment
score: 0

http://stackoverflow.com/a/44802402
upvote count: 1
answers question: http://stackoverflow.com/q/24541500
downvote count: 0
type: Answer
score: 1
has body: Without regex str.substring(str.lastIndexOf("/"), str.lastIndexOf(".")).replaceAll("/", "");

http://stackoverflow.com/comment/38071883
type: QuestionComment
has text: Why is it important to you that the hashcode is the same in each invocation?
comment on: http://stackoverflow.com/q/24576793
score: 0
type: Comment

http://stackoverflow.com/q/24575507
has body: I'm using spEL 4.0.0.RELEASE to bind http parameters to java objects. I notice some strange problem while using expression parser multiple time: each invocation takes more time (constant). This happens only on java 8. On java 7 all ok. Here is example code: package ru.tersys.test; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; public class Test { public static void main(String[] args) { Test instance = new Test(); Table t = new Table(); Column c = new Column(); t.getColumns().add(c); int counter = 10; while (counter-- &gt; 0) { instance.doTest("t", t); } } ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(); public void doTest(String prefix, Object obj) { Date d = Calendar.getInstance().getTime(); int counter = 0; String el = "t.columns[0].name"; context.setVariable(prefix, obj); String prefixWithDot = prefix + "."; int count = 400; while (count -- &gt; 0) { if (el.startsWith(prefixWithDot)) { parser.parseExpression("#"+el).setValue(context, "testColumnName"); counter++; } } System.out.println("bind duration sec = " + (Calendar.getInstance().getTime().getTime() - d.getTime())/1000 + " param count = " + counter); } static class Table { public Table() { columns = new ArrayList&lt;&gt;(); } public ArrayList&lt;Column&gt; getColumns() { return columns; } public void setColumns(ArrayList&lt;Column&gt; columns) { this.columns = columns; } private ArrayList&lt;Column&gt; columns; } static class Column { public Column() { } private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } } jdk 8 output: bind duration sec = 1 param count = 400 bind duration sec = 3 param count = 400 bind duration sec = 5 param count = …
tagged with: spring-el
has answer: http://stackoverflow.com/a/24576810
has comment: http://stackoverflow.com/comment/38068943
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38069284
has comment: http://stackoverflow.com/comment/38070073
has comment: http://stackoverflow.com/comment/38068630
upvote count: 5
tagged with: spring
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38068994
downvote count: 0
has title: java 8 spring spEL repeatable binding slows each iterations
tagged with: java
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/24576810
has comment: http://stackoverflow.com/comment/38068368

http://stackoverflow.com/q/24429224
has comment: http://stackoverflow.com/comment/37796268
has answer: http://stackoverflow.com/a/24429518
accepted answer: http://stackoverflow.com/a/24429518
has answer: http://stackoverflow.com/a/24429505
has answer: http://stackoverflow.com/a/53087587
has comment: http://stackoverflow.com/comment/37796331
type: AnsweredQuestion
has title: Delete data from database using jsp
has answer: http://stackoverflow.com/a/24429640
has comment: http://stackoverflow.com/comment/37796912
type: Question
has comment: http://stackoverflow.com/comment/37796340
tagged with: java
possible better answer: http://stackoverflow.com/a/24429505
has answer: http://stackoverflow.com/a/24430070
answer count: 6
has body: I want to delete a particular record from the database. My code is given below: &lt;% String value = request.getParameter("Meter_No"); int v=Integer.parseInt(value); try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDirver"); Connection conn = DriverManager.getConnection ("jdbc:sqlserver://localhost:1433;databaseName=myDatabase; user=shakir;password=shakir123"); Statement st = conn.createStatement(); ResultSet rs =st.executeQuery("DELETE * FROM qesco_table WHERE Meter_No ="+v+""); rs.close(); conn.close(); }catch(Exception e){ System.out.print(e.getMessage()); } %&gt; But it is not deleting the data from database. Can anyone guide me that where is the problem with the code?
score: 0
has answer: http://stackoverflow.com/a/24444757
tagged with: jsp

http://stackoverflow.com/a/37846392
downvote count: 0
has comment: http://stackoverflow.com/comment/69668707
score: 3
upvote count: 3
has body: I'm aware there are a lot of answers, but I thought I might just provide my implementation of it as well. (Full details can be found on another question I answered). So, to add a click listener, your inner ViewHolder class needs to implement View.OnClickListener. This is because you will set an OnClickListener to the itemView parameter of the ViewHolder's constructor. Let me show you what I mean: public class ExampleClickViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { TextView text1, text2; ExampleClickViewHolder(View itemView) { super(itemView); // we do this because we want to check when an item has been clicked: itemView.setOnClickListener(this); // now, like before, we assign our View variables title = (TextView) itemView.findViewById(R.id.text1); subtitle = (TextView) itemView.findViewById(R.id.text2); } @Override public void onClick(View v) { // The user may not set a click listener for list items, in which case our listener // will be null, so we need to check for this if (mOnEntryClickListener != null) { mOnEntryClickListener.onEntryClick(v, getLayoutPosition()); } } } The only other things you need to add are a custom interface for your Adapter and a setter method: private OnEntryClickListener mOnEntryClickListener; public interface OnEntryClickListener { void onEntryClick(View view, int position); } public void setOnEntryClickListener(OnEntryClickListener onEntryClickListener) { mOnEntryClickListener = onEntryClickListener; } So your new, click-supporting Adapter is complete. Now, let's use it... ExampleClickAdapter clickAdapter = new ExampleClickAdapter(yourObjects); clickAdapter.setOnEntryClickListener(new ExampleClickAdapter.OnEntryClickListener() { @Override public void onEntryClick(View view, int position) { // stuff that will happen when a list item is clicked } }); It's basically how you would set up a normal Adapter, except that you use your setter method that you created to control what you will do when your user click…
answers question: http://stackoverflow.com/q/24471109
type: Answer

http://stackoverflow.com/comment/37971114
comment on: http://stackoverflow.com/q/24523474
has text: oneList.get(0); <- Do you see the issue here?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/31955497
answers question: http://stackoverflow.com/q/24573640
upvote count: 3
has body: You can try this code, for api > 19 the retrieving image differs txtlogochange.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1); } }); @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == this.RESULT_OK) { if (requestCode == 1) { if (Build.VERSION.SDK_INT &lt; 19) { Uri selectedImage = data.getData(); // System.out.println("selectedImage "+selectedImage); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); smallImagePath = cursor.getString(columnIndex); cursor.close(); System.out.println("smallImagePath" + smallImagePath); logoImg.setImageBitmap(BitmapFactory.decodeFile(smallImagePath)); encodeImage(); } else { try { InputStream imInputStream = getContentResolver().openInputStream(data.getData()); Bitmap bitmap = BitmapFactory.decodeStream(imInputStream); smallImagePath = saveGalaryImageOnLitkat(bitmap); logoImg.setImageBitmap(BitmapFactory.decodeFile(smallImagePath)); encodeImage(); } catch (FileNotFoundException e) { e.printStackTrace(); } // finishAndSetResult(RESULT_OK, picturePath, false); } } } } private File temp_path; private final int COMPRESS = 100; private String saveGalaryImageOnLitkat(Bitmap bitmap) { try { File cacheDir; if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) cacheDir = new File(Environment.getExternalStorageDirectory(), getResources().getString(R.string.app_name)); else cacheDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); if (!cacheDir.exists()) cacheDir.mkdirs(); String filename = System.currentTimeMillis() + ".jpg"; File file = new File(cacheDir, filename); t…
has comment: http://stackoverflow.com/comment/88493742
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/a/24449911
score: 3
has body: The compiler is quite dump. It probably cannot know that DatabaseConnectionPool.freeConnection(conn) will call close on the conn. I am not sure why the second example does not trigger this warning, but probably the feature is just not totally perfect and can yield false negatives. Basically, any resource should be closed by calling its close method directly at the place where the resource is acquired; this is the only way the compiler can figure out that you want to close it, it does not to inter-procedural analysis to check if a called function calls close. With java7, you should consider using the try-with-resource statement; it is the encouraged way to handle any resources, i.e.: try(Connection conn = ...){ // Do something with conn // No close necessary here, done implicitly by the try statement } Your whole pattern of closing a connection by calling a method other than close seems flawed to me (it works, but I would strongly discourage its usage): Any resource should be able to close itself by calling close. If your resource requires DatabaseConnectionPool.freeConnection to be called to close it, you are violating java's resource contract. If you use the try-with-resource statement, you have no choice anyway: The statement will call close and not your method.
has comment: http://stackoverflow.com/comment/37834670
has comment: http://stackoverflow.com/comment/37841113
has comment: http://stackoverflow.com/comment/37834858
downvote count: 1
has comment: http://stackoverflow.com/comment/37834890
upvote count: 4
has comment: http://stackoverflow.com/comment/37834787
has comment: http://stackoverflow.com/comment/37834497
has comment: http://stackoverflow.com/comment/37834534
answers question: http://stackoverflow.com/q/24449674
has comment: http://stackoverflow.com/comment/37836326
has comment: http://stackoverflow.com/comment/37840689
type: Answer

http://stackoverflow.com/comment/37952886
comment on: http://stackoverflow.com/a/24513697
type: AnswerComment
score: 0
has text: You can use `getMeasuredHeight()` and `getMeasuredWidth()`. I'm not sure about the top and left.
type: Comment

http://stackoverflow.com/comment/38104829
type: AnswerComment
comment on: http://stackoverflow.com/a/24576934
has text: Yes you can apply constraints. See http://grails.org/doc/latest/guide/theWebLayer.html#applyingConstraints
type: Comment
score: 1

http://stackoverflow.com/comment/37962413
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24518662
score: 1
has text: "Your question is still not clear"

http://stackoverflow.com/a/24544310
has body: APK is not just a format is a compression format, meaning that the apk is already compressed, you need not do another compression type. So I recommend not find another way, there are games that weigh up to 200 MB and it is normal to be a game. A normal app can use 1-5 mb. I think a 1mb is acceptable.
answers question: http://stackoverflow.com/q/24542664
type: Answer
score: 0

http://stackoverflow.com/comment/38423761
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24518122
has text: Why are you trying to receive from `inboundFileChannel`? It's no longer a `PollableChannel` and, in any case, it has a subscriber (the transformer). If you change it back to a queue channel, and put a poller on the transformer it will work, but your `main` will likely steal the message and it won't go to the transformer or launch the job.
type: AnswerComment

http://stackoverflow.com/q/24488581
score: 0
has comment: http://stackoverflow.com/comment/37911441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37907472
has answer: http://stackoverflow.com/a/24489163
has comment: http://stackoverflow.com/comment/37907710
has comment: http://stackoverflow.com/comment/37907354
has comment: http://stackoverflow.com/comment/37909756
tagged with: java
has comment: http://stackoverflow.com/comment/37907790
has comment: http://stackoverflow.com/comment/37907101
type: Question
has title: ResultSetMetaData getTableName return empty String
answer count: 1
has body: I am trying to get TableName from ResultSetMetaData by following code Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@localhost:1521:orcl"; conn = DriverManager.getConnection(url,"releaseUN", "releasepw"); Statement stmt = conn.createStatement(); String qry = ""; qry = " SELECT * FROM MyTable "; ResultSet rset = stmt.executeQuery(qry); ResultSetMetaData md = rset.getMetaData(); int col = md.getColumnCount(); for (int i = 1; i <= col; i++) { System.out.println("getTableName "+ md.getTableName(i)); } But it returns Empty String I used ojdbc14.jar to connect to Oracle Database by jdbc connectivity Actually i want Table Name for each selected column in the given query.
has comment: http://stackoverflow.com/comment/37907859
has comment: http://stackoverflow.com/comment/37908196

http://stackoverflow.com/q/24456524
tagged with: java
has answer: http://stackoverflow.com/a/24456595
tagged with: switch-statement
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37847297
has comment: http://stackoverflow.com/comment/37847242
type: UnansweredQuestion
has title: Switch default execution after return statement
tagged with: android
has body: I'm using the following code block, and the bizarre issue that's happening is even though (I've confirmed this with breakpoints) the first case is hit, AND contains a return statement, the default is also hit: switch (sortType) { case RATING: return values.get(position - 1).getRating() != values.get(position).getRating(); case GRAPE: return !values.get(position - 1).getGrape().equals(values.get(position).getGrape()); case REGION: return !values.get(position - 1).getRegion().equals(values.get(position).getRegion()); default: return !values.get(position - 1).getGrape().equals(values.get(position).getGrape()); } When the default block is running, the sortType is RATING. From what I understand, the return in the first case should prevent the default from getting run. Is that correct?

http://stackoverflow.com/comment/38034757
comment on: http://stackoverflow.com/q/24555845
score: 0
type: Comment
type: QuestionComment
has text: I suggest you to read something about spring [Spring Framework Reference Documentation](http://docs.spring.io/spring/docs/4.1.0.BUILD-SNAPSHOT/spring-framework-reference/htmlsingle/) before start to work

fxml
tags question: http://stackoverflow.com/q/24430121
tags question: http://stackoverflow.com/q/24472170
tags question: http://stackoverflow.com/q/24458155
tags question: http://stackoverflow.com/q/24445252
tags question: http://stackoverflow.com/q/24517571
tag name: fxml
tags question: http://stackoverflow.com/q/24429809
tags question: http://stackoverflow.com/q/24506396
type: Tag

http://stackoverflow.com/q/24436921
has answer: http://stackoverflow.com/a/24440060
answer count: 1
tagged with: apache-felix
has title: OSGi to solve pluggable architecture
tagged with: osgi
type: UnansweredQuestion
tagged with: java
has body: I have a Java app (that should deploy as an executable JAR) that takes a JSON file as input, something like this: "appConfig": { "fizzClass": "com.me.myorg.FizzImpl" // Lots of other configs } The config allows a user to specify what fizzClass to use (for something, doesn't really matter what) at runtime. The thing is, I want this app to accept plugins; that is, I can (dynamically, at runtime) add JARs to the app, where perhaps other Fizz implementations may be packaged, and then the user can specify these newly-available impls in their config files. For instance, perhaps my app only has public class FizzImpl implements Fizz in it. Now let's say someone develops a plugin, foo-plugin.jar that contains public class FooFizz implements Fizz. Now, after deployed as a plugin to my app, an end user could pass the app the following config: "appConfig": { "fizzClass": "com.some.other.foo.FooFizz" // Lots of other configs } ...without getting ClassNotFoundExceptions, etc. Because now FooFizz is on the app's runtime classpath. OSGi feels like the perfect solution for this. I'm trying to understand Apache Felix's architecture. My understanding is that I deploy my app as a JAR but include the Felix JAR as a dependency to it, which gives me access to a plugin architecture. I then have to require that plugin developers package their JARs as OSGi bundles. So first, if anything about those statements is mis-led or incorrect, please begin by correcting my understanding of how a Java JAR taps into the Felix OSGi runtime! Assuming I'm more or less correct in my understanding, my question is: in order to develop plugins for my app, do I just follow the normal instructions for packaging bundles, or is there a special "trick" to tapping into Felix's plugin architecture?
tagged with: modularity
linked to: http://stackoverflow.com/q/24411334
type: Question
score: 0

http://stackoverflow.com/comment/37814135
score: 2
type: AnswerComment
type: Comment
has text: I did the same (standalone Android SDK Manager) and got exactly to the point 'greywolf82' is complaining about. Your answer is not the solution.
comment on: http://stackoverflow.com/a/24438136

http://stackoverflow.com/comment/37838391
type: QuestionComment
score: 2
has text: I strongly suspect you have multiple Spring versions on your classpath. Perhaps you have both Spring 4 and Spring 3 versions, since Spring 4 does not contain the method `ClassUtils.forName(String name)`
comment on: http://stackoverflow.com/q/24451726
type: Comment

http://stackoverflow.com/q/24582507
score: 0
has body: I wonder why the double quotation marks is not shown in the actual output - just after the equal sign: String word = "" + c1 + c2 + "ll"; The full code as follows: public class InstantMethodsIndexOf { public void start() { String greeting = new String ("Hello World"); int position = greeting.indexOf('r'); char c1 = greeting.charAt(position + 2); char c2 = greeting.charAt(position - 1); **String word = "" + c1 + c2 + "ll";** System.out.println(word); } }
has answer: http://stackoverflow.com/a/24582538
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24582554
has answer: http://stackoverflow.com/a/24582522
has answer: http://stackoverflow.com/a/24582516
tagged with: java
has comment: http://stackoverflow.com/comment/38081396
has answer: http://stackoverflow.com/a/24582535
has answer: http://stackoverflow.com/a/24582521
upvote count: 1
has title: What does this quotation marks represent in System.out.println()?
downvote count: 1
type: Question
answer count: 6

http://stackoverflow.com/a/24547212
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24547012
type: Answer
answers question: http://stackoverflow.com/q/24547012
has comment: http://stackoverflow.com/comment/38029209
upvote count: 1
has comment: http://stackoverflow.com/comment/38029492
has body: This seems okay to me. If all your different actors there have the same behaviour and are only different in their used texture, size, position etc, then having a single SRActor with different attributes seems appropriate. However I would advice you to use the static factory pattern and move the generation to another class. So you would only do stage.addActor(SRActorFactory.createOptionButton()) for example.
type: AcceptedAnswer

http://stackoverflow.com/comment/37955082
comment on: http://stackoverflow.com/q/24453695
has text: The default value "./conf/cassandra.yaml" is specific to 0.5.0-M1. 0.4.4 had "./config/cassandra.yaml". Assuming you're still using 0.5.0-M1, try replacing storage.cassandra-config-dir with storage.conf-file (the option was renamed between 0.4.4 and 0.5.0-M1). Right now it looks like you're using a config intended for 0.4.4 and getting an error suggesting 0.5.0-M1 is in use.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/38040094
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24560134
score: 1
has text: Does the create method commits the changes made? If not, I would suggest a forced commit so that the changes take effect.

http://stackoverflow.com/q/24485594
has answer: http://stackoverflow.com/a/24485629
type: AnsweredQuestion
tagged with: memory-management
score: 1
tagged with: java
has title: When are strings different objects in Java?
upvote count: 1
has answer: http://stackoverflow.com/a/24487497
has answer: http://stackoverflow.com/a/24485857
type: Question
linked to: http://stackoverflow.com/q/2009228
downvote count: 0
has answer: http://stackoverflow.com/a/24485627
has answer: http://stackoverflow.com/a/24485633
linked to: http://stackoverflow.com/q/2721998
linked to: http://stackoverflow.com/q/1552301
has comment: http://stackoverflow.com/comment/37905136
possible better answer: http://stackoverflow.com/a/24485653
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/24485653
tagged with: string-comparison
answer count: 7
linked to: http://stackoverflow.com/q/17018250
tagged with: string
has answer: http://stackoverflow.com/a/24485686
favorite count: 0
has comment: http://stackoverflow.com/comment/37901948
has body: I recently learned that in Java: == compares the object references, not the content, which is why: String str1 = "hell"; String str2 = "o"; String str3 = str1 + str2; String str4 = "hello"; str3 == str4; // False So far so good. However when I do the following: String str5 = "hello"; str5 == str4; // True Does this mean that str5 and str4 reference the same memory object? How does this work?
accepted answer: http://stackoverflow.com/a/24485633

http://stackoverflow.com/comment/37891223
type: QuestionComment
comment on: http://stackoverflow.com/q/24458575
score: 0
type: Comment
has text: No problem, it's a strange one alright. I think you should [log an issue](https://github.com/wordnik/swagger-core/tree/master/modules/swagger-play2) with Swagger. The example they provide doesn't seem to work anymore.

http://stackoverflow.com/comment/48186244
has text: Do you mean something like `FlowLayout`?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24492671
type: AnswerComment

getselection
tags question: http://stackoverflow.com/q/24561855
type: Tag
tag name: getselection

http://stackoverflow.com/q/24472433
type: Question
has comment: http://stackoverflow.com/comment/37879977
has comment: http://stackoverflow.com/comment/37879146
score: 0
tagged with: android
has body: I am trying to move an image around the screen but sometimes the image either appears half off the screen or completely off. My code looks like: width = image.getWidth(); height = image.getHeight(); main = (RelativeLayout) findViewById(R.id.mainLayout); screenWidth = main.getWidth(); screenHeight = main.getHeight(); xCalc = screenWidth - width; yCalc = screenHeight - height; imageParams = (RelativeLayout.LayoutParams) image.getLayoutParams(); Random rand = new Random(); xValue = (int) (rand.nextFloat() * xCalc); yValue = (int) (rand.nextFloat() * yCalc); imageParams.setMargins(xValue, yValue, 0, 0); image.setLayoutParams(dotParams);
answer count: 0
has title: Image appears off screen android
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/37909822
comment on: http://stackoverflow.com/a/24490004
score: 0
type: AnswerComment
has text: import java.awt.*; import javax.swing.*; import java.awt.event.*; are my headers and addWindowListener(new ExitListener()); is the code. I assume ExitListener is in the default package.
type: Comment

gmail
type: Tag
tags question: http://stackoverflow.com/q/24543108
tags question: http://stackoverflow.com/q/24536168
tag name: gmail
tags question: http://stackoverflow.com/q/24465235
tags question: http://stackoverflow.com/q/24484970

http://stackoverflow.com/a/24573018
has body: When you run the command logcat it doesn't stop, it keeps running unless you ask it stop (Ctrl + C). You need to use logcat dump so that it dumps the logcat and stops. logcat -d This will dump the current contents of the logcat and finish once done. Edit: This wont work from the devise without root permissions anymore, starting from Jellybean.
type: Answer
has comment: http://stackoverflow.com/comment/38063519
answers question: http://stackoverflow.com/q/24572821
has comment: http://stackoverflow.com/comment/38063832
has comment: http://stackoverflow.com/comment/38065892
has comment: http://stackoverflow.com/comment/38065047
has comment: http://stackoverflow.com/comment/38065599
score: 0
has comment: http://stackoverflow.com/comment/38065981

http://stackoverflow.com/q/24517833
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37960842
has title: write a java program to read in a maximum of 100 test grade?
favorite count: 0
has comment: http://stackoverflow.com/comment/37960701
has body: I have to write a java program that reads in a maximum of 100 test grades. I have to calculate mean, standard deviation, highest grade, lowest grade, median, mode, and range! but the catch is i have to read and sort numbers from a file into a array these numbers are numbers.dat:43,98,82,57,78,63,88,26,91,76,75,67,49,77,83,72,69,84,65,73,78,89,46,76,66,87, ,22,45,85,92,88,55,89,77,78,67,99,63,68,71,79,82,68,70, these are all the numbers! so far im having a problem reading through the file and sorting the array,that seems to be my main problem as of now Here is what i have so far: import java.io.*; import java.util.*; public class Prog7{ public static void main(String[] args)throws Exception{ File fin = new File("numbers.dat"); Scanner input = new Scanner(fin); double[] grades = new double[45]; //read and sort through array for(int i = 0; i &lt; grades.length - 1; i++){ grades[i] = input.nextDouble(); double currentMin = grades[i]; int currentMinIndex = i; for(int j = i + 1; j &lt; grades.length; j++){ if(currentMin &gt; grades[j]){ currentMin = grades[j]; currentMinIndex = j; } } if(currentMinIndex != i){ grades[currentMindIndex] = grades[i]; grades[i] = currentMin; } }//all of my print statements will go here! }//calculate the mean public static double mean(double[] grades){ double sum = 0; for(int i = 0; i &lt; grades.length; i++){ sum += grades[i]; } return sum/grades.length; }//calculate the median public static double median(double[] grades){ int middle = grades.length/2; if(grades.length%2==1){ return grades[middle]; }else{ return(grades[middle-1] + grades[middle])/2.0; } }//calculate the mode public static double mode(double grades){ int maxValue, maxCount; for(int i = 0; i &lt; grades.length; ++i){ int count = 0; for(int j = 0; j &lt; grades.length; ++j){ if(grades[j] == grades[i]) ++count; } if(count &gt; maxCount){ maxCount = count; maxValue = grades[i]; } } return maxValue; }//calculate the range public static double range(double[] grades){ double intMin =…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37960702
has answer: http://stackoverflow.com/a/24517931
has comment: http://stackoverflow.com/comment/37960756
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/37960713
type: Question
has comment: http://stackoverflow.com/comment/37960692
has comment: http://stackoverflow.com/comment/37960714
downvote count: 4

http://stackoverflow.com/q/24510019
type: Question
tagged with: java
has body: i have the next code: // Load the JDK's cacerts keystore file String filename = System.getProperty("java.home") + "/lib/security/cacerts".replace('/', File.separatorChar); FileInputStream is = new FileInputStream(filename); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); String password = "changeit"; keystore.load(is, password.toCharArray()); // This class retrieves the most-trusted CAs from the keystore PKIXParameters params = new PKIXParameters(keystore); // Get the set of trust anchors, which contain the most-trusted CA certificates Iterator it = params.getTrustAnchors().iterator(); while( it.hasNext() ) { TrustAnchor ta = (TrustAnchor)it.next(); // Get certificate X509Certificate cert = ta.getTrustedCert(); System.out.println(cert); } with this i have the list of trust root certifications but i want the list of the client certifications, the certifications that you can find in internet explorer. Can someone help me? Thanks!
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24510435
has title: How to get list of client certificates using java?
tagged with: x509

http://stackoverflow.com/a/24436630
has comment: http://stackoverflow.com/comment/37810782
score: 1
has body: Re-read the line in the loop (also use an AND not an OR nothing is both "Yes" and "No" or an the simpler infinite loop and break), also - I would use another variable Ans and ans are too similar for my tastes, Additionally, note that I'm testing your strings independent of case (I assume "yes" and "YES" should also work). Finally, no semicolon after while and before the open bracket (that makes an empty loop) - String response = ans.nextLine(); while (true) { if (response.equalsIgnoreCase("Yes")){ System.out.println("Woof :-)"); break; }else if(response.equalsIgnoreCase("No")){ System.out.println("Grrrr :-("); break; }else{ System.out.println("What? Please try again."); response = ans.nextLine(); } }
has comment: http://stackoverflow.com/comment/37811655
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37811594
answers question: http://stackoverflow.com/q/24436562
type: Answer
has comment: http://stackoverflow.com/comment/37810902
accepted answer of: http://stackoverflow.com/q/24436562
upvote count: 1

http://stackoverflow.com/comment/37999959
score: 1
comment on: http://stackoverflow.com/q/24538731
has text: @user3798867 check this link http://stackoverflow.com/a/3626033/3469370 To this method you can pass your Service or Activity
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24536513
has body: I think the appropriate way (although alot more work) is to test all the options. Use a profiler to see how much time it takes your code to perform the lookups and then go with the process that yields the best results. Without using a profiler, it is very hard to determine improvements in performance.
upvote count: 1
has comment: http://stackoverflow.com/comment/37995865
has comment: http://stackoverflow.com/comment/37995696
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24536316
type: Answer

http://stackoverflow.com/comment/38042579
comment on: http://stackoverflow.com/a/24561536
has text: Your `getFromStash` is logically equivalent to mine if in my version you imagine `lock` is replaced by `this`. I guess I didn't explain this very well. What I mean is that a synchronized method is equivalent to a method whose whole body is synchronized on `this`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37959621
comment on: http://stackoverflow.com/q/24517251
score: 0
has text: the following N integers are separated just by a single space " "
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24512662
has comment: http://stackoverflow.com/comment/38030794
has body: I'm geting an strange error, when i lunch my app on 4.0+ devices i got a crush when i search my videos, when i'm using it on 2.3 its all ok. This its an Youtube search/player. Here's my error: 07-01 17:30:21.324: E/AndroidRuntime(23429): FATAL EXCEPTION: main 07-01 17:30:21.324: E/AndroidRuntime(23429): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.searcher1/com.example.searcher1.JsonParsingActivity}: java.lang.NullPointerException 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2225) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.app.ActivityThread.access$600(ActivityThread.java:151) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1301) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.os.Handler.dispatchMessage(Handler.java:99) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.os.Looper.loop(Looper.java:153) 07-01 17:30:21.324: E/AndroidRuntime(23429): at android.app.ActivityThread.main(ActivityThread.java:5070) 07-01 17:30:21.324: E/AndroidRuntime(23429): at java.lang.reflect.Method.invokeNative(Native Method) 07-01 17:30:21.324: E/AndroidRuntime(23429): at java.lang.reflect.Method.invoke(Method.java:511) 07-01 17:30:21.324: E/AndroidRuntime(23429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790) 07-01 17:30:21.324: E/AndroidRuntime(23429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 07-01 17:30:21.324: E/AndroidRuntime(23429): at dalvik.system.NativeStart.main(Native Method) 07-01 17:30:21.324: E/AndroidRuntime(23429): Caused by: java.lang.NullPointerException 07-01 17:30:21.324: E/AndroidRuntime(23429): at com.example.searcher1.JsonParsingActivity.onCreate(JsonParsingActivity.java:78) 07-01 17:30:21.324: …
has answer: http://stackoverflow.com/a/24608498
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37950909
tagged with: java
accepted answer: http://stackoverflow.com/a/24608498
has comment: http://stackoverflow.com/comment/37952092
type: Question
has title: Error when using app on 4.0 devices Json exception
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/37950800
has comment: http://stackoverflow.com/comment/37956961
has comment: http://stackoverflow.com/comment/37972963
tagged with: android
has comment: http://stackoverflow.com/comment/37951047

http://stackoverflow.com/comment/37901818
type: AnswerComment
score: 0
has text: Problem because I didn't understand fileset tag of build.xml
type: Comment
comment on: http://stackoverflow.com/a/24485250

http://stackoverflow.com/q/24428014
type: UnansweredQuestion
tagged with: call
has answer: http://stackoverflow.com/a/24428189
has comment: http://stackoverflow.com/comment/37794103
tagged with: java
has title: Catch the current executed method Eclipse Java
tagged with: methods
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/37795409
tagged with: eclipse
score: 0
has body: I have an application that was written by another guy and I have to add function there. The code is pretty complex to simply look for a method I need to change. So I wanted to ask if there is a possibility to debug the application and catch on the run what method is currently called,concrete: I want to open a graphical editor in application, add an object in this editor and get the trace of methods that are being executed during adding the object without knowing anything about the application code. Is there any possibility for that? Practically I want to know what methods are executed by JVM Thank for your help, Jeff
answer count: 1

http://stackoverflow.com/comment/37983074
type: AnswerComment
comment on: http://stackoverflow.com/a/24528214
type: Comment
has text: I am trying to workout where your "startTimestamp" is coming from? do you initialize it with the current time or did you mean something else?
score: 0

http://stackoverflow.com/comment/37853561
comment on: http://stackoverflow.com/q/24459997
type: QuestionComment
type: Comment
has text: @Evorlor Java does not have global variables. Having a variable at the class level is normal practice (as long as the variable "belongs" to the class)
score: 1

http://stackoverflow.com/comment/37970802
type: QuestionComment
score: 2
has text: My Objective C is pretty basic, but as I understand it, you can "ask" that a method be executed on a given instance of an object, this does not guarantee that the execution will occur. This is a lot like trying to do reflection calls in Java against unknown objects
type: Comment
comment on: http://stackoverflow.com/q/24523342

http://stackoverflow.com/comment/38001896
comment on: http://stackoverflow.com/a/24536331
score: 0
type: AnswerComment
has text: Our old installer we had the .exe launch method (and unfortunately the XML files all vanished from our server so long ago that they're no longer on any existing backups, hence why I'm having to build all new again). I'm trying to avoid that .exe launcher in this case though, since it means I have to build distinct launchers for Windows vs. the other platforms instead of just using a single .jar.
type: Comment

http://stackoverflow.com/a/24555334
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I see 2 ways : 1) Put all your monster classes in an array : MonsterType[] types = {Gnome.class, Gob.class}..., choose an index randomly to get one of thoses classes and instantiate it with Class.newInstance(); 2) Create an enum representing your monster types then choose one of its value randomly and use a switch case to build the monster depending on the monster type. The second one seems the cleaner to me.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24555086
answers question: http://stackoverflow.com/q/24555086

http://stackoverflow.com/q/24431742
possible better answer: http://stackoverflow.com/a/24432046
has answer: http://stackoverflow.com/a/24432051
score: 1
tagged with: java
tagged with: overriding
has comment: http://stackoverflow.com/comment/37801512
has title: Interfaces and dynamic method dispatch
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/37801630
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24432046
has body: Normal overriding (without the use of interfaces) class A { int x = 0; void show() { System.out.println("In A. x : " + x); } } class B extends A { void show() { System.out.println("In B. x : " + x); } } class C extends A { void show() { System.out.println("In C. x : " + x); } } class Test { public static void main(String args[]){ A obj = new B(); obj.show(); obj = new C(); obj.show(); } } This is the same as doing that with interfaces: interface A { int x = 0; void show(); } class B implements A { public void show() { System.out.println("In B. x : " + x); } } class C implements A { public void show() { System.out.println("In C. x : " + x); } } class Test { public static void main(String args[]){ A obj = new B(); obj.show(); obj = new C(); obj.show(); } } Output in both the cases will be the same and even the implementation is similar. My question is, why have interfaces when you can do the same thing by using dynamic method dispatch?
has comment: http://stackoverflow.com/comment/37801114
has answer: http://stackoverflow.com/a/24432400
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24432051
type: Question

http://stackoverflow.com/comment/37966135
has text: by doing `Collections.shuffle(Arrays.asList(deck));` you're creating new variable, shuffle it and store... nowhere, so shuffled data is lost
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24520782

http://stackoverflow.com/q/24538727
has answer: http://stackoverflow.com/a/24555830
has comment: http://stackoverflow.com/comment/38009274
type: Question
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38009300
has body: In protégé when I start the Reasoner some classes get more subclasses from the Reasoner association.... How can I get that in the owl api I try the example but gives me owl: nothing....
tagged with: owl
has title: Owl api how to get subclass from Reasoner
tagged with: owl-api
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: java
tagged with: ontology
score: -1

http://stackoverflow.com/comment/37861703
comment on: http://stackoverflow.com/a/24444391
score: 0
type: AnswerComment
has text: Seems like this is not the way they are doing it. Maybe they are checking if the resource-class or an implemented interface has a `@Path` annotation. Then they are finding two.
type: Comment

http://stackoverflow.com/q/24468593
tagged with: multithreading
linked to: http://stackoverflow.com/q/24468356
accepted answer: http://stackoverflow.com/a/24468693
type: AnsweredQuestion
tagged with: java
has title: How can data be received by a socket from a server before server flushes the data?
has comment: http://stackoverflow.com/comment/37869424
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37878501
has comment: http://stackoverflow.com/comment/37869736
has answer: http://stackoverflow.com/a/24468626
score: 0
has answer: http://stackoverflow.com/a/24468693
tagged with: sockets
possible better answer: http://stackoverflow.com/a/24468626
tagged with: synchronization
has body: So here is the code I have: public class TestClass { public static void main(String[] args) throws IOException, InterruptedException { Thread server = new Thread(new MyServer()); server.start(); Thread.sleep(750); Thread client = new Thread(new MyClient()); client.start(); } } The Server: public class MyServer implements Runnable{ public static synchronized void go() throws IOException { System.out.println("MyServer: Go called..."); ServerSocket serverSocket = new ServerSocket(5000); while(true){ Socket socket = serverSocket.accept(); System.out.println(time() + "MyServer: Connection accepted!"); OutputStream outputStream = socket.getOutputStream(); System.out.println(time() + "MyServer: socket.getOutputStream"); PrintWriter printWriter = new PrintWriter(outputStream); System.out.println(time() + "MyServer: New PrintWriter object created!"); printWriter.write("Hello from my socket!"); System.out.println(time() + "MyServer: printwriter.write method called.."); printWriter.flush(); System.out.println(time() + "MyServer: Flushed!"); printWriter.close(); System.out.println(time() + "MyServer: printWriter closed..."); } } public static String time(){ return String.valueOf(MyCounterClass.getCounter()) + " "; } @Override public void run() { try { go(); } catch (IOException e) { e.printStackTrace(); } } } The Client: public class MyClient implements Runnable { public static synchronized void go() throws IOException { Socket socket = new Socket("localhost",5000); System.out.println(time() + "My Client: Connection established..."); InputStream inputStream = socket.getInputStream(); System.out.println(time() + "MyClient: socket.getInputStream..."); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); System.out.println(time() + "MyClient: BufferedReader object created..."); System.out.println(time() + "Bufferedreader readline being called and directly printer: " + bufferedReader.readLine()); System.out.println(time() + "bufferedReader.readlin…

http://stackoverflow.com/q/24556715
has comment: http://stackoverflow.com/comment/38033149
has comment: http://stackoverflow.com/comment/38033818
score: 1
has body: Situation is we are generating a sqlite database as an output. I want to see if said database equals an expected database file. So far I have been using sqlite3 to generate dumps and then comparing the files, as suggested in this question: How to compare two sqlite databases on linux. This works well for our purposes, however I've noticed that I'm using a sqlite3 executable for linux. I am using the following code to create dumps: // call sqlite3 .dump Process p = Runtime.getRuntime().exec(executeCommand); This causes the tests to fail in a Windows environment: java.io.IOException: Cannot run program "C:\[...]": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at java.lang.Runtime.exec(Runtime.java:617) I think I could simply write a bunch of queries, or include all sqlite3 executables and just check for the OS and hide this behind an interface, but I thought I'd ask first to see if anyone had a simpler solution, or even a different methodology that avoids the problem entirely.
tagged with: java
has comment: http://stackoverflow.com/comment/38032960
has comment: http://stackoverflow.com/comment/38033809
has comment: http://stackoverflow.com/comment/38033221
type: Question
has title: Java - Compare two sqlite database files
has answer: http://stackoverflow.com/a/24565702
answer count: 1
tagged with: database
linked to: http://stackoverflow.com/q/2093263
upvote count: 1
tagged with: sqlite
favorite count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38883752
type: QuestionComment
comment on: http://stackoverflow.com/q/24476137
score: 0
has text: I encountered exactly the same issue. My files are on a windows server (don't know exactly what version 2003 or 2008) and I tested the utility with JDK 1.7 and 1.8. I ended up writing a C# utility that does the same thing and it works correctly. It's extremely odd.
type: Comment

http://stackoverflow.com/comment/37983127
type: AnswerComment
type: Comment
has text: The `InterruptedException` is only thrown if you sleep. If you do not sleep then checking the flag is correct as the exception will not be thrown. Look at the reasons why `Thread.stop()` was deprecated for an understanding why arbitrary statements do not just throw exceptions. http://docs.oracle.com/javase/6/docs/technotes/guides/concurrency/threadPrimitiveDeprecation.html
score: 0
comment on: http://stackoverflow.com/a/24529950

http://stackoverflow.com/q/24505557
has comment: http://stackoverflow.com/comment/38171314
type: UnansweredQuestion
tagged with: android
has title: Android Studio - Emulator failure
tagged with: android-studio
has comment: http://stackoverflow.com/comment/38128897
has comment: http://stackoverflow.com/comment/37938167
downvote count: 0
has comment: http://stackoverflow.com/comment/38083477
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38084239
tagged with: emulation
type: Question
has body: I am new to android.I am using Android studio.I am trying to run my project but on starting Emulator in log says device waiting and then canceled. I am getting this exception in log null java.lang.NullPointerException at org.jetbrains.android.run.CreateAvdDialog.doOKAction(CreateAvdDialog.java:370) at com.intellij.openapi.ui.DialogWrapper$OkAction.doAction(DialogWrapper.java:1751) at com.intellij.openapi.ui.DialogWrapper$DialogWrapperAction.actionPerformed(DialogWrapper.java:1717) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6414) at javax.swing.JComponent.processMouseEvent(JComponent.java:3275) at java.awt.Component.processEvent(Component.java:6179) at java.awt.Container.processEvent(Container.java:2084) at java.awt.Component.dispatchEventImpl(Component.java:4776) at java.awt.Container.dispatchEventImpl(Container.java:2142) at java.awt.Component.dispatchEvent(Component.java:4604) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209) at java.awt.Container.dispatchEventImpl(Container.java:2128) at java.awt.Window.dispatchEventImpl(Window.java:2492) at java.awt.Component.dispatchEvent(Component.java:4604) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessCon…
has comment: http://stackoverflow.com/comment/38171421
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37898205
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24483551
has text: why overwriting `ch` inside for loop.
type: Comment

http://stackoverflow.com/q/24557385
tagged with: java
type: Question
upvote count: 4
downvote count: 0
accepted answer: http://stackoverflow.com/a/24557586
score: 4
has title: How to parse German currency numbers properly?
answer count: 1
favorite count: 0
tagged with: currency
has answer: http://stackoverflow.com/a/24557586
has body: I'm trying to parse german currency numbers. But what's wrong with the following test? NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00"); Result: java.text.ParseException: Unparseable number: "100,00" at java.text.NumberFormat.parse(NumberFormat.java:350)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38034634

http://stackoverflow.com/comment/37802867
type: Comment
score: 1
type: QuestionComment
has text: `int i = 1 + 1` and `x` is now `2`. Now let's try `boolean b = true || false`. OK, `b` would be `true` now. But what if we do `1 + true`. The answer is nothing. Clearly primitives do have behaviour as we can do the first two examples based on that behaviour, but the third one fails, because it does not conform to the behaviour expected.
comment on: http://stackoverflow.com/q/24431319

http://stackoverflow.com/q/24481887
has comment: http://stackoverflow.com/comment/37894916
has body: I'm trying to play a song in the .wav format in my Java Game, and here's some of the code of the SoundPlayer class: private static HashMap&lt;String, Clip&gt; clips; private static int gap; public static void init() { clips = new HashMap&lt;String, Clip&gt;(); gap = 0; } public static void load(String s, String n) { if(clips.get(n) != null) return; Clip clip; try { InputStream in = SoundPlayer.class.getResourceAsStream(s); InputStream bin = new BufferedInputStream(in); AudioInputStream ais = AudioSystem.getAudioInputStream(bin); AudioFormat baseFormat = ais.getFormat(); AudioFormat decodeFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); AudioInputStream dais = AudioSystem.getAudioInputStream(decodeFormat, ais); clip = AudioSystem.getClip(); clip.open(dais); clips.put(n, clip); } catch(Exception e) { e.printStackTrace(); } } When I call the load() method, it crashes on the line clip.open(dais) and I'm given this error: javax.sound.sampled.LineUnavailableException: Failed to allocate clip data: Requested buffer too large. This works with short sound effects, so I'm guessing this is because the file is over a minute long. Are there any better ways of doing this? Thanks!
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Playing .wav Song in Java?
score: 2
tagged with: audio
has comment: http://stackoverflow.com/comment/37894925
tagged with: java
has comment: http://stackoverflow.com/comment/37894864
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24482015
downvote count: 0
has answer: http://stackoverflow.com/a/24482048
tagged with: playback

jsp
tags question: http://stackoverflow.com/q/24463524
tags question: http://stackoverflow.com/q/24558366
tags question: http://stackoverflow.com/q/24432099
tags question: http://stackoverflow.com/q/24513981
tags question: http://stackoverflow.com/q/24561028
tags question: http://stackoverflow.com/q/24556976
tags question: http://stackoverflow.com/q/24576313
tags question: http://stackoverflow.com/q/24534397
tags question: http://stackoverflow.com/q/24541391
tags question: http://stackoverflow.com/q/24554158
tags question: http://stackoverflow.com/q/24476416
tags question: http://stackoverflow.com/q/24537017
tags question: http://stackoverflow.com/q/24568312
tags question: http://stackoverflow.com/q/24522340
tags question: http://stackoverflow.com/q/24514841
tags question: http://stackoverflow.com/q/24447532
tags question: http://stackoverflow.com/q/24545553
tags question: http://stackoverflow.com/q/24469676
tags question: http://stackoverflow.com/q/24472244
tags question: http://stackoverflow.com/q/24563858
tags question: http://stackoverflow.com/q/24498317
tags question: http://stackoverflow.com/q/24493656
tags question: http://stackoverflow.com/q/24531609
tags question: http://stackoverflow.com/q/24510284
tags question: http://stackoverflow.com/q/24523010
tags question: http://stackoverflow.com/q/24554049
tags question: http://stackoverflow.com/q/24547906
tags question: http://stackoverflow.com/q/24571268
tags question: http://stackoverflow.com/q/24547145
tags question: http://stackoverflow.com/q/24534965
tags question: http://stackoverflow.com/q/24527739
tags question: http://stackoverflow.com/q/24559723
tags question: http://stackoverflow.com/q/24429763
tags question: http://stackoverflow.com/q/24501341
tags question: http://stackoverflow.com/q/24540983
tags question: http://stackoverflow.com/q/24512068
tags question: http://stackoverflow.com/q/24443351
tags question: http://stackoverflow.com/q/24569786
tags question: http://stackoverflow.com/q/24440274
tags question: http://stackoverflow.com/q/24504298
tags question: http://stackoverflow.com/q/24446137
tags question: http://stackoverflow.com/q/24489249
tags question: http://stackoverflow.com/q/24429349
tags question: http://stackoverflow.com/q/24577092
tags question: http://stackoverflow.com/q/24482016
tags question: http://stackoverflow.com/q/24498159
tags question: http://stackoverflow.com/q/24572836
type: Tag
tags question: http://stackoverflow.com/q/24554423
tags question: http://stackoverflow.com/q/24573674
tags question: http://stackoverflow.com/q/24547779
tags question: http://stackoverflow.com/q/24533398
tags question: http://stackoverflow.com/q/24552937
tags question: http://stackoverflow.com/q/24450968
tags question: http://stackoverflow.com/q/24429224
tags question: http://stackoverflow.com/q/24533811
tags question: http://stackoverflow.com/q/24560704
tags question: http://stackoverflow.com/q/24547669
tags question: http://stackoverflow.com/q/24469706
tags question: http://stackoverflow.com/q/24579159
tags question: http://stackoverflow.com/q/24531225
tag name: jsp
tags question: http://stackoverflow.com/q/24428474
tags question: http://stackoverflow.com/q/24564684
tags question: http://stackoverflow.com/q/24504479
tags question: http://stackoverflow.com/q/24545220
tags question: http://stackoverflow.com/q/24578680
tags question: http://stackoverflow.com/q/24569881
tags question: http://stackoverflow.com/q/24484406
tags question: http://stackoverflow.com/q/24568703
tags question: http://stackoverflow.com/q/24569213
tags question: http://stackoverflow.com/q/24449784
tags question: http://stackoverflow.com/q/24428703
tags question: http://stackoverflow.com/q/24553076
tags question: http://stackoverflow.com/q/24530852
tags question: http://stackoverflow.com/q/24507567
tags question: http://stackoverflow.com/q/24454545
tags question: http://stackoverflow.com/q/24557138
tags question: http://stackoverflow.com/q/24585429
tags question: http://stackoverflow.com/q/24497907

http://stackoverflow.com/q/24540983
has body: Our Java/JSP application has a "Here are the terms and conditions you're agreeing to" page. I've just been handed the requirement to save this agreement text - essentially the entire JSP page - with the user's record. Currently it's embedded in the JSP page as static text, like so: General Terms & Conditions You agree to sell your soul and work for free. Also, you agree to wash all our cars by hand twice a week. At first I thought it might be better to pull this text into a property file so I can access it from multiple places in the app: General Terms & Conditions <fmt:message key='termsAndConditions.youAreDoomed'/> But even that won't give me what I need, which is basically the entire text as a string. The other alternative I thought of would be to read the entire HTML or text agreement into the JSP page from an outside file - that would also give me access to the pre-formatted text in my Java code. But it seems like it would be a pain. Is there a better way to do this? Is there some way to grab the HTML or text of the entire rendered page into a String, so I can save it in the record? I'm trying to do as little refactoring as possible because this app needs to go live "ASAP."
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24541227
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Easier to save static HTML to a database field, or read static HTML from a file?
upvote count: 1
answer count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24541227
favorite count: 0

http://stackoverflow.com/a/24568638
score: 1
has comment: http://stackoverflow.com/comment/38068896
downvote count: 0
has body: First i added your css snippet to the .css of the project and added it to the menu bar with menuButton.setStyleName("menuBar"). Then i added the following to the project css class (as an example) : .gwt-MenuItem-selected { color:red !important; } Now the first menuBar style is enabled and the additional style is set, too. Its necessary to use the !important to override the default properties.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24561984

http://stackoverflow.com/a/24441639
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24441096
has comment: http://stackoverflow.com/comment/37849292
has comment: http://stackoverflow.com/comment/37856320
has body: ApplicationContextInitializer can be used to configure profiles and property sources (.properties files), but not Spring configuration files (.xml files). Remote the following lines: environment.getPropertySources().addFirst(new ResourcePropertySource("/WEB-INF/spring/root-context.xml")); environment.getPropertySources().addFirst(new ResourcePropertySource("classpath:fw-refresh-spring.xml")); and return contextConfigLocation to web.xml: contextConfigLocation /WEB-INF/spring/root-context.xml, classpath:fw-refresh-spring.xml

http://stackoverflow.com/comment/37988983
type: QuestionComment
has text: - yes I'm on windows. - I've putted my xls file in both of .java and .class files directories and still not working. - My working directory is C:\NetBeansProjects\TestExcel\src
comment on: http://stackoverflow.com/q/24493799
score: 0
type: Comment

http://stackoverflow.com/q/24445671
tagged with: thrift
type: AnsweredQuestion
type: Question
tagged with: input
has answer: http://stackoverflow.com/a/24447090
has body: I am using Thrift scheme to store Thrift bundles as pail file in hadoop cluster. Everything seems to be working correctly. Thrift bundle is being created without any errors. Although,I am using kafka to send the bundle and while serializing,the serializer function converts the bundle in to byte array.I am getting the above mentioned error at this point. Why would kafka look in to bundle object for converting in to byte array. Or is there any way so that I can convert any object to byte array safely.If so can you please provide it.The error is : java.io.IOException: org.apache.thrift.protocol.TProtocolException: Cannot write a TUnion with no set value! following is the writeObject function that is throwing the error private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol( new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
score: 0
tagged with: java
answer count: 1
has title: java.io.IOException: org.apache.thrift.protocol.TProtocolException: Cannot write a TUnion with no set value
tagged with: hadoop
tagged with: apache-kafka
accepted answer: http://stackoverflow.com/a/24447090

http://stackoverflow.com/comment/37878501
comment on: http://stackoverflow.com/q/24468593
score: 0
type: Comment
type: QuestionComment
has text: @alk It is not a duplicate.

network-programming
tags question: http://stackoverflow.com/q/24580561
tags question: http://stackoverflow.com/q/24529067
tags question: http://stackoverflow.com/q/24483645
tags question: http://stackoverflow.com/q/24427719
tags question: http://stackoverflow.com/q/24516418
tags question: http://stackoverflow.com/q/24489639
type: Tag
tags question: http://stackoverflow.com/q/24548479
tags question: http://stackoverflow.com/q/24565292
tags question: http://stackoverflow.com/q/24543675
tags question: http://stackoverflow.com/q/24455117
tag name: network-programming
tags question: http://stackoverflow.com/q/24540124
tags question: http://stackoverflow.com/q/24566541
tags question: http://stackoverflow.com/q/24491163
tags question: http://stackoverflow.com/q/24473428
tags question: http://stackoverflow.com/q/24560223
tags question: http://stackoverflow.com/q/24522444
tags question: http://stackoverflow.com/q/24560598
tags question: http://stackoverflow.com/q/24490918
tags question: http://stackoverflow.com/q/24445694
tags question: http://stackoverflow.com/q/24475064

http://stackoverflow.com/a/24554497
answers question: http://stackoverflow.com/q/24553884
type: Answer
has body: I suggest you to use something like this to have control of the back button on the fragments: Create a base fragment abstract class: public abstract class BaseFragment extends Fragment { public void onBackPressed() { } } Extend all your fragments from BaseFragment public class CustFragmentOne extends BaseFragment { ... } Change your activity @Override public void onBackPressed() { Fragment frag = mManager.findFragmentByTag("Fragment"); if(frag instanceof BaseFragment) frag.onBackPressed(); else if(mManager.getBackStackEntryCount() &gt; 0) getFragmentManager().popBackStack(); else super.onBackPressed(); } override in your fragments the onBackPressed() method with the logic you want.
score: 0

http://stackoverflow.com/q/24453176
score: 1
has title: Nested JSTL variable name? is it possible?
tagged with: java
type: Question
answer count: 2
tagged with: jstl
downvote count: 0
tagged with: displaytag
linked to: http://stackoverflow.com/q/6162264
has answer: http://stackoverflow.com/a/24461937
has body: I am trying to use a JSTL variable inside another variable. The code below will explain it better. &lt;display:table id="resultsRow" name="${actionBean.list}" &gt; &lt;c:forEach items="${actionBean.anotherList}" var="columnName"&gt; &lt;display:column sortable="true" property="${resultsRow.${columnName}"/&gt; &lt;/c:forEach&gt; &lt;/display:table&gt; So basically i am passing a list to the display table tag "name="${actionBean.list}". Then i use the id property of the display table tag to loop through the list objects (id="resultsRow"). Now for the column property attribute i need to access different properties inside the list object. This is being done using the for:each which provides me will all the object property names. If you are wondering why its implemented this was instead of just column, its because i am using a DynaBean Object and the properties are dynamic. Question: Can i used nested vairable names like i did in display column tag property attribute? I need to: 1) evaluate columnName and get a value ( Lets say i get "price" string) 2) concatenate this value to the our variable (${resultsRow.price}) 3) execute ${resultsRow.price}
favorite count: 0
tagged with: jsp-tags
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24502990

http://stackoverflow.com/comment/37861733
type: AnswerComment
comment on: http://stackoverflow.com/a/24458749
type: Comment
has text: Thks Nikolay...with your background in this topic would LIUM fit for phone use explicitly for a mobile app....?
score: 0

nio
tags question: http://stackoverflow.com/q/24476137
tags question: http://stackoverflow.com/q/24522444
tags question: http://stackoverflow.com/q/24440617
tags question: http://stackoverflow.com/q/24485303
tags question: http://stackoverflow.com/q/24450874
tags question: http://stackoverflow.com/q/24547153
tags question: http://stackoverflow.com/q/24492433
tag name: nio
tags question: http://stackoverflow.com/q/24574255
tags question: http://stackoverflow.com/q/24442911
type: Tag
tags question: http://stackoverflow.com/q/24586957
tags question: http://stackoverflow.com/q/24491184
tags question: http://stackoverflow.com/q/24573860
tags question: http://stackoverflow.com/q/24543675
tags question: http://stackoverflow.com/q/24573136
tags question: http://stackoverflow.com/q/24525972
tags question: http://stackoverflow.com/q/24500250

http://stackoverflow.com/q/24440078
has answer: http://stackoverflow.com/a/24440690
answer count: 6
accepted answer: http://stackoverflow.com/a/24440674
has body: In Java I can do this: enum Color {RED, BLUE, GREEN }; enum Weight {LIGHT, HEAVY } Enum e = Color.RED; assertEquals(Color.RED, e); e = Weight.HEAVY; assertEquals(Weight.HEAVY, e); I can put the enum in a Map and that still works: Map&lt;String, Enum&gt; map = Maps.newHashMap(); map.put("color", Color.RED); map.put("weight", Weight.HEAVY); assertEquals(Color.RED, map.get("color")); assertEquals(Weight.HEAVY, map.get("weight")); However, I am not able to do the same with collections of enums. List&lt;Enum&gt; enumList = new ArrayList&lt;Color&gt;(); //error Is that not allowed in Java or am I just doing it wrong? Is there a better way to maintain a mapping of properties to Enums that represent them?
has comment: http://stackoverflow.com/comment/37817379
downvote count: 0
has comment: http://stackoverflow.com/comment/37817274
has comment: http://stackoverflow.com/comment/37816889
has answer: http://stackoverflow.com/a/24441562
favorite count: 0
linked to: http://stackoverflow.com/q/4166966
has answer: http://stackoverflow.com/a/24440749
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37816994
has answer: http://stackoverflow.com/a/24440674
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37817628
linked to: http://stackoverflow.com/q/9810445
possible better answer: http://stackoverflow.com/a/24440128
has answer: http://stackoverflow.com/a/24440128
type: Question
score: 3
tagged with: enums
has answer: http://stackoverflow.com/a/24440681
has comment: http://stackoverflow.com/comment/37817230
has title: Container of Enums in java

http://stackoverflow.com/q/24452890
tagged with: apache-camel
score: 0
has title: Java fire and forget cxf web service call to camel application
answer count: 1
has body: I have a java web application (quote engine) that makes a web service call to another java web application (multicaster) that utilises Apache camel to multicast a message to multiple endpoints. We are consuming a apache CXF webservice which is defined in the camel context of the multicaster project. Currently the quote engine project is not using camel. &lt;cxf:cxfEndpoint id="caster" address="http://localhost:${multicaster.port}/caster" serviceClass="uk.co.glad.caster.core.casterWS"/&gt; For additional info here is my multicaster route &lt;camel:route id="casterRoute"&gt; &lt;camel:from ref="caster" /&gt; &lt;camel:process ref="initProcessor" /&gt; &lt;camel:multicast parallelProcessing="true" stopOnException="false" streaming="true"&gt; &lt;camel:to uri="direct:WebService1"/&gt; &lt;camel:to uri="direct:WebService2"/&gt; &lt;/camel:multicast&gt; &lt;/camel:route&gt; I need to the call to the caster cxf endpoint to be fire and forget. I want to send a message to this service and continuing processing in quote engine project without waiting for a reply. My web service has a void return type as we dont even need a reply. I think I may be able to solve this using the concurency api and future object but I was wondering if there was a cleaner way to do this. Maybe using camel config, I have read about the "inonly" parameter but I can't see how I can use this in my config. thanks Tom This was solved as Claus mentioned below using wireTap &lt;cxf:cxfEndpoint id="caster" address="http://localhost:${multicaster.port}/caster" serviceClass="uk.co.glad.caster.core.casterWS"/&gt; &lt;camel:route id="tap"&gt; &lt;camel:from ref="caster" /&gt; &lt;camel:wireTap uri="direct:casterRoute" /&gt; &lt;/camel:route&gt; &lt;camel:route id="casterRoute"&gt; &lt;camel:from uri="direct:casterRoute" /&gt; &lt;camel:process ref="initProcessor" /&gt; &lt;camel:multicast parallelProcessing="true" stopOnException="false" streaming="true"&gt; &lt;camel:to uri="direct:WebService1"/&gt; &lt;camel:…
has answer: http://stackoverflow.com/a/24464289
type: AnsweredQuestion
tagged with: cxf
tagged with: java
tagged with: web-services
type: Question
accepted answer: http://stackoverflow.com/a/24464289

http://stackoverflow.com/comment/37898428
type: Comment
type: QuestionComment
has text: +1 to Edward. If you want a more accurate progress, then measure the time taken by each step, compute the respective percentages, and assume they'll be similar in the future by hardcoding these percentages (for example, if the execution on your machine leads to 1 second for method A, 2 seconds for method B and 2 seconds for method C, then hardcode the percentages 20%, 60% and 100%).
comment on: http://stackoverflow.com/q/24483546
score: 0

http://stackoverflow.com/comment/41035993
has text: Is this question still open and valid for your needs?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24452376
score: 0

http://stackoverflow.com/a/24514477
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24514118
score: 2
has comment: http://stackoverflow.com/comment/37954155
upvote count: 2
has comment: http://stackoverflow.com/comment/37979033
has comment: http://stackoverflow.com/comment/37954471
has body: public static void main(String[] args) { ArrayList&lt;Human&gt; list = new ArrayList&lt;&gt;(); Scanner in = new Scanner(System.in); for(int i = 0; i &lt; 3; i++) { list.add(new Human()); System.out.print("Name: "); list.get(i).name = in.next(); System.out.print("Age: "); list.get(i).age = Integer.parseInt(in.next()); System.out.print("Gender: "); list.get(i).gender = in.next(); } } On this way it should work.

http://stackoverflow.com/comment/37876348
score: 0
type: Comment
has text: Had to cast `field` to ArrayList<LinkedHashMap>. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/24472096

http://stackoverflow.com/comment/38072176
type: QuestionComment
has text: No look and feel doesn't work at all. If i use a look and feel i have to stick to the colours that they are using
score: 0
comment on: http://stackoverflow.com/q/24577267
type: Comment

http://stackoverflow.com/comment/37982204
has text: try this Go to yourWorkspace/.metadata/.plugins and delete everything in there. Eclipse will start and repopulate the folder.
comment on: http://stackoverflow.com/q/24529546
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/q/24536880
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/24540187
tagged with: remote-debugging
has body: I'm trying to figure out how to debug my jar that is running remotely. Here is my scenario: My .jar will be running from a VPS. This jar basically runs a server for a game, so it also connects to a mysql db. I start the server with 3 .bat files that looks something like this: set CLASSPATH=.;dist\aries.jar;dist\mina-core.jar;dist\slf4j-api.jar;dist\slf4j-jdk14.jar;dist\mysql-connector-java-bin.jar java -Xmx500m -Dwzpath=wz\ -Djavax.net.ssl.keyStore=filename.keystore -Djavax.net.ssl.keyStorePassword=passwd -Djavax.net.ssl.trustStore=filename.keystore -Djavax.net.ssl.trustStorePassword=passwd net.world.WorldServer pause What I want to do is start the server on the vps like normal, but debugging the server on my local machine via Netbeans IDE. I don't know if this is possible because people will be connecting to the server (although, I will be debugging a test server which will only have me online). Note: I have done a lot of searching before coming here and a lot of what I found had to do with using xdebug &amp; php which has doesn't have much to do with my situation (I don't think) -Thanks
has title: How to debug a jar remotely from netbeans
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24540187
tagged with: java
tagged with: mysql
type: Question
tagged with: executable-jar
upvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/38066246
comment on: http://stackoverflow.com/q/24574478
score: 0
type: QuestionComment
type: Comment
has text: Where is Node coming from? how is data defined? Is T bound?

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/24573008
type: Tag
tags question: http://stackoverflow.com/q/24534724
tags question: http://stackoverflow.com/q/24490962
tags question: http://stackoverflow.com/q/24505517

http://stackoverflow.com/comment/38537650
type: Comment
has text: Well, not realy, servers in domain mode doesn't have to create cluster, you have to explicitly enable and configure this.
score: 1
comment on: http://stackoverflow.com/a/24607560
type: AnswerComment

http://stackoverflow.com/comment/37960330
type: Comment
comment on: http://stackoverflow.com/a/24511950
has text: One TCP endpoint communicates with another TCP endpoint. I don't really know of a situation where you could have a TCP channel that has a non-TCP endpoint. If you managed to produce that then the legitimate TCP endpoint would quickly end up transmitting and retransmitting the same data because it would believe it to be lost in transmission.
score: 0
type: AnswerComment

sensors
type: Tag
tag name: sensors
tags question: http://stackoverflow.com/q/24518662

pivot-table
tag name: pivot-table
tags question: http://stackoverflow.com/q/24554046
tags question: http://stackoverflow.com/q/24513055
type: Tag

http://stackoverflow.com/a/24570283
type: Answer
score: 0
has body: Ok you ask several questions, here are some answers: It is not possible to run Java 1.8 code with a "lower" JRE/JDK like 1.7, 1.6 or 1.5. The other way around however is possible - you can use Java 1.8 to run a java 1.5 applet... You don't need to hack your workstation - if you only install one java version (even if it is an older one) and it is installed/configured correctly that version will be used to start your applet With the next generation plugin (introduced since 6u10) it is possible to start your applets with a jnlp file. The jnlp syntax allows you to specify a specific java version and if that one is not installed it will/can be downloaded. One example would be: &lt;j2se version="1.6.0_10" href="http://java.sun.com/products/autodl/j2se"/&gt; Some general idea, please correct me if I didn't fully understand you: You want both applets to run, right? For that to work you will have to change something at some point. Possibilities (My answer disregards security - from this perspective always use the latest java version): Install the latest Java 1.8 and sign your old applet. Signing an applet doesn't require the source code - just access your webpage, run the applet and then search java cache for the applet.jar. Sign it with an official certificate and deploy it on your server. (Additionally this may require adding some Manifest attributes as well) Downgrade your new applet to java 1.7 or 1.6 and install an older Java like 1.7.0_17. Until Java 1.7.0_21 signing was not mandatory. If you see the baseline for Java 6 it would be version 1.6.0_43. Theoretically you can use jnlp to define an exact java version which should be used to run an applet. The problem is, that it was introduced starting with 1.6.0_10 - thus your 1.5 java does not suffice. If it is possible to run your old applet with a slightly newer java and also add a jnlp file to your webpage then it could work. For that you would need to: Install two newer java versions: One 1.6.0_10 or higher (until 1.6.…
answers question: http://stackoverflow.com/q/24525908

http://stackoverflow.com/a/24455716
downvote count: 2
answers question: http://stackoverflow.com/q/24455622
has body: What you want to do is create a service or an API that talks to your Database. Your Andriod app will then communicate with this service using HTTP protocol. I'd recommend creating a restful service that can take in and return in JSON format. Take a look at the link below. It is not recommended to open MYSQL port for remote connection. http://www.techrepublic.com/blog/software-engineer/calling-restful-services-from-your-android-app/
score: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/39316815
type: Answer
answers question: http://stackoverflow.com/q/24459136
has body: You can use from this formula from this LINK: /** * * @Author: Aghatise Osazuwa * Website: www.cscprogrammingtutorials.com * * Exercise 1.10 - Average Speed In Miles * */ public class Ex1_10 { public static void main(String[] args) { System.out.println("Distance = 14km \nTime = 45 minutes 30 seconds = (45 x 60) + 30 \n" + " -------------- hours \n" + " 3600 \n" + "1 mile = 1.6 kilometers. \nAverage Speed in miles per hour = " + (14.0 / 1.6)/ (((45.0 * 60.0) + 30.0) / 3600) + " mph."); } } Or you can use : km * 3600 ------------------ = Average time kmh millisecond
score: 0

http://stackoverflow.com/a/29440139
score: 2
upvote count: 2
has body: I ran into something really similar today. Not sure if its the same issue, but what I did was: Open project explorer Right click the project Find "Configure Build Path" In the window that opens, select the "Libraries" tab Scroll down to JRE System Library (there was a red error symbol next to mine) and click the library. In the top right, select the Edit button Choose "Alternate JRE" and then pick (in your case) java 8
answers question: http://stackoverflow.com/q/24490663
downvote count: 0
type: Answer

http://stackoverflow.com/q/24569752
has title: Java - program works perfectly in eclipse but does not seem to do its intended task when exported to runnable jar
has answer: http://stackoverflow.com/a/24570418
accepted answer: http://stackoverflow.com/a/24570418
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24569995
has answer: http://stackoverflow.com/a/24569995
has body: I'm not sure if this question has been posted before but this seems pretty context specific and I have no idea what is going wrong. Basically what I am trying to achieve is, - There is a 'server' bit of the program that has the ServerSocket waiting to receive the connection - The user will run the client and connect to that socket. - The user can then send packets through to the 'server' which does some other stuff. Something to note is that, I am checking if the socket is null, if it is, then the connection is allowed. Otherwise it will just be ignored as only want one user connected at any one time. But, when the user disconnects, the user can just reconnect to the same socket and continue. This is the receiving 'server' bit. private void shutDownSocket() { try { socket.close(); socket = null; } catch (IOException e) { e.printStackTrace(); } } class Getting extends Thread { public void run() { boolean running = true; try { in = new ObjectInputStream(socket.getInputStream()); System.out.println("connected"); while (running) { int retVal = interpret((Packet) in.readObject()); if (retVal == 0) { running = false; } } } catch (IOException e) { e.printStackTrace(); System.out.println("connection lost"); running = false; shutDownSocket(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } class Cycle extends Thread { public void run() { try { ServerSocket server = new ServerSocket(2323); while (true) { if (socket == null) { socket = server.accept(); new Getting().start(); } } } catch (IOException e) { e.printStackTrace(); } } } So when I run all my code in eclipse, everything works perfectly fine and it does everything I want it to do. But when I export both the client and the server parts and run them on separate computers, I can connect the first time and everything works perfect. But when I close my client. (Which sends a packet, to tell the server to make the socket = null) and reconnect, it doest work anymore. I appreciate any kind of help you guys can …
tagged with: sockets
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/37971102
type: QuestionComment
has text: `List<Object>`. `Generics` *used* . But for *what?*?
comment on: http://stackoverflow.com/q/24523474
score: 0
type: Comment

http://stackoverflow.com/comment/37878619
has text: I know, I searched for examples and always with libraries. The teacher said no libraries and tried a lot and achievement only remove "<>" in the first line.
comment on: http://stackoverflow.com/q/24473479
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37889530
type: Comment
has text: Add a unique name when creating the `Thread` objects as that will give a better indication of which `Hello x` is being printed. It is possible that `t1` and `t2` execution is being interleaved but it is impossible to tell in the screenshot output.
comment on: http://stackoverflow.com/q/24479167
score: 4
type: QuestionComment

http://stackoverflow.com/comment/38165117
has text: If you have a datasource, you can have JPA use it (and all your application will keep using JPA) and have special parts use it at JDBC level. It is in fact a common optimisation use case : most of the code uses an ORM such as JPA, and some bottleneck parts use JDBC.
type: Comment
comment on: http://stackoverflow.com/q/24524662
score: 0
type: QuestionComment

http://stackoverflow.com/comment/105028434
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/45138926
has text: Hi Suhail, as per your last comment in the question you shared, I believe you found the solution.
score: 0

http://stackoverflow.com/comment/37982777
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24527400
has text: A nice trick to setting the static final boolean is to infer the value of the -ea flag provided to the JVM. That way you can keep the DEBUG turned off and stripped out of the executing code until you want it turned on, and then turn it on without a recompile. See https://github.com/kirkch/SandboxMosaic/blob/master/lang-sandbox/src/main/java/com/mosaic/lang/system/SystemX.java#L57 for an example of how to do that.
type: Comment

http://stackoverflow.com/q/24474063
has title: How Do You Keep UML Diagrams Up To Date?
has body: I am from a Physics background and not a Computer Science background and never did any course at University on class/component diagrams etc and I have never found the need to use them at work. The main thing that I don't understand is how do you keep them up to date if the code is still being developed or maintained? e.g. What's to stop me from refactoring several methods or classes and making the class diagram obsolete? Do you have to constantly update the diagram manually? I have seen tools that generate UML from the code and these could keep it up to date I suppose but from what I have seen, the auto-generated diagrams don't seem to be useful enough. Is the UML for a project likely to be created at the start then be left in a documentation folder and gradually get more and more out of date?
downvote count: 0
has answer: http://stackoverflow.com/a/24474501
has answer: http://stackoverflow.com/a/24483871
favorite count: 0
has answer: http://stackoverflow.com/a/24474148
type: UnansweredQuestion
score: 5
answer count: 4
has answer: http://stackoverflow.com/a/24474118
tagged with: java
tagged with: uml
type: Question
linked to: http://stackoverflow.com/q/9484879
upvote count: 5

http://stackoverflow.com/comment/37851364
has text: @sabadow I already tried it, didn't work.
comment on: http://stackoverflow.com/q/24447942
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24468431
score: 1
has title: Proper game structure
upvote count: 1
tagged with: structure
has body: To preface, sorry for the semi-vague question. I have been searching for weeks to this question. So I understand the necessities a game needs. (init, update, draw). To be more specific, I'm using Java with Slick2D as a learning environment. Slick2D makes the set-up of the game pretty simple. I think I understand MVC structure, but my biggest problem right now is where do I write the player movement code? I have the Player class which has all the fields of where it's at, what image/animation it needs to render, and right now, all of the controls. It doesn't feel right, though that could just be my own insecurities. I feel that the player movement controls should be in its own class, the collision detection in its own class, and the all the player would have is simply what defines it(coordinates, size, hit box, etc.). I'm not entirely sure how to explain this, as every time I think about it, my mind races all over the place and I have a hard time "chunking" this information in my head. If you need more information, please let me know. I'm just trying to find the "right" place for everything to make my code more manageable, readable, and possibly reusable. (edited to show program flow[not runnable]) As it is, my flow is, public class Game extends StateBasedGame{ //with main included, this sets up the window, fps, etc... start "level 1" state...; } public class level1 extends BasicGameState{ public void init(){ initialize player, environment, etc... } public void update(){ player.update(); } public void render(){ environment.render(); player.render(); } } public class Player{ All player variables public Player(){ construct player with coords and starting image/animation } public void init(){ initializes all images/animations this player could potentially use } public void update(){ All environment based input controls go here, example; if(this.isGrounded &amp;&amp; input.keyIsDown(KEY_SPACE){ make character jump; change animation; } } public void render(){ draw image/an…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24468505
tagged with: java
has comment: http://stackoverflow.com/comment/37870376
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37869820
has answer: http://stackoverflow.com/a/24468505

http://stackoverflow.com/a/36588414
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/24551177
has body: We can split condition "OR" in HQL to 2 statements. It works fine. from User u where (u.parentOrganisation = :topLevelOrganisation and u.parentOrganisation.deleted = false and u.active = true ) or (u.parentOrganisation in (:franchisees) and u.parentOrganisation.deleted = false and u.active = true)
type: Answer
downvote count: 1

http://stackoverflow.com/a/24473192
upvote count: 1
answers question: http://stackoverflow.com/q/24473153
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37878163
has comment: http://stackoverflow.com/comment/37878144
has body: There is nothing wrong in your code, You just need to Clean and Build your project to register your id that was added.
has comment: http://stackoverflow.com/comment/37878284
type: Answer

http://stackoverflow.com/comment/38083278
type: AnswerComment
comment on: http://stackoverflow.com/a/24583477
type: Comment
score: 0
has text: @REACHUS Check your problem with the output given?

http://stackoverflow.com/q/24578950
linked to: http://stackoverflow.com/q/16133590
favorite count: 0
has comment: http://stackoverflow.com/comment/38075837
has body: I have a folder which user save or modify files in. When a file is created or modified I need to serialise that file and insert into a database. I have looked at Java Watch Directory and Apache commons.io.monitor. The watch directory approach picks up every event because it is tied to the native file event notification which causes a problem. Stackoverflow question multiple events watch directory What is the best way/or any other approaches to monitor the directory? import org.apache.commons.io.monitor.*; import java.io.*; public class ApacheWatch2 { public static void startApacheWatch(String path) { final File folder = new File(path); if (folder.exists()) { try { FileAlterationObserver observer = new FileAlterationObserver(folder); observer.addListener(new ChangeEventHandler()); final FileAlterationMonitor monitor = new FileAlterationMonitor(); monitor.addObserver(observer); monitor.start(); } catch (Exception e) { e.printStackTrace(System.err); } } else { throw new RuntimeException("File does not exist"); } } private static class ChangeEventHandler extends FileAlterationListenerAdaptor { @Override public void onFileCreate(File file) { //DO SERIALISATION STUFF WITH FILE } @Override public void onFileChange(File file) { //DO SERIALISATION STUFF WITH FILE } } }
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/24579092
has title: Monitor a shared folder for changes and pull to database
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/38074934
tagged with: shared-directory
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24579092

http://stackoverflow.com/q/24573460
answer count: 1
has body: I'm new to Spring I found this information about limitations of event model of Spring: "It is not transactional. If an event is published, then an error occurs after treatment listeners, they can not be canceled. There there are no means for returning a message published. However, these treatments, if they are executed in the same thread, can participate in the same transaction as that of the sender. This means that if treatments listeners are only operations database, they will also be transactional." Can someone explain to me the bold sentence? Are database treatments executed by the listener, always made on the same thread as the sender?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has title: The event model of Spring
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24574719
downvote count: 0
tagged with: spring-ioc

http://stackoverflow.com/a/24712498
has body: The problem was that I calculated with int numbers and an int divided by another int results in inaccuracies. So just doing this with double numbers solved it. This is how I calculate the intersection points: edges is a ArrayList&lt;Point&gt; containing the edge points. ymin is the lowest y value and `ymax`` the highest one. for (int yTemp = ymin; yTemp &lt;= ymax; yTemp++) { ArrayList&lt;Point&gt; intersectionPoints = new ArrayList&lt;&gt;(); for (int p = 0; p &lt; edges.size() - 1; p++) { int x1, x2, y1, y2; double deltax, deltay, x; x1 = edges.get(p).x; y1 = edges.get(p).y; x2 = edges.get(p + 1).x; y2 = edges.get(p + 1).y; deltax = x2 - x1; deltay = y2 - y1; int roundedX; x = x1 + deltax / deltay * (yTemp - y1); roundedX = (int) Math.round(x); if ((y1 &lt;= yTemp &amp;&amp; y2 &gt; yTemp) || (y2 &lt;= yTemp &amp;&amp; y1 &gt; yTemp)) { intersectionPoints.add(new Point(roundedX, yTemp)); } } //for the last interval int x1, x2, y1, y2; x1 = edges.get(edges.size() - 1).x; y1 = edges.get(edges.size() - 1).y; x2 = edges.get(0).x; y2 = edges.get(0).y; if ((y1 &lt;= yTemp &amp;&amp; y2 &gt; yTemp) || (y2 &lt;= yTemp &amp;&amp; y1 &gt; yTemp)) { intersectionPoints.add(new Point(x1 + (x2 - x1) / (y2 - y1) * yTemp - y1, yTemp)); } //you have to sort the intersection points of every scanline from the lowest x value to thr highest Collections.sort(intersectionPoints, new SortXPoints()); pointsOfScanline.add(intersectionPoints); This will give you an ArrayList containing ArrayLists of scanline points for every Scanline. So you just have to draw them with drawLine(x1, y2, x2, y2).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24469459
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24469459

http://stackoverflow.com/comment/37935435
type: AnswerComment
comment on: http://stackoverflow.com/a/24492671
has text: I want to find ways to define width and height of components in designer panel not in the code.
type: Comment
score: 0

http://stackoverflow.com/q/24509754
has answer: http://stackoverflow.com/a/40591082
tagged with: spring
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24512682
has title: Force Jersey to read mocks from JerseyTest
tagged with: java
tagged with: unit-testing
type: Question
tagged with: jersey
has body: I want to test a Resourse with JerseyTest. I have created the following test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:testApplicationContext.xml") public class ResourceTest extends JerseyTest { @Configuration public static class Config { @Bean public AObject aObject() { return mock(AObject.class); } } @Autowired public AObject _aObject; @Test public void testResource() { // configouring mock _aObject Response response = target("path"); Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); } @Override protected Application configure() { return new ResourceConfig(Resource.class).property("contextConfigLocation", "classpath:testApplicationContext.xml"); } } My Resource also has an AObject reference with @Autowired annotation. My problem is that my JerseyTest and the Resource (that is configured by the test) have different instances for the Mock object. In the console I see that the testApplicationContext.xml is loaded twice, once for the test and one for the Resource. How can I force jersey to use the same mock?
downvote count: 0
has answer: http://stackoverflow.com/a/48922350
has answer: http://stackoverflow.com/a/73412434
accepted answer: http://stackoverflow.com/a/24512682
upvote count: 8
tagged with: junit
possible better answer: http://stackoverflow.com/a/40591082
score: 8
favorite count: 0

http://stackoverflow.com/comment/37870096
comment on: http://stackoverflow.com/a/24468372
score: 0
type: AnswerComment
has text: Thanks fr the explanation, it helped :)
type: Comment

http://stackoverflow.com/comment/37886076
score: 2
has text: close the writer after the loop.
comment on: http://stackoverflow.com/q/24477491
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38010282
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24544152
has text: Thats what happens wheb you try to print an object (an array is an object). I think what you wanna do is take the bytes from the buffer and turn them into chars so you can create a String (assuming thats what you're trying to receive)
score: 0

http://stackoverflow.com/comment/37809756
score: 0
has text: @Smutje Here's the [parent activity](http://pastebin.com/0GktUgvi) and here's the [child activity](http://pastebin.com/hsyBFjjp) (extends parent activity)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24436466

http://stackoverflow.com/q/24533816
has body: I'm very new to user agents, and I'm fairly stuck on how to make this work. What we have in the code, is a series of if statements that check the user agent, and display a PDF properly. BUT we're running into an issue where the PDF will not display properly in an object tag with IE7 and IE8 on WindowsXP, so I need to modify the if statements to add an elseif to allow for people who view the PDF on IE7 and IE8 on WindowsXP for it to render out in an iframe. My problem is proper syntax. Here's the code: String pdfpath = (String) request.getAttribute("pdfpath"); String ua = request.getHeader("User-Agent").toLowerCase(); if (ua.matches("(?i).*((android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk).*")||ua.substring(0,4).matches("(?i)1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|…
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: User Agents for IE7 and IE8 on Windows XP - Java
accepted answer: http://stackoverflow.com/a/24534046
tagged with: user-agent
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: internet-explorer
tagged with: if-statement
tagged with: syntax
tagged with: java
has answer: http://stackoverflow.com/a/24534046

http://stackoverflow.com/q/24446280
score: 0
has comment: http://stackoverflow.com/comment/37831464
has answer: http://stackoverflow.com/a/24453787
has comment: http://stackoverflow.com/comment/37828183
has title: MySQL Database connection disconnected after few minute
has body: I am working on Spring+Hibernate+JSF but if i am ideal on a page for few minute i am getting exception when trying some Database query The last packet successfully received from the server was 2,615,049 milliseconds ago. The last packet sent successfully to the server was 27 milliseconds ago. Caused by: org.hibernate.TransactionException: JDBC begin transaction failed: at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:76) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160) at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1309) at org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:474) ... 46 more Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Is this issue due to any configuration in my project or its database vendor issue in web.xml i made this entry &lt;session-config&gt; &lt;session-timeout&gt; 30 &lt;/session-timeout&gt; &lt;/session-config&gt; Connection pool &lt;bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt; &lt;property name="driverClass" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="jdbcUrl" value="jdbc:mysql://IP:3306/ccc" /&gt; &lt;property name="user" value=" hariom" /&gt; &lt;property name="password" value="password" /&gt; &lt;property name="maxPoolSize" value="2" /&gt; &lt;property name="maxStatements" value="0" /&gt; &lt;property name="minPoolSize" value="1" /&gt; &lt;/bean&gt;
has comment: http://stackoverflow.com/comment/37828327
type: UnansweredQuestion
tagged with: spring
tagged with: jsf
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37828792
tagged with: mysql
has comment: http://stackoverflow.com/comment/37827933
type: Question
answer count: 1

http://stackoverflow.com/q/24508074
has comment: http://stackoverflow.com/comment/37942610
type: AnsweredQuestion
has title: How to merge arrays in JAVA without duplicates and not using built-in functions?
possible better answer: http://stackoverflow.com/a/24508418
tagged with: java
has answer: http://stackoverflow.com/a/24508577
has comment: http://stackoverflow.com/comment/37942779
downvote count: 3
has answer: http://stackoverflow.com/a/24508587
type: Question
score: -1
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/24508418
has comment: http://stackoverflow.com/comment/37942635
linked to: http://stackoverflow.com/q/80476
favorite count: 0
has body: Lets say I have two arrays of integer and I want to merge them without duplicates. I know I can add them in Set and then can retrieve them as arraylist. But without using any built-in function how to do it?
accepted answer: http://stackoverflow.com/a/24508587
has comment: http://stackoverflow.com/comment/37942710

http://stackoverflow.com/a/24529212
type: Answer
answers question: http://stackoverflow.com/q/24527687
upvote count: 0
has comment: http://stackoverflow.com/comment/37982463
score: -1
has body: if your bean property name are the same as your JSON's, you can use json-lib. For maven project, just put net.sf.json-lib json-lib 2.4 jdk15 into the pom.xml. JSONObject jsonObject = (JSONObject) JSONSerializer.toJSON(YOUR JSON STRING); RequestAction re = (RequestAction) JSONObject.toBean(jsonObject,RequestAction.class);
downvote count: 1
has comment: http://stackoverflow.com/comment/37981727

http://stackoverflow.com/q/24572484
has answer: http://stackoverflow.com/a/24572517
upvote count: 0
type: Question
tagged with: java
score: -1
tagged with: eclipse
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: how to import a folder containing project in to eclipse as project
has body: Trying to backup the project, I browsed to the workspace in explorer and copied the folder containing all the project folders and files to my flash disk. Now I want to restore it and I dont know how? I copied the folder into workspace but no success. I tried import it into new project but folders are not copied and the files are copied to src folder. I now know that I should have done it from inside the eclipse using export as archive.

http://stackoverflow.com/q/24499042
type: UnansweredQuestion
tagged with: jlist
tagged with: swing
has comment: http://stackoverflow.com/comment/37937893
has comment: http://stackoverflow.com/comment/37996172
answer count: 0
has comment: http://stackoverflow.com/comment/38081116
tagged with: java
has title: How to add checkbox and image to JList
type: Question
has comment: http://stackoverflow.com/comment/37940017
score: 0
tagged with: listselectionlistener
has comment: http://stackoverflow.com/comment/37996215
has comment: http://stackoverflow.com/comment/37940055
has body: The following code displays images MRI images in a JList. I want to add a checkbox with each image so the user can chose as many images they want and then perform calculations on all the images. I just can't seem to add a checkbox to the image. I have tried list.setCellRenderer(new CheckBoxListRenderer); but it doesn't recognize the checkboxlistrenderer. Does anybody know how I would go about doing this? DefaultListModel&lt;ImageIcon&gt; model = new DefaultListModel&lt;ImageIcon&gt;(); JCheckBox check; int counter = 0; for(int i =0; i&lt; image.getStackSize(); i++){ image.setSliceWithoutUpdate(i); ImageIcon c = new ImageIcon(); c.setImage(image.getBufferedImage()); model.addElement(c); counter++; } final int finalCounter = counter; image.setPosition(1); JList&lt;ImageIcon&gt; list = new JList&lt;ImageIcon&gt;(model); list.addListSelectionListener(new ListSelectionListener(){ @Override public void valueChanged(ListSelectionEvent arg0) { // TODO Auto-generated method stub if(arg0.getValueIsAdjusting() ==false) return; JList l = (JList) arg0.getSource(); if(l.isSelectionEmpty()) System.out.println("List is empty!"); int index = ((JList)arg0.getSource()).getSelectedIndex(); StringBuilder sb = new StringBuilder(); sb.append("Image #: "); for(int i =0; i&lt; image.getStackSize();i++){ if(index == i){ sb.append(i+1); sb.append("/"); sb.append(finalCounter); String strI = sb.toString(); txt.setText(strI); image.setSlice(i); frame.setImage(image); } } } }); JScrollPane listScroll = new JScrollPane(list,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScroll, panel2);

http://stackoverflow.com/comment/37996077
type: QuestionComment
comment on: http://stackoverflow.com/q/24530251
score: 0
type: Comment
has text: Have to tried specifying the -clean option when you start Eclipse to get it to refresh its caches?

http://stackoverflow.com/a/24492225
downvote count: 0
answers question: http://stackoverflow.com/q/24486002
has body: HDFS file system is defined in the library hadoop-hdfs-2.0.0-cdhX.X.X.jar. If you are executing this as a java program you need to add this library to classpath. Or this library would be available in hadoop classpath. Create a jar file and execute the jar using hadoop command.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/37990378
type: AnswerComment
score: 0
type: Comment
has text: Easy : request.getParameter("lname"); THX DUDE : )
comment on: http://stackoverflow.com/a/24533362

http://stackoverflow.com/q/24501246
tagged with: jbutton
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/24502242
accepted answer: http://stackoverflow.com/a/24502242
has comment: http://stackoverflow.com/comment/37931655
has answer: http://stackoverflow.com/a/24501289
score: 0
has comment: http://stackoverflow.com/comment/37930675
answer count: 3
has comment: http://stackoverflow.com/comment/37930594
has answer: http://stackoverflow.com/a/24501343
has title: Java how to call a method from a child class
has body: I'm learning Swing to make GUI in java. My goal is to have 1 mainGUI class to initialize everything and another class that controls all the button. What I'm doing now is I have a mainGUI which has: public class mainGUI(){ .... (main and initialize things here) .... protected JButton btnLogin; public void initialize(){ btnLogin = new JButton("Login"); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _buttonLogin(); } }); } protected void _buttonLogin(){}; } Then in my buttonControl I have: public class buttonControl extends mainGUI{ @Override protected void _buttonLogin(){ if (isLogin == true){ btnLogin.setEnabled(false); } else { // somthing else } } } The program actually works but not as i expected. When i click on the "login" button, the login button is not set to unclickable. If i don't have the _buttonLogin method in the mainGUI class then I cannot call it from buttonControl class. I'm just wondering is my approach right in this situation? or any other neat way to have a separated listener class? Thank you so much
tagged with: swing
possible better answer: http://stackoverflow.com/a/24501289

http://stackoverflow.com/a/24527120
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Contrary to popular belief, BufferedImage.getSubimage(...) will not create a new copy of image data. It will only be a (live) view of the "parent" image. This is very fast and cheap compared to actually cloning the data array. So, I'd say it makes perfectly sense to use a sprite sheet in this way. Any changes made to the parent image will be reflected in the subimages and vice versa. From the javadoc: Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image. In other words, only a small wrapper around the data array is created for each subimage instance. The easiest way to verify this, would be to just try drawing over one of the subimages and see that changes are reflected. As @MadProgrammer points out, loading a large image once is likely to be faster and more memory efficient than loading many small images. However, there are some gotchas: A larger image will need a larger continuous block of memory. This might be a problem in a Java VM that has been running for a while, as free memory gets fragmented (probably less a problem in a modern VMs, and no problem at all, if you load your image once, early in your game). After you have created a subimage, the memory for the parent image cannot be freed until the subimage is freed (because of the shared data array). If this is not what you want, you need to manually create copies of the subimages.
type: Answer
accepted answer of: http://stackoverflow.com/q/24500899
downvote count: 0
answers question: http://stackoverflow.com/q/24500899

http://stackoverflow.com/a/24504072
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: !SOLVED! I changed from the latest Wearable 4.4W Emulator to a Telephone 4.4.2 Emulator. Now it runs fine in Android w/ Robotium Testcases! Thanks all!
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24487153
score: 1
answers question: http://stackoverflow.com/q/24487153

http://stackoverflow.com/q/24429557
answer count: 2
has body: I am using NetBeans to run a Wicket application with just one div in which a google maps should be . I added the dependency from NetBeans ,wicketstuff-gmap3. I've tried both available versions in Netbeans : 1.4.0 and 1.5.0 and in both , DEPLOYMENT and DEVELOPMENT mode , the map simply not appears. org.wicketstuff wicketstuff-gmap3 1.4.0-SNAPSHOT jar Java code : import org.wicketstuff.gmap.GMap; import org.wicketstuff.gmap.api.GLatLng; public class HomePage extends WebPage { public HomePage() { GMap map = new GMap("map"); map.setStreetViewControlEnabled(false); map.setScaleControlEnabled(true); map.setScrollWheelZoomEnabled(true); map.setCenter(new GLatLng(52.47649, 13.228573)); add(map); } } HTML : The web app runs and simply display a blank pange . Anyone know how to solve this ? Thank you !
tagged with: google-maps
has comment: http://stackoverflow.com/comment/37802202
tagged with: wicket
tagged with: dependencies
has answer: http://stackoverflow.com/a/24573936
has answer: http://stackoverflow.com/a/39189107
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37799053
tagged with: maven
has comment: http://stackoverflow.com/comment/37798728
has title: Apache Wicket Gmap3 does not display the map in the div
has comment: http://stackoverflow.com/comment/37798164
has comment: http://stackoverflow.com/comment/37797632
tagged with: java
type: Question

http://stackoverflow.com/comment/37892050
has text: I have to use float since I need to work with JFreeChart FastScatterPlot class which requires floats as parameters
type: AnswerComment
comment on: http://stackoverflow.com/a/24480484
score: 0
type: Comment

http://stackoverflow.com/comment/37808748
comment on: http://stackoverflow.com/a/24435142
type: Comment
has text: Wow that's interesting. I'll take a look... Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37985507
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24529525
has text: Niels, do you know if this generated sql is db (my liquibase.properties are configured for mySql) specific? May I use it for oracle?
type: AnswerComment

http://stackoverflow.com/q/24459401
score: 0
tagged with: sdk
tagged with: android
has body: Hi I want to start developing android apps, I downloaded the ADT bundle from http://developer.android.com/sdk/index.html I also downloaded and installed jdk -8u5 from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html both of them I chose the 64 bit versions. after unzipping the ADT to my c:/ drive I started eclipse the title bar wasn't eclipse it was "Resource -" the icon in the Taskbar is not from eclipse (might be a default icon), when I create a new android application project no activity_main.xml nor. Java is created and the create activity checkbox when creating the project was checked, even in the new project the title bar doesn't change to the name of the project. when trying to create an AVD the OK button stays disabled so I can't create any AVD even using the SDK manager (Tools>Manage AVD's..). I've tried many different eclipse downloads and nothing works as expected maybe I'm missing something along the way? I've tried with the JRE and JDK. I would really appreciate some help or some links to where I can download eclipse and java that would work.
has title: Trouble running eclipse on windows 8.1
has answer: http://stackoverflow.com/a/24459510
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/24459510

http://stackoverflow.com/comment/38083671
has text: I editted my code Could you answer my question again?
type: AnswerComment
comment on: http://stackoverflow.com/a/24563874
score: 0
type: Comment

http://stackoverflow.com/q/24459710
tagged with: swing
downvote count: 1
tagged with: java
score: -1
type: Question
upvote count: 0
has body: I am new to graphics. I got this code from open source.It should paint String "HEeelo" on jframe,but it does not.Can anyone explain why it is not working properly and the principle of paint method?Why should it edit JFrame as it is just method which is not even called from main? import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.KeyAdapter; import javax.swing.JFrame; public class view extends JFrame{ public view(){ this.setSize(new Dimension(250, 250)); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void paint(Graphics g){ g.drawString("heello", 10, 10); } public static void main(String []args){ new view(); } }
answer count: 1
has title: graphics drawxxx method does not work
favorite count: 0
has answer: http://stackoverflow.com/a/24459768
type: UnansweredQuestion

http://stackoverflow.com/a/24570238
answers question: http://stackoverflow.com/q/24569386
upvote count: 9
has body: To get better matching results you should include these filtering methods in the given order. Perform matching in two directions i.e for each point in first image find the best match in second image and vice versa . Perform ratio test(ratio test of euclidean distances) between matches to eliminate ambiguous matches . Perform RANSAC test: it's a model fitting algorithm which finds the best data which fits the model and removes outliers. Perform homography: it is an image projection algorithm. You can get all the details of above methods in chapter 9 of Computer vision application programming cookbook. It also has sample code for implementing these filtering techniques. It is very easy to understand. (Note: The code in this book is in C++ but once you understand, it can be easily implemented in JAVA too)
score: 9
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24569386
type: Answer

http://stackoverflow.com/q/24501952
favorite count: 0
has answer: http://stackoverflow.com/a/24502074
has body: I want to understand how this works, I appreciate those who can help me, this is merely a part of the program itself,I only posted the part wherein I'm having problems of simulating. public static void outputArray(int[][] array) { int[] colSum =new int[array[0].length]; for (int i = 0; i &lt; array.length; i++){ int sum=0; for (int j = 0; j &lt; array[i].length; j++){ sum = sum + array[i][j]; &gt; colSum[j] += array[i][j]; // &lt;--- how this thing works } System.out.println("Print the sum of rows = " + sum); } for(int k=0;k&lt;colSum.length;k++){ System.out.println("Print the sum of columns =" + colSum[k]); } }
has title: How to simulate this multidimensional array code snippet by line,
accepted answer: http://stackoverflow.com/a/24501986
possible better answer: http://stackoverflow.com/a/24502074
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24501986
type: Question
answer count: 2
tagged with: arrays
score: 0
tagged with: multidimensional-array
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/24470884
upvote count: 0
answer count: 1
favorite count: 0
tagged with: maven
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has title: Spring maven in sts
has answer: http://stackoverflow.com/a/24471290
tagged with: java
tagged with: hibernate
downvote count: 1
type: Question
has body: I have the following problem, that's confusing me I would really appreciate your help: the problem is that when i downloaded the jars i need in the web-inf/lib directory my project works perfectly I'm using STS (maven, spring, hibernate) here is my controller: @RequestMapping(value ="/DisplayAll",method=RequestMethod.GET) public @ResponseBody String DisplayAll( Model model){ model.addAttribute("emPloye",employe.getAllEmploye()); return "Employe";} in my jsp NSS Nom Prenom Date De Naissance Lieu de Naissance Adresse Tel Poste ${e.nss} ${e.nom} ${e.prenom} ${e.dateDeNaissance} ${e.lieuDeNaissance} ${e.adresse} ${e.tel} ${e.poste} </c:forEach> now to the results i get: when I use Maven I get : the word Employe in a blak page when I directly paste the jars I need in lib folder, I get the list of employes I'm looking for I really need to use maven since it's not gd to everytime download the jar & copy it manually, Just to let you know the pom file contains the dependencies of the jars i downloaded manually (all)
score: -1
accepted answer: http://stackoverflow.com/a/24471290

http://stackoverflow.com/comment/37810044
has text: pls see my above [comment](http://stackoverflow.com/questions/24436466/classs-object-initialized-in-parent-activity-re-initialized-in-child-activity#comment37809965_24436466) Exactly my point. I don't want the controller's obj to get re-inited. What I don't understand is (leave apart logging the controller's obj in child :p ) why does the `onCreate` of parent activity re-inits the obj at all? :( I have a proper condition there and it was already init'ed before
type: Comment
comment on: http://stackoverflow.com/a/24436661
score: 0
type: AnswerComment

http://stackoverflow.com/q/24469230
tagged with: java
has answer: http://stackoverflow.com/a/24469322
has comment: http://stackoverflow.com/comment/37870850
type: Question
accepted answer: http://stackoverflow.com/a/24475054
possible better answer: http://stackoverflow.com/a/24469251
has comment: http://stackoverflow.com/comment/37870689
tagged with: eclipse
score: 0
answer count: 3
has title: How can I programmatically move to center EditText?
has body: How can I programmatically move the Password to the center using .AddRule (RelativeLayout.CENTER_VERTICAL);? LinearLayout PO = (LinearLayout)RV .findViewById(R.id.LL1); EditText ET = new EditText(getActivity()); ET.setId(1); ET.setHint("Your name"); ET.setInputType(0x00000061); ET.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); ET.setPadding(40,20,40,20); ET.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); //ET.addRule(RelativeLayout.CENTER_VERTICAL); PO.addView(ET); .addRule lit.
has answer: http://stackoverflow.com/a/24475054
tagged with: android
has comment: http://stackoverflow.com/comment/37870646
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24469251

http://stackoverflow.com/a/24509144
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24508746
has body: No, it is very hard to do a 2+2=4 kind of addition of manifest files etc. I see there are two ways to handle this: Use the external app: Check if the user has external app you want him to have. Else, direct him to the right link. You can get the package name of the publiched app and use it in this function: private boolean appInstalledOrNot(String uri) { PackageManager pm = getPackageManager(); boolean app_installed = false; try { pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); app_installed = true; } catch (PackageManager.NameNotFoundException e) { app_installed = false; } return app_installed ; } Combining code: This has no direct/correct answer. You need to study the code and integrate with your existing one.

http://stackoverflow.com/comment/51055794
comment on: http://stackoverflow.com/a/24471410
type: AnswerComment
has text: Should the onClick method be in the fragment that holds the RecyclerView ? Because you reference the mRecyclerView in your MyOnClickListener class. Where did you get the reference to that object ?
type: Comment
score: 19

http://stackoverflow.com/comment/37838826
type: Comment
comment on: http://stackoverflow.com/a/24451378
has text: db output and threds are passed by this but --ip and --seqs still not working .Should i change my script and take those values also as these arguements?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37861786
type: Comment
type: QuestionComment
has text: @user3580294 the return value is a fair claim! (Not that I agree with you because of it :) I guess it's open to interpretation if the "insert-sequence" should include repeating elements.
score: 0
comment on: http://stackoverflow.com/q/24464279

http://stackoverflow.com/q/24563576
answer count: 2
has body: I am working on a project where i have to create a Tone Listener such that i can record a tone using AudioRecord class of Android. This tone listener will listen to the tone and then will give out the frequency of the tone. I am using FFT for getting the frequency but am stuck as it does not give me the exact frequency. Is there any way that can work? I am in search of FFT and audio record class of android. The snippet of the code is as follows: while (isListening) { for (int t = 0; t &lt;= 5; t++) { // System.out.println("Inside for loop"); int numberOfShortsRead = audioRecord .read(audioData, audioSize, (kRecorderNumberOfSamples - audioSize)); // System.out.println("Read"+numberOfShortsRead); if (numberOfShortsRead &gt; 0) { System.out.println("inside read&gt;0"); System.out.println("Number of read" + numberOfShortsRead); audioSize += numberOfShortsRead; System.out .println("Final audio data size" + audioSize); System.out.println("Number Of Samples" + kRecorderNumberOfSamples); if (kRecorderNumberOfSamples == audioSize) { for (int i = 0; i &lt; audioSize; i++) { x[i] = audioData[i]; // real y[i] = 0; // imaginary } System.out.println("Inside FFT" + "x" + x + "y" + y); int i, j, k, n1, n2, a; double c, s, t1, t2; // Bit-reverse j = 0; n2 = n / 2; for (i = 1; i &lt; n - 1; i++) { n1 = n2; while (j &gt;= n1) { j = j - n1; n1 = n1 / 2; } j = j + n1; if (i &lt; j) { t1 = x[i]; x[i] = x[j]; x[j] = t1; t1 = y[i]; y[i] = y[j]; y[j] = t1; } } // FFT n1 = 0; n2 = 1; for (i = 0; i &lt; m; i++) { n1 = n2; n2 = n2 + n2; a = 0; for (j = 0; j &lt; n1; j++) { c = cos[a]; s = sin[a]; a += 1 &lt;&lt; (m - i - 1); for (k = j; k &lt; n; k = k + n2) { t1 = c * x[k + n1] - s * y[k + n1]; t2 = s * x[k + n1] + c * y[k + n1]; x[k + n1] = x[k] - t1; y[k + n1] = y[k] - t2; x[k] = x[k] + t1; y[k] = y[k] + t2; } } }
downvote count: 3
tagged with: fft
type: UnansweredQuestion
tagged with: android
score: -3
has title: Finding highest frequency from the recorded sound-includes FFT
has comment: http://stackoverflow.com/comment/38047945
has answer: http://stackoverflow.com/a/24580645
upvote count: 0
tagged with: java
favorite count: 0
tagged with: audiorecord
type: Question
has answer: http://stackoverflow.com/a/24573967
has comment: http://stackoverflow.com/comment/38046759

http://stackoverflow.com/a/24453058
answers question: http://stackoverflow.com/q/24452786
has comment: http://stackoverflow.com/comment/37840841
has body: Your regex checks for non-alphabets this includes comma and spaces. For this case you can try String extractedString = fullString .replaceAll("\\d", "").trim(); or String extractedString = fullString .replaceAll("[0-9]", "").trim(); You can check your regex online here. http://www.regexplanet.com/advanced/java/index.html
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/86185537
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/34161355
has text: Then I believe u need to checkout some methods to pass extra credentials along with url

http://stackoverflow.com/q/24511561
has title: Hibernate UUID generator in a single non identity field
has body: I'm trying to force hibernate producing UUID field in DB model but the problem is that this field is not a primary @Id field and cannot be done in this way. My model looks like this: @Entity @Table(name = "myModel") public class MyModel { private Long id; private UUID uuid; @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(columnDefinition = "BINARY", length = 16) @GenericGenerator(name = "uuid", strategy = "uuid2") public UUID getUuid() { return uuid; } public void setUuid(UUID uuid) { this.uuid = uuid; } } Is there any other way to implement this strategy? UPDATE: @Entity @Table(name = "myModel") public class MyModel { private Long id; private UUID uuid; @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(columnDefinition = "BINARY", length = 16) @Type(type="uuid-binary") public UUID getUuid() { return uuid; } public void setUuid(UUID uuid) { this.uuid = uuid; } } Note: @GenericGenerator is no longer necessary so has been removed.
tagged with: uuid
tagged with: java
tagged with: hibernate
type: Question
upvote count: 4
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/30478218
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/24543402
has body: There's many ways of doing this. Usually, you want to respond to some type of event in the fragment. For example, a button is pressed. From the fragment you can call the activity like this: CreateExerciseActivity activity = (CreateExerciseActivity) getActivity(); activity.createExercise(....); A better way would be for the activity to implement an interface IOptionSelectedListener for example. The interface could have a method called OnOptionSelected(value). Then you could do: IOptionSelectedListener listener = (IOptionSelectedListener) getActivity(); listener.OnOptionSelected(....); You could also pass the activity reference to the newInstance() method of the fragment, instead of calling getActivity(). The activity could also have a reference to the fragment and call a method on the fragment to get the actual value of the spinner.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24543328
downvote count: 0
answers question: http://stackoverflow.com/q/24543328
type: AcceptedAnswer

mergesort
tags question: http://stackoverflow.com/q/24500937
tag name: mergesort
type: Tag

http://stackoverflow.com/q/24437131
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47434905
upvote count: 6
has answer: http://stackoverflow.com/a/24437300
tagged with: cloning
has title: Java: How to deep-clone a HashSet neatly?
type: Question
has comment: http://stackoverflow.com/comment/37811402
has comment: http://stackoverflow.com/comment/37811466
tagged with: java
score: 6
answer count: 3
has comment: http://stackoverflow.com/comment/37810933
downvote count: 0
favorite count: 0
has body: I have a HashSet of MyObject that I need to clone. If MyObject implements a copy-constructor, what is the easiest, neatest way to clone Set myObjects Obviously I could do something like: Set&lt;MyObject&gt; myNewObjects = new Set&lt;MyObject&gt;(); for(MyObject obj: myObjects) myNewObjects.add(new MyObject(obj)); But I'm doing this as part of a loooong copy-construcotr, and I'd really like to just be able to do it in one line like: public myClass(MyClass toClone){ //... this.myObjects = new Set&lt;MyObjects&gt;(toClone.getmyObjects()); //... } Any suggestions?
has comment: http://stackoverflow.com/comment/37811287
has answer: http://stackoverflow.com/a/24437168

http://stackoverflow.com/q/24469257
has comment: http://stackoverflow.com/comment/37877805
tagged with: session
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/24469307
score: 5
has answer: http://stackoverflow.com/a/24469280
has answer: http://stackoverflow.com/a/24469324
has title: Global variable on servlet. is global for all sessions, or only for the current session?
favorite count: 0
upvote count: 5
answer count: 5
has comment: http://stackoverflow.com/comment/37877768
has body: I need to share information while the applicaiton is running; if I have: public class example extends HttpServlet { Object globalObject; doGet... doPost.... } A user is using the aplication through server and the object globalObject; if another user use the application, will share the object with the first user?
has answer: http://stackoverflow.com/a/24469301
has answer: http://stackoverflow.com/a/24469326
downvote count: 0
duplicate of: http://stackoverflow.com/q/3106452
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3106452

http://stackoverflow.com/a/24506521
has body: With H2, you need to use the CURRENT_DATE function instead of what you're using. CURRENT_DATE As others noted, there's standard SQL and some extensions to it (which are different in the different RDBMS providers/vendors). The CURRENT_DATE is part of the standard, the DATE function is not. So just use the standard function and you will be fine with both H2 and MySQL.
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24506491
has comment: http://stackoverflow.com/comment/37939990
has comment: http://stackoverflow.com/comment/37940358
type: Answer
has comment: http://stackoverflow.com/comment/37940275
has comment: http://stackoverflow.com/comment/37941979
has comment: http://stackoverflow.com/comment/37940040

http://stackoverflow.com/comment/37877987
comment on: http://stackoverflow.com/a/24473155
has text: It would be nice if you give the author some pseudocode because you don't really answer his/her query. Otherwise, this post is just like a comment.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24562759
accepted answer of: http://stackoverflow.com/q/24562576
answers question: http://stackoverflow.com/q/24562576
has body: There's TYPE operator in JPQL, you can use it as following: SELECT e FROM EntityClass WHERE TYPE(e) = EntityClassSubclass You can use this query and then write generic method which casts results to desired type. i.e. private static &lt;T extends SuperClass&gt; List&lt;T&gt; queryForClass(Class&lt;T&gt; myClass) { Query q = em.createQuery("SELECT p FROM SuperClass p WHERE TYPE(p) = :myClass"); q.setParameter("myClass", myClass); List&lt;? extends SuperClass&gt; resultList = q.getResultList(); return (List&lt;T&gt;) resultList; }
has comment: http://stackoverflow.com/comment/110147436
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38047249
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24466911
has body: This line and the others like it are probably the problem: if (age &lt; 30 &amp;&amp; isStudying == false &amp;&amp; isEmployed == false || true) That condition will always be true, because it evaluates like this: if ( ( (age &lt; 30) &amp;&amp; (isStudying == false) &amp;&amp; (isEmployed == false) ) || true ) I don't know what you were trying to represent with the || true at the end, but it's likely to be a problem. Some other notes: Don't use == with booleans. Instead, just use the boolean, and if you're looking for a negative use !. So isStudying if they're studying, and !isStudying if they aren't. &lt; 30 and &gt; 30 are not the only possibilities. Someone can also be 30. You probably wanted &lt; 30 and &gt;= 30 as conditions (and similarly for 65). There shouldn't be a ; after public int getStatus(int age) before the opening { Side note: The assignment is really weird. You wouldn't have an instance of a Student class and set it up so that getStatus said they were retired. That just doesn't make any sense. You didn't show the table, but here's a version that says: A student is someone who is under 30, studying, and not employed An employee is someone who is at least 30, not studying, and employed (note that we don't care that they may be 65 or older) A retired person is someone who is at least 65, not studying, and not employed Otherwise, they're something else (as I'm fairly sure we can fail to match all three of those) In code: public int getStatus(int age) { //begin method this.age = age; if (age &lt; 30 &amp;&amp; isStudying &amp;&amp; !isEmployed) { System.out.println(name + " is a student"); } else if (age &gt;= 30 &amp;&amp; !isStudying &amp;&amp; isEmployed) { System.out.println(name + " is an employee"); } else if (age &gt;= 65 &amp;&amp; !isStudying &amp;&amp; !isEmployed) { System.out.println(name + " is retired"); } else { System.out.println(name + " is something else"); } } //end method This is indended as an example of how you might approach that …
answers question: http://stackoverflow.com/q/24466332
has comment: http://stackoverflow.com/comment/37866432
has comment: http://stackoverflow.com/comment/37868591
has comment: http://stackoverflow.com/comment/37866500
has comment: http://stackoverflow.com/comment/37866578
score: 0
type: Answer

http://stackoverflow.com/comment/37826475
comment on: http://stackoverflow.com/a/24444791
type: Comment
has text: Make sure you have data first, try it in terminal using sqlite or you can download a sqlite browser for mozilla firefox
score: 0
type: AnswerComment

http://stackoverflow.com/q/24459735
tagged with: java
linked to: http://stackoverflow.com/q/24317210
tagged with: loops
has answer: http://stackoverflow.com/a/24588809
has body: package net.NitroCruze.mrpg.baseengine.music; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; public class CPSound implements Runnable{ AudioInputStream as1; AudioFormat af; Clip clip1; DataLine.Info info; Line line1; public CPSound() { Thread soundThread; soundThread = new Thread(this, "Sound"); soundThread.start(); } public void play() { try{ as1 = AudioSystem.getAudioInputStream(new FileInputStream(new File("/res/music.wav"))); af = as1.getFormat(); clip1 = AudioSystem.getClip(); info = new DataLine.Info(Clip.class, af); line1 = AudioSystem.getLine(info); } catch(Exception e) { } if ( ! line1.isOpen() ) { try { clip1.open(as1); } catch (Exception e) { } clip1.loop(Clip.LOOP_CONTINUOUSLY); clip1.start(); } } public void run() { play(); } } Why does this not work? It gives me a NullPointerException?
type: Question
has title: Why does this WAV file not play? It gives me a NullPointerException
tagged with: wav
has comment: http://stackoverflow.com/comment/37852820
accepted answer: http://stackoverflow.com/a/24588809
answer count: 1
has comment: http://stackoverflow.com/comment/37852800
has comment: http://stackoverflow.com/comment/37852909
has comment: http://stackoverflow.com/comment/37852922
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/24585237
tagged with: arraylist
has comment: http://stackoverflow.com/comment/38086116
has comment: http://stackoverflow.com/comment/38086133
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24585270
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38086220
upvote count: 1
score: -2
has comment: http://stackoverflow.com/comment/38086202
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24585267
has body: i have a question about creating a new array list. If i create a new one, with ArrayList &lt;?&gt; listtwo = new ArrayList&lt;?&gt;(); What can i put into the array? Can i put Strings and Integers in it? Or how does this work. I know that if you create an list like : ArrayList&lt;String&gt; list =new ArrayList&lt;String&gt;(); that you can only put Strings in it. and if u try to do something else it gives a compile exception.
has answer: http://stackoverflow.com/a/24585270
linked to: http://stackoverflow.com/q/24574478
possible better answer: http://stackoverflow.com/a/24585267
has title: Creating a new ArrayList

http://stackoverflow.com/a/24475586
score: 1
accepted answer of: http://stackoverflow.com/q/24475013
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24475013
upvote count: 1
has body: You should think about closing your app twice, since it is not the way Android apps usually work. Instead of this you should use the code as follow: @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_exit) { finish() } return super.onOptionsItemSelected(item); } If you really want to exit your application manually, please check out the accepted answer from the following post: How to close Android application?

http://stackoverflow.com/comment/38032362
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24556276
has text: How can I fix this issue? Or is there a way at all?

http://stackoverflow.com/comment/37853464
type: AnswerComment
comment on: http://stackoverflow.com/a/24459327
type: Comment
has text: okay when I change fragment to FrameLayout the activity starts properly, but i do not have the historylist.xml as layout. It is just a blank layout. Do you know where I can fix that?
score: 0

http://stackoverflow.com/comment/37945335
comment on: http://stackoverflow.com/a/24508178
score: 0
has text: @YuvalLevy It doesn't *need* to be, but it gaurentees that a thread cannot change it. If that happened, then objects waiting on the old instance would not be notified by calls to the new object.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38015172
score: 0
type: QuestionComment
type: Comment
has text: What is _the spring listener_? Show us. How is `@ManagedProperty` related to this spring listener?
comment on: http://stackoverflow.com/q/24546793

http://stackoverflow.com/comment/37825616
type: QuestionComment
has text: @Sankumarsingh is tr any solution to came out from this
score: 0
comment on: http://stackoverflow.com/q/24429232
type: Comment

http://stackoverflow.com/comment/37911186
comment on: http://stackoverflow.com/q/24490751
score: 0
type: Comment
type: QuestionComment
has text: Have you tried the obvious: `ProcessBuilder pb2=new ProcessBuilder("/home/abhijeet/sample1.sh param1=abc param2=xyz");`?

http://stackoverflow.com/comment/37954860
comment on: http://stackoverflow.com/q/24514841
has text: yes, it's filled when in a `ServletContextListener`
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24541112
type: Question
downvote count: 0
has title: Decrypt data using RSA between PHP and Java Android issue
tagged with: phpseclib
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40797896
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: php
has body: I am using a PHP server to encrypt some data and then decrypt it to an Android device. But when I try to decrypt it on the Android device side, I get the following error : javax.crypto.BadPaddingException: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02 When I am on Cipher.getInstance("RSA/ECB/PKCS1Padding"); I am encrypting the value on a PHP server using PHPSeclips Library (last github version at this date) and signing as well. This part does actually works because already used to be decoded on a Javacard program so the error does not actually belongs here. This is the way I proceed on Android side : protected byte[] decryptData(String alias, byte[] data) throws InvalidKeyException, NoSuchPaddingException, NoSuchAlgorithmException, NoSuchProviderException, BadPaddingException, IllegalBlockSizeException, UnsupportedOperationException { Log.i(TAG, "decryptData() Decrypt data " + HexStringConverter.byteArrayToHexString(data)); byte[] decryptedData = null; PrivateKey privateKey = getPrivateKey(alias); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(Cipher.DECRYPT_MODE, privateKey); decryptedData = cipher.doFinal(data); Log.i(TAG, "decryptData() Decrypted data: " + HexStringConverter.byteArrayToHexString(decryptedData)); return decryptedData; } With the getPrivateKey() method : protected RSAPrivateKey getPrivateKey(String alias) { try { KeyStore ks = KeyStore.getInstance("AndroidKeyStore"); ks.load(null); KeyStore.Entry entry = ks.getEntry(alias, null); if (!(entry instanceof KeyStore.PrivateKeyEntry)) { Log.w(TAG, "getPrivateKey() Not an instance of a PrivateKeyEntry"); } return (RSAPrivateKey) ((KeyStore.PrivateKeyEntry) entry).getPrivateKey(); } catch (NoSuchAlgorithmException e) { Log.w(TAG, "getPrivateKey() ", e); } catch (KeyStoreException e) { Log.w(TAG, "getPrivateKey() ", e); } catch (CertificateException e) { Log.w(TAG, "getPrivateKey() ", e); } catch (IOException e) { Log.w(TAG, "getPrivateKey() ", e); …
score: 1
tagged with: java
tagged with: rsa
has answer: http://stackoverflow.com/a/24555624
has comment: http://stackoverflow.com/comment/42906379

http://stackoverflow.com/a/24551101
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24550234
has body: The error went away once I cleaned my project and restarted eclipse. No changes were required.
answers question: http://stackoverflow.com/q/24550234

http://stackoverflow.com/q/24560138
has answer: http://stackoverflow.com/a/24560256
has comment: http://stackoverflow.com/comment/38039765
has answer: http://stackoverflow.com/a/24560276
downvote count: 0
answer count: 7
favorite count: 0
has title: Java compareTo method basics
has comment: http://stackoverflow.com/comment/38040102
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38039952
has answer: http://stackoverflow.com/a/24560321
has comment: http://stackoverflow.com/comment/38039988
has answer: http://stackoverflow.com/a/24560258
has answer: http://stackoverflow.com/a/24560241
has comment: http://stackoverflow.com/comment/38039886
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38039938
has answer: http://stackoverflow.com/a/24561812
has comment: http://stackoverflow.com/comment/38039805
has comment: http://stackoverflow.com/comment/38039843
type: Question
has answer: http://stackoverflow.com/a/24560450
has comment: http://stackoverflow.com/comment/38039887
has comment: http://stackoverflow.com/comment/38039987
has body: I am relatively new to Java and trying to solve some basic questions. One of my friends asked me to explain what can go wrong with this piece of code. To me it looks perfectly fine. I even tried it out and it works. Can you guys help me out with it? public int compareTo(Object o){ Employee emp = (Employee) o; return this.id - o.id; } I could not find any good explanations for it. Also id is an integer.

http://stackoverflow.com/comment/37934648
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24503082
has text: @radar33 I don't understand the use-case: why not put all the methods in an abstract class, implement whatever you want and then extend that class with your `MyClass` (and implement there the abstract methods) ? what's the added-value of an additional interface ?

android
tags question: http://stackoverflow.com/q/24515120
tags question: http://stackoverflow.com/q/24531606
tags question: http://stackoverflow.com/q/24486698
tags question: http://stackoverflow.com/q/24431088
tags question: http://stackoverflow.com/q/24522049
tags question: http://stackoverflow.com/q/24582226
tags question: http://stackoverflow.com/q/24558093
tags question: http://stackoverflow.com/q/24461745
tags question: http://stackoverflow.com/q/24429285
tags question: http://stackoverflow.com/q/24536977
tags question: http://stackoverflow.com/q/24478376
tags question: http://stackoverflow.com/q/24568477
tags question: http://stackoverflow.com/q/24439799
tags question: http://stackoverflow.com/q/24467374
tags question: http://stackoverflow.com/q/24575308
tags question: http://stackoverflow.com/q/24449271
tags question: http://stackoverflow.com/q/24501944
tags question: http://stackoverflow.com/q/24485178
tags question: http://stackoverflow.com/q/24579726
tags question: http://stackoverflow.com/q/24459779
tags question: http://stackoverflow.com/q/24569180
tags question: http://stackoverflow.com/q/24535900
tags question: http://stackoverflow.com/q/24487756
tags question: http://stackoverflow.com/q/24525750
tags question: http://stackoverflow.com/q/24484662
tags question: http://stackoverflow.com/q/24544360
tags question: http://stackoverflow.com/q/24452786
tags question: http://stackoverflow.com/q/24469475
tags question: http://stackoverflow.com/q/24537621
tags question: http://stackoverflow.com/q/24571317
tags question: http://stackoverflow.com/q/24461578
tags question: http://stackoverflow.com/q/24514078
tags question: http://stackoverflow.com/q/24495353
tags question: http://stackoverflow.com/q/24429905
tags question: http://stackoverflow.com/q/24499347
tags question: http://stackoverflow.com/q/24475013
tags question: http://stackoverflow.com/q/24453685
tags question: http://stackoverflow.com/q/24550896
tags question: http://stackoverflow.com/q/24484019
tags question: http://stackoverflow.com/q/24522148
tags question: http://stackoverflow.com/q/24488447
tags question: http://stackoverflow.com/q/24564976
tags question: http://stackoverflow.com/q/24475851
tags question: http://stackoverflow.com/q/24428326
tags question: http://stackoverflow.com/q/24575637
tags question: http://stackoverflow.com/q/24464915
tags question: http://stackoverflow.com/q/24563783
tags question: http://stackoverflow.com/q/24436466
tags question: http://stackoverflow.com/q/24448110
tags question: http://stackoverflow.com/q/24505051
tags question: http://stackoverflow.com/q/24468836
tags question: http://stackoverflow.com/q/24507626
tags question: http://stackoverflow.com/q/24512751
tags question: http://stackoverflow.com/q/24457129
tags question: http://stackoverflow.com/q/24527767
tags question: http://stackoverflow.com/q/24467294
tags question: http://stackoverflow.com/q/24448917
tags question: http://stackoverflow.com/q/24513243
tags question: http://stackoverflow.com/q/24468705
tags question: http://stackoverflow.com/q/24515102
tags question: http://stackoverflow.com/q/24527473
tags question: http://stackoverflow.com/q/24447942
tags question: http://stackoverflow.com/q/24491067
tags question: http://stackoverflow.com/q/24446109
tags question: http://stackoverflow.com/q/24485819
tags question: http://stackoverflow.com/q/24478454
tags question: http://stackoverflow.com/q/24483813
tags question: http://stackoverflow.com/q/24580792
tags question: http://stackoverflow.com/q/24501493
tags question: http://stackoverflow.com/q/24569727
tags question: http://stackoverflow.com/q/24482379
tags question: http://stackoverflow.com/q/24551093
tags question: http://stackoverflow.com/q/24541112
tags question: http://stackoverflow.com/q/24577811
tags question: http://stackoverflow.com/q/24569518
tags question: http://stackoverflow.com/q/24553673
tags question: http://stackoverflow.com/q/24546013
tags question: http://stackoverflow.com/q/24476878
tags question: http://stackoverflow.com/q/24517165
tags question: http://stackoverflow.com/q/24533017

http://stackoverflow.com/comment/37989237
has text: use a Data base or [java files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html) with [input](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newInputStream%28java.nio.file.Path,%20java.nio.file.OpenOption...%29) and [output](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newOutputStream%28java.nio.file.Path,%20java.nio.file.OpenOption...%29) streams
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24533103
score: 0

http://stackoverflow.com/a/24512350
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38026631
upvote count: 2
has comment: http://stackoverflow.com/comment/37951833
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37952062
accepted answer of: http://stackoverflow.com/q/24511424
has comment: http://stackoverflow.com/comment/37952579
answers question: http://stackoverflow.com/q/24511424
has body: Elastic Beanstalk is mostly unaware of the application server internals, including servlet context listeners. Beanstalk will health check your environment resources, and, if your instances are not responding, they may be replaced according to your auto-scaling configuration. This is probably the reason why you see more instances coming up without traffic. The application health monitoring performed by Elastic Beanstalk is described here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.healthstatus.html It is probably a better idea to setup your instances using .config files than context listener init(), see: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.customami.html
downvote count: 0
has comment: http://stackoverflow.com/comment/37950777

http://stackoverflow.com/q/24529416
has title: jaxb hide child element when parent element is xsi:nil=true
tagged with: unmarshalling
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37985612
has comment: http://stackoverflow.com/comment/37990311
duplicate of: http://stackoverflow.com/q/24303474
answer count: 0
has comment: http://stackoverflow.com/comment/37985927
tagged with: java
tagged with: jaxb
has body: I have below xml, when offer element has xsi:nil="true" then i dont want to show childrean elements even that child element xsi:nil=true, In the beloe xml i have four offer elements, i want to show child elements(endDate) only for the first two Offer elements. How can i do that in jaxb? <snapshots xmlns="http://ws.sample.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" query="after=2014-06-25" type="web"> 2014-07-02 2014-09-25
tagged with: marshalling
type: Question
has comment: http://stackoverflow.com/comment/37990759
linked to: http://stackoverflow.com/q/24303474
score: 0

http://stackoverflow.com/comment/37866109
type: AnswerComment
score: 0
has text: give a sec i'm updating it
type: Comment
comment on: http://stackoverflow.com/a/24466850

http://stackoverflow.com/a/24547231
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38041595
accepted answer of: http://stackoverflow.com/q/24522519
answers question: http://stackoverflow.com/q/24522519
type: AcceptedAnswer
downvote count: 0
has body: The update method can change only rows that already exist in the table. However, the app never inserts any row into the table. The row should be added when the database is created: public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + ...); db.execSQL("INSERT INTO " + DATABASE_TABLE + " DEFAULT VALUES"); }

http://stackoverflow.com/comment/37999724
has text: You wouldn't have all these problems if, instead of extending PrintWriter, you wrapped (or decorated) it.
type: Comment
comment on: http://stackoverflow.com/q/24538386
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38069830
comment on: http://stackoverflow.com/a/24575488
has text: how the above scheduled executor service identify my specific java function defined else where? sorry, am a beginner to programming.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24514257
answers question: http://stackoverflow.com/q/24509721
type: Answer
upvote count: 1
has body: When you unload the page (which also happens when you refresh it), all ongoing requests are aborted and you get a StatusCodeException with a getStatusCode() of 0 (note: you'll get the same behavior whichever the trigger for aborting the request: network error, etc.) You could then check the status code in your onFailure, but if you don't want false positives for other cases of status code 0, you'll have to listen for WindowClosingEvent and set a flag there. Just be sure to set the flag back at some other event (e.g. a successful response, or non-0 failure) in case the user cancels the navigation.
downvote count: 0
score: 1

http://stackoverflow.com/comment/38026991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24551822
has text: So the fault is in the new version of Intellij
score: 0

http://stackoverflow.com/comment/37992648
score: 0
type: QuestionComment
type: Comment
has text: Make sure `TracingConstants` class exists in the dependency libraries for the war project or in your war project. Also, if you can, [**stop using scriptlets at all**](http://stackoverflow.com/q/3177733/1065197).
comment on: http://stackoverflow.com/q/24534965

http://stackoverflow.com/comment/37795668
type: AnswerComment
type: Comment
has text: @ gexicide : NO. (unfortunatly)
comment on: http://stackoverflow.com/a/24428810
score: 0

http://stackoverflow.com/a/24499835
accepted answer of: http://stackoverflow.com/q/24460969
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24460969
has body: I figured out the problem. It turns out the hInstance needs to be declared as 'int' and not 'long.' After i continued playing around with the code i finally was able to communicate from Java and send a string. The code is below in case anyone would like it as an example. It is actual working code that connects and sends a string. You are able to add all of the EHLAPI functions with ease with this code below: import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform; import com.sun.jna.platform.win32.Kernel32; public class RumbaConnect { public interface ehlapi32 extends Library { ehlapi32 ehlapi32 = (ehlapi32) Native.loadLibrary( (Platform.isWindows() ? "ehlapi32" : "ehlapi32"), ehlapi32.class); public int WD_ConnectPS(int hInstance , String ShortName); public int WD_SendKey(int hInstance, String KeyData); } public static final ehlapi32 ehlapi32 = (ehlapi32) Native.loadLibrary("ehlapi32", ehlapi32.class); public static final Kernel32 kernel32 = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class); public static void main(String[] args) { int process = 0; int status = 0; int intResult = 0; process = kernel32.GetCurrentProcessId(); status = ehlapi32.WD_ConnectPS(process, "A"); intResult = ehlapi32.WD_SendKey(process, "MYNAME"); System.out.println("Your Rumba Status: " + status); } /* 0 The function was successful 1 An incorrect PSID was specified 8 No prior call to Start Communication Notification (80) function was called for the PSID 9 A system error was encountered */ }
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/64217120
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24537059
has body: You can get android.jar file from https://github.com/Sable/android-platforms and just paste it into the location that is shown in bash. This will work fine on Windows, Linux and may be on Mac(haven't tried yet).

http://stackoverflow.com/comment/49722667
type: AnswerComment
has text: @CommonsWare I am still a bit confused about the verdict, I want to use it on android 4.0+, can I use multicatch and try-with-resource or not?
comment on: http://stackoverflow.com/a/24574892
type: Comment
score: 1

http://stackoverflow.com/q/24583648
tagged with: datainputstream
tagged with: sockets
type: AnsweredQuestion
tagged with: java
type: Question
score: 2
has comment: http://stackoverflow.com/comment/38083480
has title: DataInputStream receives inaccurate
downvote count: 0
has answer: http://stackoverflow.com/a/24583742
has body: This problem is really giving me headache. Very simple scenario. Send and receive file over TCP using DataInputStream. This is the write method private boolean send(File file) { try { FileInputStream fileIStream = new FileInputStream(file); BufferedInputStream bufferedIStream = new BufferedInputStream(fileIStream); DataInputStream dataIStream = new DataInputStream(bufferedIStream); byte [] buffer = new byte [sendBufferSize]; dataOStream.writeInt(ID); dataOStream.writeUTF(file.getName()); dataOStream.writeLong(file.length()); dataOStream.writeUTF(data1); dataOStream.writeUTF(data2); dataOStream.writeInt(number1); //dataOStream.flush(); tried to flush here if writing data might be the problem int write, total=0; //Starting to send while((write = dataIStream.read(buffer)) &gt;= 0) { dataOStream.write(buffer); total+=write; System.out.println("size: " + file.length() + " write: " + write + " total: " + total); } dataIStream.close(); dataOStream.flush(); return true; } catch (IOException e) { e.printStackTrace(); return false; } } And this is the output size: 1830918 write: 8192 total: 8192 size: 1830918 write: 8192 total: 16384 size: 1830918 write: 8192 total: 24576 size: 1830918 write: 8192 total: 32768 size: 1830918 write: 8192 total: 40960 size: 1830918 write: 8192 total: 49152 size: 1830918 write: 8192 total: 57344 size: 1830918 write: 8192 total: 65536 ............... ............... ............... size: 1830918 write: 8192 total: 1802240 size: 1830918 write: 8192 total: 1810432 size: 1830918 write: 8192 total: 1818624 size: 1830918 write: 8192 total: 1826816 size: 1830918 write: 4102 total: 1830918 Everything seems fine until now. The problem is with reading the data. Here is how I read private boolean receiveBinary() { try { final int ID = dataIStream.readInt(); final String fileName = dataIStream.readUTF(); final long fileSize = dataIStream.readLong(); final String data1 = dataIStream.readUTF(); final String data2 = dataIStream.readUTF(); final int number1 = da…
accepted answer: http://stackoverflow.com/a/24583742
answer count: 1
linked to: http://stackoverflow.com/q/9520911
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/38070519
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24574255
has text: You don't need to cancel the key after closing the channel. It happens automatically.

http://stackoverflow.com/q/24579104
score: 0
linked to: http://stackoverflow.com/q/7291053
tagged with: matrix
has comment: http://stackoverflow.com/comment/38092852
has comment: http://stackoverflow.com/comment/38075861
has comment: http://stackoverflow.com/comment/38075117
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38093165
answer count: 0
tagged with: bitmap
has comment: http://stackoverflow.com/comment/38093759
type: Question
tagged with: rotation
has title: Android Java - set angle with postRotate
has body: Basically I need to be able to set an image's angle to a degree using postRotate. It seems setRotate does this job perfectly but it also rewrites the matrix... How can I fix this? Edit: pskink saves the day, and here's a better version of my question Android - getting the current rotation of a matrix
tagged with: java

http://stackoverflow.com/a/24484075
answers question: http://stackoverflow.com/q/24483495
type: Answer
has comment: http://stackoverflow.com/comment/37898966
has body: IMHO there are few questions to ask before trying to solve this problem : should the sort be case sensitive (I suppose not) should the sort be optimized for a great number of names (I suppose not) should the array be sorted in place (I suppose yes) If the answer to the second question is true, a correct algorithm must be implemented (quick sort, merge sort), and the lowercased name must be pre-calculated, if not a direct bubble sort is enough (O(n2/2) but simpler to implement) int k; String[] temp; for (int i=0; i&lt;len(Names) - 1; i++) { k = i; for (j=i + 1; i&lt;len(Names); j++) { if (Names[k][1].toLowerCase().compareTo(Names[i][1].toLowerCase()) &lt; 0) { k = j; } } if (k != i) { temp = Names[i]; Names[i] = Names[k]; Names[k] = temp; } } If String.compareTo is not allowed, it simply has to be re-implemented and I suppose there are no accented chars in last name (é, è, ö, ü, etc.) int compare(String a, String b) { int n = (a.size() &lt; b.size()) ? a.size(), b.size(); int delta; for (int i =0; i&lt;n, i++) { delta = a.codePointAt(i) &lt; b.codePointAt(j); if (delta != 0) { return delta; } } return len(b) - len(a); } and the line if (Names[k][1]..compareTo(Names[i][1]...) { has to be rewritten as : if (compare(Names[k][1].toLowerCase(), Names[i][1].toLowerCase()) &lt; 0) { This algorithm is really badly optimized, but it was simple to write (and would be simple to test). It is then possible to add as needed : better sort algo (quick sort) pre calculation of lowercase last name management of accented characters.
score: 0

http://stackoverflow.com/comment/37821556
type: Comment
type: QuestionComment
has text: If you're finding the lack of multiple inheritance of classes a problem, you should really take a hard look at your class hierarchy. Multiple inheritance shouldn't be something that you rely on/need in Java, for the most part.
score: 5
comment on: http://stackoverflow.com/q/24442646

http://stackoverflow.com/a/24497506
has comment: http://stackoverflow.com/comment/37923786
score: 2
answers question: http://stackoverflow.com/q/24497295
has body: You can pass the reference of the JTextArea to the constructor of the ActionListener: public class StopTest implements ActionListener { private JTextArea area; public StopTest(JTextArea area) { this.area = area; } public void actionPerformed(ActionEvent e) { String stop = "The test has been stopped"; area.setText(stop); } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24497295
type: Answer
upvote count: 2

http://stackoverflow.com/q/24486574
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37904506
has comment: http://stackoverflow.com/comment/37912106
has body: I have mixin java and groovy code as below inside a grails 2.2.3 app, ├── src │ ├── groovy │ │ └── eccount │ │ ├── Query.groovy // extends Queries.DefaultQuery │ │ ├── Listener.groovy │ │ ├── Elasticsearch.groovy │ │ ├── Queries.groovy // extends ElaticsearchQueries │ └── java │ └── eccount │ ├── ElasticsearchQueries.java // public class │ ├── EsServer.java I have been using src/java mostly from grails-app/services definitely written in groovy which is fine. But when tried to access existing src/java from src/groovy looks strange. The ElasticsearchQueries.java factory class is as below, package eccount; public class ElasticsearchQueries { public static class DefaultQuery implements IQuery { // } } Groovy implementation class is as below, package eccount; public class Queries extends ElasticsearchQueries { // } package eccount; public class Query extends Queries.DefaultQuery { // } As per my understanding it should have worked. But I assume its some other issues. Here's the stacktrace of grails clean &amp;&amp; grails compile, src/groovy/eccount/Query.groovy: 3: unable to resolve class Queries.DefaultQuery @ line 3, column 1. public class Query extends Queries.DefaultQuery { ^ 1 error Github code - gccount-groovy-groovy-java
has comment: http://stackoverflow.com/comment/37906074
tagged with: java
has comment: http://stackoverflow.com/comment/37904557
has comment: http://stackoverflow.com/comment/37906816
tagged with: grails
type: Question
score: 0
has title: extend inner java class from groovy in grails 2.2.3
tagged with: groovy
has comment: http://stackoverflow.com/comment/37911585
has comment: http://stackoverflow.com/comment/37906488
has comment: http://stackoverflow.com/comment/37907851
has comment: http://stackoverflow.com/comment/37903469
has comment: http://stackoverflow.com/comment/37903668
has comment: http://stackoverflow.com/comment/37906113

http://stackoverflow.com/q/24558601
upvote count: 0
score: -1
answer count: 1
has title: android HTML Scraping with Jsoup crashes
favorite count: 0
tagged with: android-asynctask
has body: I tried to write a Simple app that changes the TextView to the title on Google Html using Jsoup. But when I run it, the app crashes. Anyone have any idea why? I think It might be something wrong with the Asynk task, can someone have a look at the code and tell me were the error is? import java.io.IOException; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.TextView; import android.widget.Toast; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; public class HttpExample extends Activity{ TextView tvResult; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.http); tvResult = (TextView)findViewById(R.id.tvHttp); new Title().execute(); } private class Title extends AsyncTask &lt;Void,Void,Void&gt;{ String title; @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub try { // Connect to the web site Document document = Jsoup.connect("http://www.google.com").get(); // Get the html document title title = document.title(); } catch (IOException e) { e.printStackTrace(); } return null; }//doInBackground() protected void onPostExecute(Void result) { // Set title into TextView tvResult.setText(title); }//onPostExecute() }//Title class }//Activity Thank you so much for answering...
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/37866878
has comment: http://stackoverflow.com/comment/63273715
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: web-scraping
downvote count: 1
type: Question

http://stackoverflow.com/a/52468162
upvote count: 43
has comment: http://stackoverflow.com/comment/107002865
answers question: http://stackoverflow.com/q/24563694
has comment: http://stackoverflow.com/comment/106170003
type: Answer
has comment: http://stackoverflow.com/comment/106989092
has comment: http://stackoverflow.com/comment/95526544
has body: Go To ->Manage Jenkins -> Configure Global Security -> Plugin Manager and check the box for Use browser for metadata download. It will solve the problem.
score: 29
has comment: http://stackoverflow.com/comment/110905837
has comment: http://stackoverflow.com/comment/120353221
downvote count: 14
has comment: http://stackoverflow.com/comment/112709888

http://stackoverflow.com/a/30840254
downvote count: 0
has body: A bit more Code would be helpful. Anyway, you could try the following: paintCanvas.addListener(SWT.MouseVerticalWheel, new Listener() { @Override public void handleEvent(Event event) { event.doit = false; } }); But I don't think that this will work, since MouseEvents aren't TraverseEvents. I couldn't test it for myself with your code snippet.
type: Answer
answers question: http://stackoverflow.com/q/24527996
score: 1
upvote count: 1

http://stackoverflow.com/a/24469301
upvote count: 2
answers question: http://stackoverflow.com/q/24469257
type: Answer
has body: with HttpSession your variable will be related to each users session, not the application itself you can do this as follow ServletContext application = getServletConfig().getServletContext(); String data = "test"; application.setAttribute("variable", data); String data_rtrvd= (String) application.getAttribute("variable"); Is JSP code you can do: &lt;jsp:useBean id="obj" class="my.package.name.MyClass" scope="application" /&gt;
score: 2
downvote count: 0

deserialization
type: Tag
tags question: http://stackoverflow.com/q/24519595
tags question: http://stackoverflow.com/q/24547211
tag name: deserialization
tags question: http://stackoverflow.com/q/24428919
tags question: http://stackoverflow.com/q/24455381

http://stackoverflow.com/comment/43981626
has text: If you already have both 64 and 32 bit java installed, make sure to add a line like this one in your batch before the line in which you run mxmlc : set JAVA_HOME="C:\Program Files (x86)\Java\jre6" mxmlc styles.css
type: AnswerComment
comment on: http://stackoverflow.com/a/25872837
type: Comment
score: 1

http://stackoverflow.com/comment/38088075
comment on: http://stackoverflow.com/q/24586211
score: 0
type: Comment
type: QuestionComment
has text: You should be getting an error indicator in the editor, the packages view and the problems view.

http://stackoverflow.com/comment/37916202
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24493233
type: QuestionComment
has text: @Vash-DamianLeszczyński: "What problem you try to solve..." almost certainly homework.

javafx
tags question: http://stackoverflow.com/q/24575489
tags question: http://stackoverflow.com/q/24469537
tags question: http://stackoverflow.com/q/24561725
type: Tag
tags question: http://stackoverflow.com/q/24434498
tags question: http://stackoverflow.com/q/24441810
tags question: http://stackoverflow.com/q/24548550
tags question: http://stackoverflow.com/q/24578517
tags question: http://stackoverflow.com/q/24581705
tags question: http://stackoverflow.com/q/24448002
tags question: http://stackoverflow.com/q/24533034
tags question: http://stackoverflow.com/q/24430121
tags question: http://stackoverflow.com/q/24442235
tags question: http://stackoverflow.com/q/24449585
tags question: http://stackoverflow.com/q/24471513
tags question: http://stackoverflow.com/q/24539934
tags question: http://stackoverflow.com/q/24463064
tags question: http://stackoverflow.com/q/24519668
tags question: http://stackoverflow.com/q/24566767
tags question: http://stackoverflow.com/q/24453103
tags question: http://stackoverflow.com/q/24472170
tags question: http://stackoverflow.com/q/24564973
tags question: http://stackoverflow.com/q/24436196
tags question: http://stackoverflow.com/q/24515008
tag name: javafx
tags question: http://stackoverflow.com/q/24559245
tags question: http://stackoverflow.com/q/24486171
tags question: http://stackoverflow.com/q/24499984
tags question: http://stackoverflow.com/q/24542171
tags question: http://stackoverflow.com/q/24520266
tags question: http://stackoverflow.com/q/24525389
tags question: http://stackoverflow.com/q/24486353
tags question: http://stackoverflow.com/q/24587342
tags question: http://stackoverflow.com/q/24458155
tags question: http://stackoverflow.com/q/24430191
tags question: http://stackoverflow.com/q/24531003
tags question: http://stackoverflow.com/q/24466007
tags question: http://stackoverflow.com/q/24513026
tags question: http://stackoverflow.com/q/24565539
tags question: http://stackoverflow.com/q/24452410
tags question: http://stackoverflow.com/q/24553010
tags question: http://stackoverflow.com/q/24441461
tags question: http://stackoverflow.com/q/24559472
tags question: http://stackoverflow.com/q/24511611
tags question: http://stackoverflow.com/q/24569257
tags question: http://stackoverflow.com/q/24517571
tags question: http://stackoverflow.com/q/24452192
tags question: http://stackoverflow.com/q/24499500
tags question: http://stackoverflow.com/q/24460114
tags question: http://stackoverflow.com/q/24467199
tags question: http://stackoverflow.com/q/24509804
tags question: http://stackoverflow.com/q/24428567
tags question: http://stackoverflow.com/q/24540630
tags question: http://stackoverflow.com/q/24454116
tags question: http://stackoverflow.com/q/24518081
tags question: http://stackoverflow.com/q/24438291
tags question: http://stackoverflow.com/q/24454936
tags question: http://stackoverflow.com/q/24429809
tags question: http://stackoverflow.com/q/24445252
tags question: http://stackoverflow.com/q/24501544

http://stackoverflow.com/comment/37958420
type: Comment
comment on: http://stackoverflow.com/q/24516107
score: 0
type: QuestionComment
has text: Well, yes, you've said that. What I was trying to ask was if you were to try to solve the problem on paper, and use the debugger to follow along with the program, at what point does your paper work diverge from what the program is doing? So the first row matches -- but if you inspect variables and such after the first row, which ones don't match what you are expecting?

http://stackoverflow.com/a/24574509
upvote count: 1
type: Answer
has body: Java default method in interface is new feature in java 8 : Check Out http://java.dzone.com/articles/interface-default-methods-java
has comment: http://stackoverflow.com/comment/38066382
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24574462
answers question: http://stackoverflow.com/q/24574462
type: AcceptedAnswer

log-forging
type: Tag
tag name: log-forging
tags question: http://stackoverflow.com/q/24428353

http://stackoverflow.com/q/24503909
type: Question
score: -1
tagged with: eclipse
downvote count: 2
has comment: http://stackoverflow.com/comment/37935572
has title: Connecting an app to a logged in user
upvote count: 1
tagged with: connectivity
answer count: 1
has answer: http://stackoverflow.com/a/24504150
accepted answer: http://stackoverflow.com/a/24504150
favorite count: 0
tagged with: android
tagged with: web-services
type: AnsweredQuestion
tagged with: java
has body: I'm currently developing an app for android in eclipse And for this app, im going to connect it to the web services to an existing database I'm currently building the login page and i managed to connect it to the database and got a session id, however, im wondering how im going to connect the rest of the app to that session ID and save all the things that the user will do in the actual app to the same user who logged in, so basically, how to connect the app all together to the same person who logged in? Its my first app so I'm not really experienced

http://stackoverflow.com/a/24542932
type: Answer
has comment: http://stackoverflow.com/comment/38008171
has comment: http://stackoverflow.com/comment/38007951
answers question: http://stackoverflow.com/q/24542886
accepted answer of: http://stackoverflow.com/q/24542886
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/38008036
has body: If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable. To explicitly specify a JVM of your choice, you can use the -vm command line argument: // start Java by executing the specified java executable eclipse -vm c:\jre\bin\javaw.exe // start Java by loading the jvm in the eclipse process eclipse -vm c:\jre\bin\client\jvm.dll See the launcher page for more details on specifying a JVM. You can manually specify the workspace location on the command line, using the -data command-line argument.

http://stackoverflow.com/comment/69823860
type: Comment
has text: Is there a way to configure this so there is some kind of default namespace? So that no prefix is required?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24574242

http://stackoverflow.com/comment/37901080
has text: The error message is the title I think
comment on: http://stackoverflow.com/q/24485178
score: 0
type: QuestionComment
type: Comment

java-native-interface
tags question: http://stackoverflow.com/q/24461687
tags question: http://stackoverflow.com/q/24458257
tags question: http://stackoverflow.com/q/24544629
tags question: http://stackoverflow.com/q/24479016
tags question: http://stackoverflow.com/q/24480465
tags question: http://stackoverflow.com/q/24482863
tags question: http://stackoverflow.com/q/24538260
tags question: http://stackoverflow.com/q/24570041
tags question: http://stackoverflow.com/q/24510117
type: Tag
tag name: java-native-interface
tags question: http://stackoverflow.com/q/24471657
tags question: http://stackoverflow.com/q/24490020
tags question: http://stackoverflow.com/q/24566325
tags question: http://stackoverflow.com/q/24491965
tags question: http://stackoverflow.com/q/24432227
tags question: http://stackoverflow.com/q/24556672
tags question: http://stackoverflow.com/q/24493337
tags question: http://stackoverflow.com/q/24457175
tags question: http://stackoverflow.com/q/24448500
tags question: http://stackoverflow.com/q/24428989

http://stackoverflow.com/q/24474008
downvote count: 0
tagged with: java
has body: I am running a memory intensive application. Some info about the environment: 64 bit debian 13 GB of RAM 64 bit JVM (I output System.getProperty("sun.arch.data.model") when my program runs, and it says "64") Here is the exact command I am issuing: java -Xmx9000m -jar "ale.jar" testconfig I have run the program with same exact data, config, etc. on several other systems, and I know that the JVM uses (at its peak) 6 GB of memory on those systems. However, I am getting an OutOfMemory error. Furthermore, during the execution of the program, the system never drops below 8.5 GB of free memory. When I output Runtime.getRuntime().maxMemory() during execution, I get the value 3044540416, i.e. ~ 3 GB. I don't know whether it is relevant, but this is a Google Compute Engine instance. The only explanation I can think of is that there may be some sort of system restriction on the maximum amount of memory that a single process may use.
type: Question
has comment: http://stackoverflow.com/comment/37879806
tagged with: memory
has title: JVM won't use as much memory as I tell it to
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24474133
has answer: http://stackoverflow.com/a/24474132
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37879914
has comment: http://stackoverflow.com/comment/37883688
score: 2

http://stackoverflow.com/comment/37914619
comment on: http://stackoverflow.com/a/24491299
type: Comment
score: 0
type: AnswerComment
has text: hmm, what happens when you call out.close() after sending text? does that change anything?

http://stackoverflow.com/comment/38066657
comment on: http://stackoverflow.com/q/24574733
score: 0
type: Comment
type: QuestionComment
has text: @kalyanpvs infact! But i don't know how can i solve. This is why i wrote here :)

http://stackoverflow.com/comment/37982883
has text: @NielsBechNielsen, you are not checking if `d` is in fact `Data` before casting it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24529672
score: 0
type: Comment

http://stackoverflow.com/q/24566679
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24569202
accepted answer: http://stackoverflow.com/a/24569202
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: PNG True color with Alpha decoding
has body: I am writing a PNG decoder and I am encountering some weirdness. Going through the PNG file format, I have managed to decode PNGs with Color Index + tRNS (alpha) and True Color + tRNS (alpha) correctly. I am currently not sure why I cannot decode a PNG with True Color with Alpha type PNG. I have verified that my inflate of IDAT chunk is correct. Here's what the chunks looks like: Width: 256 Height: 256 Bit Depth: 8 Color Type: 6 Compression: 0 Filter: 0 Interlace: 0 Length: 25 Type: tEXt Data: 53 6f 66 74 77 61 72 65 00 41 64 6f 62 65 20 49 6d 61 67 65 52 65 61 64 79 CRC: 71c9653c Length: 20690 Type: IDAT Data: 78 da ec 7d 09 9c 1c 57 99 df f7 7a a6 e7 3e 5a a3 fb ... CRC: 21550259 The actual data is too long to be printed here. Here's my logic of decoding this, please correct me if I'm wrong: Inflate all the bytes given in the IDAT chunk Un-filter the inflated chunks. In this case, all filters are of type 0 and therefore, we simply discard the filter byte. Since this is color type 6, a pixel is represented by RGBA channels with 1 byte each. This means we need to interpret 4 bytes at a time. The following code is used: ByteBuffer image = BufferUtil.getDirectByteBuffer(data.length, ByteOrder.BIG_ENDIAN); int i = 0; while(i &lt; data.length){ int color = ( (data[i] &amp; 0xff) &lt;&lt; 24) | ( (data[i+1] &amp; 0xff) &lt;&lt; 16) | ( (data[i+2] &amp; 0xff) &lt;&lt; 8) | (data[i+3] &amp; 0xff); image.putInt(color); i += 4; What's strange is that I get mostly RRGGBBAA = 0x00000000 data resulting in a clear image with little color.
tagged with: http://stackoverflow.com/tag/png
score: 2

http://stackoverflow.com/a/24447099
has body: .equals() compares the actual content of the string. The "==" operator compares if the two objects are the same reference in memory. If you were to do str = str1;, then the double-equals operator would return true because they point to the same reference in memory. hashCode() returns a hash of the object in an arbitrary manner. The value returned will always be unique as long as the method is not overridden in some way. If .equals() returns true, the hash code should be the same.
answers question: http://stackoverflow.com/q/24446763
upvote count: 3
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37904155
has text: See here, there is a batch script: http://stackoverflow.com/questions/3930383/jre-installation-directory-in-windows
comment on: http://stackoverflow.com/q/24486834
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38133553
comment on: http://stackoverflow.com/a/24552380
has text: Kindly have a look at the Edit Section
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24499822
has comment: http://stackoverflow.com/comment/37928061
has comment: http://stackoverflow.com/comment/37928123
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/37928069
tagged with: java
has answer: http://stackoverflow.com/a/24499945
type: Question
tagged with: passwords
tagged with: sensitive-data
has title: How to store user sensitive information locally?
has body: I am developing an application that is asking the user to enter his account name and password in order to log in to an online forum, among other things. Please note that I am not actually transmitting any data over the Internet through my application and I am only connecting to a particular server. I am using HtmlUnit to grab a link to the forum, get the correct login form, fill in the data and submit it. The actual data relay over the net is managed by a 3rd party company. Now to the actual problem: Some users would like to be able to save their credentials so they won't have to retype them anytime they start the app. I am saving their credentials to a .txt file whose contents I am encrypting using a Password Based Encryption with MD5 and DES algorithm with a static password and a static salt. I am mainly encrypting those files so if they accidentally send this file over to someone they won't be able to get that information out so easily and hopefully avoid the hassle. To my understanding, since I am a total noob to cryptography, using a hardcoded salt along with a hardcoded password is not a very secure technique, however it is probably sufficient when I am saving data locally. Am I right here? Also is .txt files a secure way of storing such data? If no what would you suggest?
has comment: http://stackoverflow.com/comment/37928147
tagged with: user-data
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37928074
has answer: http://stackoverflow.com/a/24499870

http://stackoverflow.com/a/24580234
has body: If you really wanted to do this... to use the Observer pattern as mentioned by JohnB. But, I don't entirely agree with your reason. Splitting up code across classes is not a good reason to use observer pattern. There should be a better / more functional requirement than that. Of course I do not know the exact requirement so I can't generalize. I would suggest a very different approach. Start with a base class that adds little bit of functionality and then keep extending layer by layer to add more functionality. This will let you have beautifully crisp code which is readable and maintainable while also keeping your object model representative of the functionality.
has comment: http://stackoverflow.com/comment/38077522
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38077794
answers question: http://stackoverflow.com/q/24579543

http://stackoverflow.com/a/24527201
has comment: http://stackoverflow.com/comment/38550087
has comment: http://stackoverflow.com/comment/37978653
has comment: http://stackoverflow.com/comment/37980765
answers question: http://stackoverflow.com/q/24526296
has body: The problem is that you are mixing up Fragments and Activities, and as such, handling events in the Activity, even though these Views are displayed in the Fragment. Basically you are meant to have a FrameLayout in the Activity, and that's it - the logic is handled in the Fragment. An example is the following: public class ContainerActivity extends ActionBarActivity { @Override public void onCreate(Bundle saveInstanceState) { super.onCreate(saveInstanceState); this.setContentView(R.layout.activity_container); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (saveInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.activity_container_container, new ExampleFragment()) .addToBackStack(null) .commit(); } getSupportFragmentManager().addOnBackStackChangedListener(new OnBackStackChangedListener() { public void onBackStackChanged() { int backCount = getSupportFragmentManager().getBackStackEntryCount(); if (backCount == 0) { finish(); } } }); } } activity_container.xml: <?xml version="1.0" encoding="utf-8"?> <FrameLayout android:id="@+id/activity_container_container" android:layout_width="match_parent" android:layout_height="match_parent" /> ExampleFragment: public class ExampleFragment extends Fragment implements View.OnClickListener { private Button btnOne; private Button btnTwo; private Button btnThree; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_example, container, false); btnOne = (Button) rootView.findViewById(R.id.example_button_one); btnTwo = (Button) rootView.findViewById(R.id.example_button_two); btnThree = (Button) rootView.findViewById(R.id.example_button_three); btnOne.setOnClickListener(this); btnTwo.setOnClickListener(this); btnThree.setOnClickListener(this); return rootView; } @Override public void onClick(View v) { if (btnOne == v) { Toast.makeText(getActivity(), "One.", Toast.LENGTH_LONG).show(); } else if…
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38550491

http://stackoverflow.com/comment/37960247
score: 0
comment on: http://stackoverflow.com/q/24515909
type: Comment
type: QuestionComment
has text: I see. But I still don't understand why all the cloning is necessary. Why can't you just loop over the array of the item you want to add?

http://stackoverflow.com/a/24587581
upvote count: 3
has body: The JPA spec group were too lazy to bother releasing a vendor neutral API jar for JPA 2.0 and JPA 2.1. See for example https://java.net/jira/browse/JPA_SPEC-60 You simply have to pick a vendor's own one and hope they didn't put vendor-specifics in there. Naff
score: 3
accepted answer of: http://stackoverflow.com/q/24586910
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24586910

http://stackoverflow.com/comment/37887165
comment on: http://stackoverflow.com/q/24478027
score: 3
has text: Please DON'T use umlauts in your syntax!
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24572031
downvote count: 0
has body: &lt;objectState&gt; and &lt;objectClass&gt; test the state and class of the currently selected objects not the action handler class. I think you would have to use &lt;systemProperty&gt; to check a property that you set. Or use the selectionChanged method to enable the IAction. The selectionChanged method is part of the IActionDelegate interface that you are indirectly implementing with IWorkbenchWindowPulldownDelegate: public void selectionChanged(IAction action, ISelection selection) The action parameter is the actual action, call action.setEnabled(true) to enable the action.
answers question: http://stackoverflow.com/q/24571372
has comment: http://stackoverflow.com/comment/38062675
type: Answer
has comment: http://stackoverflow.com/comment/38061819
has comment: http://stackoverflow.com/comment/38061795
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24571372
has comment: http://stackoverflow.com/comment/38065040
type: AcceptedAnswer

android-gridview
type: Tag
tag name: android-gridview
tags question: http://stackoverflow.com/q/24587146

http://stackoverflow.com/a/24641066
downvote count: 0
type: Answer
has body: Admittedly, I could/should have noticed this earlier, but ... it has been a while since I have actively been using Java3D - and since then, I've mainly been squeezing out my meager knowledge and memories to answer forum and stackoverfow questions about it ;-) However: You did set the indices for the vertices, using the ta.setCoordinateIndex(...); calls. But you additionally have to set the indices for the texture coordinates, using ta.setTextureCoordinateIndex(0, ...); The 0 refers to the texture coordinate set (there may be multiple textures, with different coordinate sets). Apart from that, the indices are the same as for the vertices here. Here again, as a MCVE. (The image name was changed. Lena rules!) import java.awt.BorderLayout; import java.awt.Container; import java.awt.GraphicsConfiguration; import javax.media.j3d.Appearance; import javax.media.j3d.BranchGroup; import javax.media.j3d.Canvas3D; import javax.media.j3d.GeometryArray; import javax.media.j3d.ImageComponent2D; import javax.media.j3d.IndexedTriangleArray; import javax.media.j3d.PolygonAttributes; import javax.media.j3d.Shape3D; import javax.media.j3d.Texture; import javax.media.j3d.Texture2D; import javax.media.j3d.Transform3D; import javax.media.j3d.TransformGroup; import javax.media.j3d.TriangleArray; import javax.swing.JFrame; import javax.vecmath.Point3d; import javax.vecmath.Point3f; import javax.vecmath.TexCoord2f; import javax.vecmath.Vector3d; import com.sun.j3d.utils.image.TextureLoader; import com.sun.j3d.utils.universe.SimpleUniverse; import com.sun.j3d.utils.universe.ViewingPlatform; public class SEMVCE { public static IndexedTriangleArray getITA(int gridSize, float h) { int rows = gridSize, cols = gridSize; int vertexCount = gridSize * gridSize; int cols_1 = cols - 1, rows_1 = rows - 1; IndexedTriangleArray ta = new IndexedTriangleArray(vertexCount, IndexedTriangleArray.COORDINATES | IndexedTriangleArray.TEXTURE_COORDINATE_2, 6 * rows_1 * cols_1); Point3f coords[] = new Point3f[vertex…
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24458276

http://stackoverflow.com/q/24463616
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/37860037
type: UnansweredQuestion
tagged with: java
type: Question
has body: When i put this url http://api.androidhive.info/images/sample.jpg, it display the image in all device device as well as in emulator. but when i put this url https://fbcdn-profile-a.akamaihd.net//hprofile-ak-xfa1//t1.0-1//p50x50//10253981_10152392333247380_3365639944748198693_t.jpg, it display image in emulator but not in real device in android. why? Please Help Me.
has title: Images Display in emulator but not in real device?
score: 0
has answer: http://stackoverflow.com/a/24463699

http://stackoverflow.com/comment/38022063
has text: thank you but unfortunately it doesn't work. No, the request doesn't begin, I have directly this error : Caused by: java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24550337
type: Comment

http://stackoverflow.com/a/24503225
accepted answer of: http://stackoverflow.com/q/24441100
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37962399
has comment: http://stackoverflow.com/comment/37963274
has comment: http://stackoverflow.com/comment/37963272
has comment: http://stackoverflow.com/comment/37963165
type: Answer
answers question: http://stackoverflow.com/q/24441100
has comment: http://stackoverflow.com/comment/37963393
upvote count: 1
has comment: http://stackoverflow.com/comment/37963091
score: 1
has body: Velocity configuration is not the best documented part in Spring. And it is rather outdated : even in 4.0.5, the reference documentation declares dependencies on velocity 1.x (fine) and velocity-tools (1.x) which is deprecated in recent versions of velocity. Nevertheless all works fine once configured with velocity 1.7 and velocity-tools 2.0 The piece that will allow velocity to find your templates under WEB-INF is WebappResourceLoader of velocity-tools. Once your VelocityEngine will be declared to use it to load templates, all will work fine, including template inclusion in other templates. So you can keep doing the configuration the velocity way. You prepare the velocity properties including : resource.loader=webapp webapp.resource.loader.class=org.apache.velocity.tools.view.WebappResourceLoader webapp.resource.loader.path=/WEB-INF/vml and initialize and use normally a VelocityEngine But you can also make use of Spring VelocityConfigurer, which could be useful if you later want to use velocity views in your application (*). Here is an extract of a working application context : UTF-8 UTF-8 VM_global_library.vm webapp org.apache.velocity.tools.view.WebappResourceLoader /WEB-INF/vlm true And you get a fully configured VelocityEngine that can be injected by Spring in any bean where you need it (I think that property name="resourceLoaderPath" is a scory of on older version, but as it works I didn't dare remove it, and VM_global_library.vm is my own velocity macro library under webapp.resource.loader.path, accessible from all my templates). I currently use this config to generate mail bodies. No that you have your velocity engine (configured either directly or via a VelocityConfigurer) you use it to load and merge your templates : Template template = velocityEngine.getTemplate("/hello.vml"); Context context = new VelocityContext(); context.put(..., ...); ... template.merge(context, writer); (*) VelocityLayoutViewResolver works correctly in that environment, but to be ab…

http://stackoverflow.com/a/24472709
answers question: http://stackoverflow.com/q/24472685
score: 1
has comment: http://stackoverflow.com/comment/37880771
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37878678
has body: would doing as follows work? No. Your custom add method is synchronizing on a different object to the requestList object is using to synchronize. Hence, there won't be mutual exclusion. There is a Collections.synchronizedList method overload that takes a mutex object as an extra parameter. Unfortunately, it is declared as package private, so you won't be able to use it. so, how do I have a list which IS thread safe, and maintains the sorted order on each add? There is no simple solution, but a couple of approaches that would work are: Change your code so that the requestList object is private. Implement all access to the list via wrapper methods ... and declare them as synchronized. Write your own custom synchronized list wrapper that can synchronizes on a mutex that is provided to it. Then instantiate the wrapper with your this object as the mutex; i.e. the object that your add method is synchronizing on. Assuming that your add method is actually part of a "sorted list" wrapper class, the first option is the best one. The suggestion of using a PriorityBlockingQueue as an alternative to a List is a good one, though you do lose some of the methods that you get in the List API. (For example, you can't do index-based operations on a Queue ...)
has comment: http://stackoverflow.com/comment/37880807
has comment: http://stackoverflow.com/comment/37880579
upvote count: 2
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24472685
has comment: http://stackoverflow.com/comment/37878560

http://stackoverflow.com/comment/37928949
type: AnswerComment
type: Comment
has text: @Celeritas I have edited the answer. If you have any comment please fell free to ask.
comment on: http://stackoverflow.com/a/24500260
score: 0

http://stackoverflow.com/q/24537911
has comment: http://stackoverflow.com/comment/37998758
has comment: http://stackoverflow.com/comment/37999080
has comment: http://stackoverflow.com/comment/37998886
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37999041
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/38000443
has body: I'm implementing an event listener, querying new items to process, by creationTime in ascending order. I deal with multithreading. My current workflow is: Querying a batch of items (let's say 50) containing the "New" flag. Looping through those items, and for each item, updating its status to "InProgress". For each item, still within the loop, start the corresponding process, detached in a thread (using Akka Actors in my case). As soon as a process is fully completed, update the item's flag to "Consumed". I set a polling frequency of 3 seconds, that obviously may involve query of new items BEFORE the current retrieved items are being fully processed (due to multithreading), with the flag "Consumed" set. Only the querying is single-threaded, otherwise it would lead to retrieve duplicates. I wonder if the step 2 is essential: updating each item with "InProgress" flag. Indeed, it would slow down the whole. I thought about skipping this step but to ensure that futures queries don't retrieve items that are currently being processed (let's imagine a very long computation), I would NOT start the next retrieval query as soon as the whole batch is processed. Basically, my query step would wait for workers to finish their current jobs. Obviously, this would make sense if the kind of jobs are similar in computation time. What is a good practice of polling database while dealing with multithreaded computation?
has title: Should I really need the "InProgress" flag while polling my database?
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/37998971
score: 0
has comment: http://stackoverflow.com/comment/37998514

http://stackoverflow.com/a/65919346
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24578243
downvote count: 0
has body: Adding below dependency solved issue implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'

http://stackoverflow.com/comment/37946711
score: 0
comment on: http://stackoverflow.com/a/24510404
type: Comment
has text: OP doesn't want to check if `A` == `B` but to check if intersection of `A` and `B` is not empty (if there exist some common matches).
type: AnswerComment

http://stackoverflow.com/a/24570355
type: Answer
has comment: http://stackoverflow.com/comment/66841004
has comment: http://stackoverflow.com/comment/126276664
has comment: http://stackoverflow.com/comment/38058985
has body: (This rant is obsolete. It seems 6.2.0 is only available as a SNAPSHOT (which you'd better leave alone). [And I couldn't find a zipped tarfile for the 6.1.0-Final on first try - found this later.] I dislike the obscure ways Drools distributions since 5.6.0 are offered to the "community". The last version I managed to get with a simple download was 6.0.0-Final. And therefore... End of rant.) A simple technique for compiling one or more drl files programmatically that works since 6.0.0 is this: private KieSession kieSession; public void build() throws Exception { KieServices kieServices = KieServices.Factory.get(); KieFileSystem kfs = kieServices.newKieFileSystem(); // for each DRL file, referenced by a plain old path name: FileInputStream fis = new FileInputStream( "simple/simple.drl" ); kfs.write( "src/main/resources/simple.drl", kieServices.getResources().newInputStreamResource( fis ) ); KieBuilder kieBuilder = kieServices.newKieBuilder( kfs ).buildAll(); Results results = kieBuilder.getResults(); if( results.hasMessages( Message.Level.ERROR ) ){ System.out.println( results.getMessages() ); throw new IllegalStateException( "### errors ###" ); } KieContainer kieContainer = kieServices.newKieContainer( kieServices.getRepository().getDefaultReleaseId() ); KieBase kieBase = kieContainer.getKieBase(); kieSession = kieContainer.newKieSession(); }
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/66828129
answers question: http://stackoverflow.com/q/24558451
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24558451

string
tags question: http://stackoverflow.com/q/24480775
tags question: http://stackoverflow.com/q/24514528
tags question: http://stackoverflow.com/q/24462367
tags question: http://stackoverflow.com/q/24502678
tags question: http://stackoverflow.com/q/24558549
tags question: http://stackoverflow.com/q/24454552
tags question: http://stackoverflow.com/q/24582547
tags question: http://stackoverflow.com/q/24529205
tags question: http://stackoverflow.com/q/24435711
tags question: http://stackoverflow.com/q/24491240
tags question: http://stackoverflow.com/q/24475172
tags question: http://stackoverflow.com/q/24473099
tags question: http://stackoverflow.com/q/24558173
tags question: http://stackoverflow.com/q/24450191
tags question: http://stackoverflow.com/q/24485594
tags question: http://stackoverflow.com/q/24504606
tags question: http://stackoverflow.com/q/24530564
tags question: http://stackoverflow.com/q/24580328
tags question: http://stackoverflow.com/q/24468286
tags question: http://stackoverflow.com/q/24524881
tags question: http://stackoverflow.com/q/24568525
tags question: http://stackoverflow.com/q/24554319
tags question: http://stackoverflow.com/q/24438714
tags question: http://stackoverflow.com/q/24583475
tags question: http://stackoverflow.com/q/24450478
tags question: http://stackoverflow.com/q/24482465
tags question: http://stackoverflow.com/q/24510021
tags question: http://stackoverflow.com/q/24439196
tags question: http://stackoverflow.com/q/24450024
tags question: http://stackoverflow.com/q/24466173
tags question: http://stackoverflow.com/q/24450773
tags question: http://stackoverflow.com/q/24466163
tags question: http://stackoverflow.com/q/24571363
tags question: http://stackoverflow.com/q/24458299
tag name: string
tags question: http://stackoverflow.com/q/24570807
tags question: http://stackoverflow.com/q/24571463
tags question: http://stackoverflow.com/q/24446763
tags question: http://stackoverflow.com/q/24493233
tags question: http://stackoverflow.com/q/24574778
tags question: http://stackoverflow.com/q/24580927
tags question: http://stackoverflow.com/q/24483495
tags question: http://stackoverflow.com/q/24565020
tags question: http://stackoverflow.com/q/24429677
tags question: http://stackoverflow.com/q/24491256
type: Tag
tags question: http://stackoverflow.com/q/24475207
tags question: http://stackoverflow.com/q/24563731
tags question: http://stackoverflow.com/q/24556082
tags question: http://stackoverflow.com/q/24526450
tags question: http://stackoverflow.com/q/24503917
tags question: http://stackoverflow.com/q/24545711
tags question: http://stackoverflow.com/q/24563420
tags question: http://stackoverflow.com/q/24520445
tags question: http://stackoverflow.com/q/24452292
tags question: http://stackoverflow.com/q/24526165
tags question: http://stackoverflow.com/q/24437060
tags question: http://stackoverflow.com/q/24526187
tags question: http://stackoverflow.com/q/24483949
tags question: http://stackoverflow.com/q/24483332
tags question: http://stackoverflow.com/q/24503053
tags question: http://stackoverflow.com/q/24541500
tags question: http://stackoverflow.com/q/24543708
tags question: http://stackoverflow.com/q/24448887
tags question: http://stackoverflow.com/q/24521401
tags question: http://stackoverflow.com/q/24460302
tags question: http://stackoverflow.com/q/24465711
tags question: http://stackoverflow.com/q/24507600
tags question: http://stackoverflow.com/q/24565031
tags question: http://stackoverflow.com/q/24526375
tags question: http://stackoverflow.com/q/24428994
tags question: http://stackoverflow.com/q/24512131
tags question: http://stackoverflow.com/q/24580720
tags question: http://stackoverflow.com/q/24565735
tags question: http://stackoverflow.com/q/24428029
tags question: http://stackoverflow.com/q/24452186
tags question: http://stackoverflow.com/q/24453868
tags question: http://stackoverflow.com/q/24567373
tags question: http://stackoverflow.com/q/24525997
tags question: http://stackoverflow.com/q/24538333

http://stackoverflow.com/q/24523179
has answer: http://stackoverflow.com/a/24524216
has answer: http://stackoverflow.com/a/24523470
type: Question
has comment: http://stackoverflow.com/comment/37970517
upvote count: 0
has comment: http://stackoverflow.com/comment/37970636
score: -6
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37970523
has comment: http://stackoverflow.com/comment/37971117
has title: Java.NullPointerException Android
tagged with: android
has answer: http://stackoverflow.com/a/24523224
has comment: http://stackoverflow.com/comment/37970513
downvote count: 6
has comment: http://stackoverflow.com/comment/37970698
accepted answer: http://stackoverflow.com/a/24523470
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37970514
tagged with: java
has body: I have problem running this code because it gave java.nullpointerexception at name.setText(cn.getName()). what i want to do is to populate listview with text and images from sqlite database. This is the mainactivity class: listView = (ListView) findViewById(R.id.productlistview); db = new DatabaseHandler(this); int c = db.getItemsCount(); List<ItemList> items = db.getAllItems(); View header = (View)getLayoutInflater().inflate(R.layout.productlistview, null); TextView name = (TextView)header.findViewById(R.id.name); ImageView img = (ImageView)header.findViewById(R.id.photo); TextView desc = (TextView)header.findViewById(R.id.description); for (ItemList cn : items) { String imageURL = cn.getPhoto(); String fileName = imageURL.substring( imageURL.lastIndexOf('/')+1 ); String imgfile = null; String imgURL = null; try { imgfile = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20"); imgURL = ("http://www.khind.com.my/i_prod/" + imgfile); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } name.setText(cn.getName()); Bitmap bitmap = DownloadImage(imgURL); img.setImageBitmap(bitmap); desc.setText(cn.getDescription()); listView.addHeaderView(header); Log.d("Here the data:", cn.getName()); } This is the log: 07-02 01:01:59.294: E/AndroidRuntime(885): FATAL EXCEPTION: main 07-02 01:01:59.294: E/AndroidRuntime(885): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jmsb.khind/com.jmsb.khind.Fanlist}: java.lang.NullPointerException 07-02 01:01:59.294: E/AndroidRuntime(885): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 07-02 01:01:59.294: E/AndroidRuntime(885): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 07-02 01:01:59.294: E/AndroidRuntime(885): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-02 01:01:59.294: E/AndroidRuntime(885): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 07-02 01:01:59.…
possible better answer: http://stackoverflow.com/a/24523224
has comment: http://stackoverflow.com/comment/37970704

jaxb
tags question: http://stackoverflow.com/q/24447695
tags question: http://stackoverflow.com/q/24458759
tags question: http://stackoverflow.com/q/24529416
tags question: http://stackoverflow.com/q/24445549
tags question: http://stackoverflow.com/q/24519449
tags question: http://stackoverflow.com/q/24551495
tags question: http://stackoverflow.com/q/24489242
tags question: http://stackoverflow.com/q/24520991
tags question: http://stackoverflow.com/q/24462668
type: Tag
tags question: http://stackoverflow.com/q/24441730
tag name: jaxb
tags question: http://stackoverflow.com/q/24554789
tags question: http://stackoverflow.com/q/24551144
tags question: http://stackoverflow.com/q/24576567
tags question: http://stackoverflow.com/q/24434789
tags question: http://stackoverflow.com/q/24431960
tags question: http://stackoverflow.com/q/24439760
tags question: http://stackoverflow.com/q/24499783
tags question: http://stackoverflow.com/q/24491346
tags question: http://stackoverflow.com/q/24522434

http://stackoverflow.com/a/24481456
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24480394
has body: The way I interact with select lists is easy: /** * Clicks The Selector List and picks your option. * */ public void selectOptionFromSelector(String selectedItem) { WebElement select = webDriver.findElement(By.id("idhere")); Select dropDown = new Select(select); String selected = dropDown.getFirstSelectedOption().getText(); if(selected.equals(selectedItem)){ // This should not happen } List&lt;WebElement&gt; Options = dropDown.getOptions(); for(WebElement option:Options){ if(option.getText().equals(selectedItem)) { option.click(); // clicks the option we want to select. } } }

http://stackoverflow.com/comment/38058601
comment on: http://stackoverflow.com/q/24558451
has text: Well, what happens if you include `bla/` in the classpath or move ` checkLicense.drl` to one of the dirs in the class path? Either one would immediately show whether my surmise is correct.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24444459
type: Answer
has body: A post here describes your problem Try setting a time out for your REST call and make sure the REST service is up and running. Check if indeed your REST service is trying to fetch a huge amount of information.
answers question: http://stackoverflow.com/q/24443742
score: 0

http://stackoverflow.com/q/24468340
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37868935
tagged with: spring-transactions
has answer: http://stackoverflow.com/a/24468372
has body: I am inserting records in a couple of tables namely Dept and Emp. If the Dept table is successfully created then only I want to insert records in Emp table. Also, if any of the insert in Emp fails, then I want to rollback all the transaction which includes both rollback from Emp as well as Dept tables. I tried this using Propagation.REQUIRED as shown below: Java File public void saveEmployee(Employee empl){ try { jdbcTemplate.update("INSERT INTO EMP VALUES(?,?,?,?,?)",empl.getEmpId(),empl.getEmpName(), empl.getDeptId(),empl.getAge(),empl.getSex()); } catch (DataAccessException e) { e.printStackTrace(); } } @Transactional(propagation=Propagation.REQUIRED) public void saveRecords(){ saveDepartment(dept); saveEmployee(empl); } context.xml &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/&gt; &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; Problem: Even if an insertion in Emp table fails, the Dept insertion is getting persisted which I don't want. I want to rollback everything. Please suggest.
answer count: 1
downvote count: 0
favorite count: 0
has title: Spring:Propagation.REQUIRED not working
tagged with: spring
accepted answer: http://stackoverflow.com/a/24468372
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-3

http://stackoverflow.com/q/24441198
has title: In Java w/Selenium WebDriver, how to I click link on overlay ad using JavaScript only when ad shows?
has comment: http://stackoverflow.com/comment/37819029
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24441325
accepted answer: http://stackoverflow.com/a/24441325
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
has body: I am a newbie to automation and am trying to automate some websites using Java w/Selenium WebDriver. Users with no cookies are presented an interstitial Ad served via JavaScript that overlays the screen. The Ad has a "Skip this advertisement" link on it to close it and I would like to close that Ad so that I can avoid making the thread sleep for 20 seconds until the ad goes away on its own. This is the site: http://searchsqlserver.com I can't seem to access the link using normal findElement techniques and I have been trying with the JavascriptExecutor with no luck. This is my code (that doesn't work!) to show what I am looking to do: if (Common.isElementPresent(By.id("adx_al"), driver)){ ((JavascriptExecutor)driver).executeScript(findElement(By.linkText("Skip this advertisement")).click()); //Thread.sleep(20000); }
type: Question

http://stackoverflow.com/comment/37991046
comment on: http://stackoverflow.com/a/24533896
has text: By default array will be null. No initialization happens. But you can fill an array with some default value if you want. Using `java.util.Arrays.fill()` method.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37975901
comment on: http://stackoverflow.com/q/24526187
has text: compareid [0]= tokens[0]; - where is tokens coming from?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38069675
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24575364
type: Comment
has text: I keep track of transaction based on session cookies.... When the transaction is passed to Bank the control is passed to customer and all server resources are deallocated until and unless we get a response from the customer with the session id. Then based on tht identification we proceed ahead. So based on this if there is no response in tht step we are losing the transaction

http://stackoverflow.com/q/24429553
has answer: http://stackoverflow.com/a/24430011
type: Question
answer count: 2
tagged with: database
has comment: http://stackoverflow.com/comment/37796939
has answer: http://stackoverflow.com/a/24429932
has comment: http://stackoverflow.com/comment/37797156
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/37797332
has comment: http://stackoverflow.com/comment/37797051
accepted answer: http://stackoverflow.com/a/24429932
tagged with: android
has body: Hey guy I have a question. How can I read my Sql datas from backward. I tried a lot of things I found in the net but nothing works here is my code: public Cursor getAllRows() { String where = null; Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, where, null, null, null,null,null); if (c != null) { c.moveToFirst(); } return c; And the code for the Cursor: Cursor cursor = myDb.getAllRows(); // Allow activity to manage lifetime of the cursor. // DEPRECATED! Runs on the UI thread, OK for small/short queries. startManagingCursor(cursor); // Setup mapping from cursor to view fields: String[] fromFieldNames = new String[] {DBAdapter.KEY_KALO, DBAdapter.KEY_HYDRATE, DBAdapter.KEY_FAT, DBAdapter.KEY_PROTEIN ,DBAdapter.KEY_CAL}; int[] toViewIDs = new int[] {R.id.item_Kalorien, R.id.item_KG_in_g, R.id.item_F_in_g, R.id.item_P_in_g,R.id.item_cal}; // Create adapter to may columns of the DB onto elemesnt in the UI. SimpleCursorAdapter myCursorAdapter = new SimpleCursorAdapter( this, // Context R.layout.item_tagebuch, // Row layout template cursor, // cursor (set of DB records to map) fromFieldNames, // DB Column names toViewIDs // View IDs to put information in ); // Set the adapter for the list view ListView myList = (ListView) findViewById(R.id.listView1); myList.setAdapter(myCursorAdapter); Tank you for helping, and sorry for my bad english:)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37797451
tagged with: java
has title: Reading Sql Database from backward
has comment: http://stackoverflow.com/comment/37797399
possible better answer: http://stackoverflow.com/a/24430011
tagged with: cursor

http://stackoverflow.com/q/24544049
has title: Unable to mock static invocations using JMockit
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38036384
has comment: http://stackoverflow.com/comment/38552723
accepted answer: http://stackoverflow.com/a/25827776
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am having difficulty mocking static invocations. I don't know what I am doing wrong. My stripped down source code: import javax.servlet.http.HttpServletRequest; import org.apache.struts2.ServletActionContext; public class OptionsBusinessEventFormatter { void process() { System.out.println("Testing testing "); HttpServletRequest request = ServletActionContext.getRequest(); System.out.println("request = " + request); System.out.println(request.getParameter("returnedURI")); } } My unit test @RunWith(JUnit4.class) public class OptionsBusinessEventFormatterTest { private OptionsBusinessEventFormatter optionsBusinessEventFormatter; @Before public void setUp() throws Exception { this.optionsBusinessEventFormatter = new OptionsBusinessEventFormatter(); } @Test public void process_HappyPath() { final MockHttpServletRequest request = new MockHttpServletRequest(); Map&lt;String, String&gt; map = new HashMap&lt;&gt;(); request.setParameters(map); new Expectations() { @Mocked ServletActionContext servletContext; { ServletActionContext.getRequest(); result = request; } }; this.optionsBusinessEventFormatter.process(); } } I get the following error. java.lang.IllegalStateException: Native library for Attach API not available in this JRE at mockit.internal.startup.AgentLoader.getVirtualMachineImplementationFromEmbeddedOnes(AgentLoader.java:88) at mockit.internal.startup.AgentLoader.loadAgent(AgentLoader.java:47) at mockit.internal.startup.AgentInitialization.loadAgentFromLocalJarFile(AgentInitialization.java:27) at mockit.internal.startup.Startup.initializeIfPossible(Startup.java:252) at org.junit.runner.Runner.&lt;clinit&gt;(Runner.java:22) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:61) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassReq…
upvote count: 1
has comment: http://stackoverflow.com/comment/38551077
tagged with: unit-testing
type: Question
downvote count: 0
tagged with: jmockit
has answer: http://stackoverflow.com/a/25827776

http://stackoverflow.com/a/24498871
has body: Email is inherently store-and-forward so it works well with intermittent connectivity, but you'll need to be able to store the messages on the client PC to be forwarded later. The simplest way to do that is with an off-the-shelf SMTP mail server on the client PC, although you could certainly write your own software to perform a similar function.
accepted answer of: http://stackoverflow.com/q/24489807
answers question: http://stackoverflow.com/q/24489807
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/q/24583576
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24583600
tagged with: datetime
linked to: http://stackoverflow.com/q/2109145
has comment: http://stackoverflow.com/comment/38086287
linked to: http://stackoverflow.com/q/21370386
linked to: http://stackoverflow.com/q/14521539
linked to: http://stackoverflow.com/q/15503105
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/24583624
tagged with: calendar
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/4536230
linked to: http://stackoverflow.com/q/9307884
tagged with: simpledateformat
tagged with: date
duplicate of: http://stackoverflow.com/q/2937086
has body: I would like to fetch the first date of a week. My input is going to be a String type like 07/26/2014". I need to get the first date of week in which the above date(07/26/2014) falls. I need output date in MM/dd/YYYY format . basically I need output as 07/21/2014. Please give me the java program. I have done upto this SimpleDateFormat formatter1 = new SimpleDateFormat("MM/dd/yy"); String date ="07/26/2014"; Date Currentdate = formatter1.parse(date); int currentday=Currentdate.getDay(); Calendar calendar = Calendar.getInstance(); calendar.setTime(Currentdate); int startDay=currentday-calendar.getFirstDayOfWeek(); Currentdate.setDate(contacteddate.getDate()-startDay); System.out.println(contacteddate.getDate()); } The above code only gives me the date.. I need date along with month and year in "MM/dd/YYYY" Please help
linked to: http://stackoverflow.com/q/2937086
has comment: http://stackoverflow.com/comment/38092012
has answer: http://stackoverflow.com/a/24583641
linked to: http://stackoverflow.com/q/6617854
has answer: http://stackoverflow.com/a/24608055
answer count: 4
favorite count: 0
has title: Fetching the first date of a week in java
upvote count: 8
linked to: http://stackoverflow.com/q/10119782

http://stackoverflow.com/a/24491807
has comment: http://stackoverflow.com/comment/38068164
has body: Java != JavaScript, here you don't need to surround regex with / so try with "AASAAA-AAAA-AAAA".matches("[A-Z]{6}-[A-Z]{4}-[A-Z]{4}") Otherwise your regex would search for substring which also has / at start and end. BTW you need to know that matches checks if regex matches entire String, so "aaa".matches("aa") is same as "aaa".matches("^aa$") which would return false since String couldn't be fully matched by regex. If you would like to find substrings which would match regex you would need to use String input = "abcd"; Pattern regex = Pattern.compile("\\w{2}"); Matcher matcher = regex.matcher(input); while (matcher.find()){//this will try to find single match System.out.println(matcher.group()); } Output: ab cd
type: Answer
has comment: http://stackoverflow.com/comment/38067698
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/38067998
accepted answer of: http://stackoverflow.com/q/24491764
answers question: http://stackoverflow.com/q/24491764
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24496364
score: 4
answer count: 3
favorite count: 0
has title: java volatile used with jave linked list
accepted answer: http://stackoverflow.com/a/24497319
has body: Is it correct that the items that I added in my constructor to my volatile linked list below may not be visible to other threads class ProductPrice { private volatile LinkedList&lt;QuantityPrice&gt; quantityPriceList; public ProductPrice(List&lt;QuantityPrice&gt; quantityPriceListParam) { this.quantityPriceList = new LinkedList&lt;QuantityPrice&gt;(); quantityPriceList.addAll(quantityPriceListParam); } } Would the following code where i assign the volatile variable after the list is loaded fix the issue. Because all happen before operations would also be visible. private volatile LinkedList&lt;QuantityPrice&gt; quantityPriceList; public ProductPrice(List&lt;QuantityPrice&gt; quantityPriceListParam) { LinkedList&lt;QuantityPrice&gt; tempQuantityLinkedList = new LinkedList&lt;QuantityPrice&gt;(); tempQuantityLinkedList.addAll(quantityPriceListParam); this.quantityPriceList = tempQuantityLinkedList; } and in this case could i just make the variable final and get the same effect of having all items visible to other threads. private final LinkedList&lt;QuantityPrice&gt; quantityPriceList; public ProductPrice(List&lt;QuantityPrice&gt; quantityPriceListParam) { LinkedList&lt;QuantityPrice&gt; tempQuantityLinkedList = new LinkedList&lt;QuantityPrice&gt;(); tempQuantityLinkedList.addAll(quantityPriceListParam); this.quantityPriceList = tempQuantityLinkedList; }
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24263521
tagged with: java
tagged with: concurrency
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/24496540
has answer: http://stackoverflow.com/a/24496566
tagged with: volatile
downvote count: 0
has answer: http://stackoverflow.com/a/24497319
has answer: http://stackoverflow.com/a/24496540

http://stackoverflow.com/comment/37829310
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24447079
score: 0
has text: This answer might help: http://stackoverflow.com/questions/579224/setting-catalina-policy-to-allow-file-access-by-servlets

http://stackoverflow.com/comment/38088812
type: Comment
type: QuestionComment
has text: yes m passing mockServiceObj into ServiceAObj constructor @RobbyCornelissen
comment on: http://stackoverflow.com/q/24586549
score: 0

http://stackoverflow.com/comment/37867035
comment on: http://stackoverflow.com/q/24467137
score: 0
has text: try for(int i = 0; i<(map.size()/2)+1; i++)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24557133
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24557312
tagged with: system-properties
accepted answer: http://stackoverflow.com/a/24557296
has answer: http://stackoverflow.com/a/24557312
has comment: http://stackoverflow.com/comment/38034149
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38034259
tagged with: java
has body: Any system property set with -Dkey=value can be retrieved as a String using System.getProperty("key"). But you can also get certain system properties casted to a specific type, e.g.: Boolean.getBoolean("key"); //Returns true if value==true Integer.getInteger("key"); //Returns value if exists &amp; is number, else null Long.getLong("key"); //Ditto as for Integer Are there any other classes with a static getSomeClass(String systemPropertyKey) method? Why don't Byte, Float, or Double have them, but the other primitive wrappers do (or what might be the reason)?
type: Question
upvote count: 5
has answer: http://stackoverflow.com/a/24557296
has title: Which Java classes can get and cast system properties, and why?
answer count: 2
score: 5

http://stackoverflow.com/q/24488075
tagged with: java
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/10382368
type: UnansweredQuestion
has body: I need to create a new java project pro-grammatically. I have done this using the following: IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); How can I create this project in a location other than my work-space? I have a string which gives me the location where I need to create this project.
has comment: http://stackoverflow.com/comment/37906365
has comment: http://stackoverflow.com/comment/37906741
has comment: http://stackoverflow.com/comment/37906163
answer count: 0
has title: How to create a new Java project in a particular location programmatically
tagged with: workspace
type: Question
linked to: http://stackoverflow.com/q/10382368
score: 0

http://stackoverflow.com/q/24453602
tagged with: enums
accepted answer: http://stackoverflow.com/a/24453642
has body: I am implementing a state machine in enum in Java. I have a toy example below, where I transition between X,Y and Z states based on group membership. The issue is, the transition rule for Y and Z are identical (i.e., the Overriden methods are identical). Is there any way to avoid code duplication here? In my real life example, it is a bit more severe so the code duplication potential is worse. enum Group { A,B,C } enum Element { X(Group.A) { @Override public Element getNextElement(Element nextElement) { if(nextElement.getGroup() == Group.B) { return nextElement; } else { return this; } } }, Y(Group.B) { @Override public Element getNextElement(Element nextElement) { if(nextElement.getGroup() == Group.A) { return nextElement; } else { return this; } } }, Z(Group.C) { @Override public Element getNextElement(Element nextElement) { if(nextElement.getGroup() == Group.A) { return nextElement; } else { return this; } } }; Group group; Element(Group group) { this.group=group; }; public Group getGroup() { return this.group; } public abstract Element getNextElement(Element nextElement); }
has comment: http://stackoverflow.com/comment/37841300
possible better answer: http://stackoverflow.com/a/24453667
answer count: 3
tagged with: state
downvote count: 0
has answer: http://stackoverflow.com/a/24453642
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24453912
tagged with: state-machine
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24453667
has title: Avoiding code duplication when overriding abstract methods in enum
tagged with: java
tagged with: code-duplication
type: Question

http://stackoverflow.com/q/24556461
upvote count: 4
tagged with: hadoop
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38639414
favorite count: 0
has comment: http://stackoverflow.com/comment/38642291
has comment: http://stackoverflow.com/comment/38651315
has answer: http://stackoverflow.com/a/27988134
score: 4
has comment: http://stackoverflow.com/comment/38651565
tagged with: hbase
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/38239148
has comment: http://stackoverflow.com/comment/38275783
has comment: http://stackoverflow.com/comment/38501107
type: Question
tagged with: cloudera-cdh
linked to: http://stackoverflow.com/q/10109572
tagged with: java
has comment: http://stackoverflow.com/comment/38509565
has comment: http://stackoverflow.com/comment/38366445
has comment: http://stackoverflow.com/comment/38612204
has title: Garbage Collection duration in Hadoop CDH5
has body: We have a four-datanodes-cluster running CDH5.0.2, installed through Cloudera Manager parcels. In order to import 13M users' rows into HBase, we wrote a simple Python script and used hadoop-streaming jar. It works as expected up to 100k rows. And then... then, one after the other, all datanodes crash with the same message: The health test result for REGION_SERVER_GC_DURATION has become bad: Average time spent in garbage collection was 44.8 second(s) (74.60%) per minute over the previous 5 minute(s). Critical threshold: 60.00%. Any attempt to solve the issue following the advices found around the web (e.g. [1], [2], [3]) do not lead anywhere near a solution. "Playing" with java heap size is useless. The only thing which "solved" the situation was increasing Garbage Collection Duration Monitoring Period for region servers from 5' to 50'. Arguably a dirty workaround. We don't have the workforce to create a monitor for our GC usage right now. We eventually will, but I was wondering how possibly importing 13M rows into HBase could lead to a sure crash of all region servers. Is there a clean solution? Edit: JVM Options on Datanodes are: -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:-CMSConcurrentMTEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled Datanodes are physical machines running CentOS 6.5, each with 32Gb Ram and 1Quadcore at 2GHz with 30Mb cache. Below excerpt of the Python script which we run. We fill two tables: one with a unique user ID as rowkey and a single columnfamily with users' info, another with all info we might want to access as rowkey. #!/usr/bin/env python2.7 import sys import happybase import json connection = happybase.Connection(host=master_ip) hbase_main_table = connection.table('users_table') hbase_index_table = connection.table('users_index_table') header = ['ID', 'COL1', 'COL2', 'COL3', 'COL4'] for line in sys.stdin: l = line.replace('"','').strip("\n").split("\t") if l[header.index("ID")] == "ID": #you are reading the…

http://stackoverflow.com/q/24445942
score: 1
favorite count: 0
has body: I have written a code to execute a command on shell through Java: String filename="/home/abhijeet/sample.txt"; Process contigcount_p; String command_to_count="grep \"&gt;\" "+filename+" | wc -l"; System.out.println("command for counting contigs "+command_to_count); contigcount_p=Runtime.getRuntime().exec(command_to_count); contigcount_p.wait(); As pipe symbols were being used so I was not able to execute command successfully.As per my last question's discussion i have wrapped my variables in shell: Runtime.getRuntime().exec(new String[]{"sh", "-c", "grep \"&gt;\" "+filename+" | wc -l"}); Which worked for me as it does executes command on shell , but still when i try to read its output using buffered reader : BufferedReader reader = new BufferedReader(new InputStreamReader(contigcount_p.getInputStream())); String line=" "; while((line=reader.readLine())!=null) { output.append(line+"\n"); } It returns a null value ,I have found a temporary solution for it as i have discussed on previous question: link, but i would like to use right way of doing it by reading it's output using BufferedReader.
linked to: http://stackoverflow.com/q/24323594
type: Question
has comment: http://stackoverflow.com/comment/37827434
has answer: http://stackoverflow.com/a/24446386
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/24446386
has comment: http://stackoverflow.com/comment/37827311
type: AnsweredQuestion
has title: Can't get output from Runtime.exec()
downvote count: 0
tagged with: shell

http://stackoverflow.com/q/24555086
score: -2
has answer: http://stackoverflow.com/a/24555334
accepted answer: http://stackoverflow.com/a/24555334
has answer: http://stackoverflow.com/a/24555223
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/38030089
has body: I'm trying to make a TD game and I encountered a little problem. I want wave types to be chosen at random. I created various classes, each representing diffrent monster type (ex. fast, tough etc.). Now the question, how do I choose random type? I want to put all the monster types (diffrent classes) into some kind of collection, then take one out at random, and create an object of that type, but I have no idea how to do that.
answer count: 4
possible better answer: http://stackoverflow.com/a/24555223
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38030076
tagged with: java
has comment: http://stackoverflow.com/comment/38030138
has title: How to create collection containing diffrent classes to choose one at random
has answer: http://stackoverflow.com/a/24555275
type: Question
has comment: http://stackoverflow.com/comment/38030702
has comment: http://stackoverflow.com/comment/38030026
has answer: http://stackoverflow.com/a/24555390

http://stackoverflow.com/comment/37976756
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24518301
has text: Yes. I don't see any reason why not.
type: AnswerComment

http://stackoverflow.com/comment/37970661
type: Comment
has text: Pawel can you suggest the best java API to do the i18n and l10n. Also is it possible to automatically identify the units for a measurement based on Locale?. ex: i just pass the locale and distance, if the locale is "US", it should display distance in "Miles" otherwise in "Kilometer".
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24490150

http://stackoverflow.com/q/24433951
has comment: http://stackoverflow.com/comment/37807151
has comment: http://stackoverflow.com/comment/37806207
has comment: http://stackoverflow.com/comment/37806179
has comment: http://stackoverflow.com/comment/37806068
has comment: http://stackoverflow.com/comment/37806728
has comment: http://stackoverflow.com/comment/37806322
has answer: http://stackoverflow.com/a/24434444
accepted answer: http://stackoverflow.com/a/24434444
has body: I was wondering if it is possible to reset the value of a variable from another class. For example I have this variable in a HillClimber (hc) class: public int ballWeight = 200; What I want to do is run a simulation of a game with the ball weighting at this value. When it is finished I want to set the value to 201 from another class and begin the simulation again, and after that increase to 202 and start another and so on. My problem is that every time I restart the simulation the ballWeight variable is reset to 200. I have tried using a setter method in the HillClimber class: public int setBallWeight(int ballWeight) { return this.ballWeight = ballWeight; } and called it from another class at the end of a simulation: hc.setBallWeight(hc.ballWeight+1); but this does not seem to work as the variables stored value is not changed. Does anyone know how I can do this so the stored value of ballWeight will be increased by 1 each time a simulation ends? Or is this even possible? Thanks.
linked to: http://stackoverflow.com/q/2885173
has comment: http://stackoverflow.com/comment/37805407
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37806858
tagged with: java
tagged with: setter
has comment: http://stackoverflow.com/comment/37806679
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37806964
has title: Setting the value of a variable from another class in Java
has comment: http://stackoverflow.com/comment/37806935
has comment: http://stackoverflow.com/comment/37806155
answer count: 1
tagged with: variables
has comment: http://stackoverflow.com/comment/37806317
has comment: http://stackoverflow.com/comment/37805825

http://stackoverflow.com/comment/37976199
has text: Is there a way of doing it without polluting the root folder? I'd have to add many entries, one per project of each sample... Maybe I should rename the Libgdx core project...
comment on: http://stackoverflow.com/a/24526163
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24456624
has body: Guys can you please help me answer this exercise using for loop without using string methods. Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits. For example, the program should output the individual digits of 3456 as 3 4 5 6 and the sum as 18,and output the individual digits of -2345 as 2 3 4 5 and the sum as 14. This is the code: package MyPackage; import java.util.*; public class Integer { public static void main(String args[]) { Scanner console = new Scanner (System.in); int input; int sum = 0; int num1 = 0; int counter = 1; String num = ""; System.out.print("enter a number: "); input = console.nextInt(); if (input == (-input)) { input = input * (-1); num = String.valueOf(input); num1 = num.length(); System.out.print("the digits of " + input + " are: "); for (int i = 0; i &lt; num1; i++ ) { String var = num.substring(i,counter); int var1 = Character.getNumericValue(var.charAt(0)); System.out.print(var + " "); sum = sum + var1; counter++; } System.out.println(); System.out.println("the sum is: " + sum); } else { num = String.valueOf(input); num1 = num.length(); System.out.print("the digits of " + input + " are: "); for (int i = 0; i &lt; num1; i++ ) { String var = num.substring(i,counter); int var1 = Character.getNumericValue(var.charAt(0)); System.out.print(var + " "); sum = sum + var1; counter++; } System.err.println(); System.out.println("the sum is: " + sum); } } }
has comment: http://stackoverflow.com/comment/37847383
has answer: http://stackoverflow.com/a/24456847
has comment: http://stackoverflow.com/comment/37847388
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/37847476
type: Question
upvote count: 2
downvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/24456847
has title: control structure, repetition exercise: How to get the sum of the digits of a number?
score: 0
tagged with: java
tagged with: console-application

instanceof
tags question: http://stackoverflow.com/q/24553884
tag name: instanceof
type: Tag
tags question: http://stackoverflow.com/q/24490892

http://stackoverflow.com/a/24575768
has body: The size of a page in PDF is defined by the MediaBox (required). The visible area is defined by the CropBox (optional). The measurement unit in PDF is the user unit. By default 1 user unit coincides with 1 point. In other words: 1 inch = 72 user units. However, one can define a UserUnit value between 1 and 75,000. You won't find that much PDFs that change the default and as you're creating a PDF from scratch, you are using the default user unit. In your case, a page that measures 552 by 377 user units, is 7.66 by 5.24 inch or 19.47 by 13.30 cm. You need a Rectangle of 581.10 by 396.85 user units: new Rectangle(581.1f, 396.85f); I am not at all familiar with JasperReports, so I can only answer the first part of your question regarding the measurement system. Maybe you can post a second question that focuses on the JasperReports part of your question.
has comment: http://stackoverflow.com/comment/38075396
type: Answer
accepted answer of: http://stackoverflow.com/q/24574626
answers question: http://stackoverflow.com/q/24574626
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/37872208
comment on: http://stackoverflow.com/a/24468824
type: AnswerComment
score: 0
type: Comment
has text: @user3786252: You'll get a NullPointerException if the selectors don't match any elements in the document (`first()` will return null). try.jsoup.org shows the selectors in my answer work on your snippet, but perhaps the actual document you're fetching is somewhat different. Either change the selectors or find the elements with the DOM-traversal methods. You said you were able to extract links, so you should already know how to select an element -- then use `text()` or `ownText()` as appropriate.

http://stackoverflow.com/q/24463768
tagged with: java
has body: I'm trying to use the setView() method for the OrthogonalTiledMapRenderer class in libgdx but I keep getting following error message: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.IncompatibleClassChangeError: Class com.badlogic.gdx.graphics.g2d.SpriteBatch does not implement the requested interface com.badlogic.gdx.graphics.g2d.Batch at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113) Caused by: java.lang.IncompatibleClassChangeError: Class com.badlogic.gdx.graphics.g2d.SpriteBatch does not implement the requested interface com.badlogic.gdx.graphics.g2d.Batch at com.badlogic.gdx.maps.tiled.renderers.BatchTiledMapRenderer.setView(BatchTiledMapRenderer.java:91) at com.nick.seperate.states.Play.render(Play.java:100) at com.nick.seperate.handlers.GameStateManager.render(GameStateManager.java:32) at com.nick.seperate.Seperate.render(Seperate.java:58) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:187) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110) What doesn't make sense to me is that I looked at the code for the com.badlogic.gdx.graphics.g2d.SpriteBatch class and it DOES implement the Batch class. If posting some code will help, just ask but I don't see how it would be helpful.
has comment: http://stackoverflow.com/comment/37860440
has comment: http://stackoverflow.com/comment/37860383
tagged with: libgdx
answer count: 0
has title: classx does not implement the requested interface classx, libgdx
has comment: http://stackoverflow.com/comment/37863261
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37860805
has comment: http://stackoverflow.com/comment/37860373
has comment: http://stackoverflow.com/comment/37860481
type: Question
has comment: http://stackoverflow.com/comment/37860302
score: 0

http://stackoverflow.com/q/24453868
score: -1
tagged with: substring
type: Question
answer count: 3
possible better answer: http://stackoverflow.com/a/24453987
has comment: http://stackoverflow.com/comment/37841786
tagged with: string
favorite count: 0
has title: How to crop multiple text from String in Java?
has answer: http://stackoverflow.com/a/24454138
accepted answer: http://stackoverflow.com/a/24454138
has answer: http://stackoverflow.com/a/24459844
tagged with: regex
upvote count: 0
has comment: http://stackoverflow.com/comment/37841806
has answer: http://stackoverflow.com/a/24453987
downvote count: 1
has comment: http://stackoverflow.com/comment/37841896
type: AnsweredQuestion
has body: I want to crop a portion of String: " this is Test [ABC:123456] Sting with multiple properties [ABC:98765] ..." So in result i want to crop String between "[ ]". {Here ABC:12345 and ABC:98765} Note There can be n number of property. what is the Best way to get result.
tagged with: java

http://stackoverflow.com/q/24522017
type: Question
has comment: http://stackoverflow.com/comment/37968450
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37968605
has title: 400 Bad Request when using @RequestBody on a AutoPopulatingList<T> attribute in a form submitted through JSON
has body: I'm currently using an http ajax call to a server to submit a form. I'm using the latest Spring MVC and Angular for my presentation layer. When I submit the request, I get a 400 Bad Request error whenever I use a AutoPopulatingList attribute in my form class. It works if I remove it. Here is the Form: public class ShopAccountForm { protected AutoPopulatingList&lt;ProfileFormField&gt; profileFields = new AutoPopulatingList&lt;ProfileFormField&gt;(ProfileFormField.class); } Here is my Field in the form public class ProfileFormField { private String fieldCode; private String value; public ProfileFormField(){ } public String getFieldCode() { return fieldCode; } public void setFieldCode(String fieldCode) { this.fieldCode = fieldCode; } public ProfileFormField(String value) { this.value = value; } public void setValue(String value) { this.value = value; } public String getValue() { return value; } } Here is my Controller: @RequestMapping(method = RequestMethod.POST) public @ResponseBody RestResponse&lt;Object&gt; post(@RequestBody @Valid ShopAccountForm form, BindingResult result) { if (result.hasErrors()){ return RestResponse.forError(result); } /// do some processing } Here is the JSON {"profileFields":[{"fieldCode":"FIRST_NAME","value":"Me"},{"fieldCode":"LAST_NAME","value":"Yeah"}]} I tried converting the JSON to but it does not work: {"profileFields[0].fieldCode": "FIRST_NAME","profileFields[0].value": "Me""profileFields[1].fieldCode": "LAST_NAME","profileFields[1].value": "Yeah"} Any idea on how to bind the AutoPopulatingList to a JSON request? Thanks!
score: 0
has comment: http://stackoverflow.com/comment/37968431
has comment: http://stackoverflow.com/comment/37992250
answer count: 1
has comment: http://stackoverflow.com/comment/70968760
type: UnansweredQuestion
tagged with: spring
tagged with: model-view-controller
tagged with: java
has answer: http://stackoverflow.com/a/41893383

http://stackoverflow.com/q/24528335
tagged with: spring
has comment: http://stackoverflow.com/comment/37980034
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24529257
has title: Spring MVC - dealing with reference data from the database
accepted answer: http://stackoverflow.com/a/24529257
tagged with: java
has body: I have a table: municipality_code | municipality_name M01 | bogo M02 | balamban M03 | boljoon Currently, I have a service method that calls a repository method which returns a Map of all the municipalities. The service is then called in all controllers. That means that, every time the service is called, the municipalities will be queried from the database. I was reading on http://springtips.blogspot.com/2008/09/lazy-loading-vs-pre-loading-beans-with.html, am in the right direction? What is the best way to implement this? Would it be better if the municipalities will be queried just once, e.g. preloaded?
type: Question
has comment: http://stackoverflow.com/comment/37980082
score: 0
has comment: http://stackoverflow.com/comment/37980192
answer count: 1
has comment: http://stackoverflow.com/comment/37980281
has comment: http://stackoverflow.com/comment/37980606

http://stackoverflow.com/q/24529572
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/24530151
has answer: http://stackoverflow.com/a/24529672
upvote count: 2
answer count: 2
favorite count: 0
has body: I am new in Collection, as per my knowledge I have already override the hashCode() and Equals() method in Data class, but when I trying to search the element it is giving "not found". Why? Please look at the code below aand help me to find the bug. import java.util.*; public class WordCounter { public static void main(String args[]) { HashSet&lt;Data&gt; set=new HashSet&lt;Data&gt;(); set.add(new Data("this",2)); set.add(new Data("that",3)); set.add(new Data("which",6)); set.add(new Data("how",7)); System.out.println(new Data("how",7).hashCode()); set.add(new Data("hey",3)); set.add(new Data("me",5)); Iterator&lt;Data&gt; itr=set.iterator(); while(itr.hasNext()) { Data d=itr.next(); d.display(); } Data e=new Data("how",7); System.out.println(e.hashCode()+"\t"); if(set.contains(e)) System.out.println("found"); else System.out.println("not found"); } } Data Class: class Data { String word; int fre; public Data(String w,int f) { word=w; fre=f; } public void display() { System.out.println(word+"\t"+fre); } public boolean equals(Data e) { return this.word.equals(e.word) &amp;&amp; this.fre == e.fre; } public int hashCode() { return this.word.hashCode() + this.fre; } }
linked to: http://stackoverflow.com/q/27581
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has title: overriding equals and hashCode in Collection

http://stackoverflow.com/a/24438149
score: 0
type: Answer
has body: Thread priority is just a hint to the OS. This hint, if it does anything at all, will help the OS decide which threads should run when you have more threads needing to run than you have logical CPUs. If you have plenty of free CPU, even the lowest priority thread will run as much as it wants. Note: to raise the priority of a thread on Windows you need to be an Administrator and on Unix you need to be root.
answers question: http://stackoverflow.com/q/24437871

http://stackoverflow.com/comment/37919404
type: Comment
comment on: http://stackoverflow.com/a/24490092
has text: I think you mean she should use `org.bson.types.ObjectId` instead.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24468693
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24468593
has body: There are a number of things happening here System.out.println(time() + "Bufferedreader readline being called and directly printer: " + bufferedReader.readLine()); First time() is invoked to get a value. Say it returns 5. That value is stored on the stack. Then readLine() is invoked and blocks until it receives something. Once it does, it concatenates the 5 from the stack, the String "Bufferedreader read..." and the String returned from readLine. So even though the flush() (and writing to the stream) comes later, the value from time() has already been retrieved. You'd need to synchronized around the whole String concatenation operation.
accepted answer of: http://stackoverflow.com/q/24468593
score: 3
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37878521

http://stackoverflow.com/q/24487865
score: 5
possible better answer: http://stackoverflow.com/a/24548470
has comment: http://stackoverflow.com/comment/38244206
has comment: http://stackoverflow.com/comment/38218511
upvote count: 5
has answer: http://stackoverflow.com/a/24548470
has body: I am using below mapping @Entity @Table(name = "test") public class TestOrder implements Serializable { @Id @Column(name = "orderid", updatable = false) protected Long orderId; @OneToMany(cascade = {CascadeType.ALL}) @JoinColumn(name = "order_id_fk") private List&lt;TestDetails&gt; details; //getters and setters } @Entity @Table(name="test_details") public class TestDetails implements Serializable { @Id //Generator @Column(name = "id", updatable = false, insertable = false) protected Long id; @Column(name="order_id_fk", updatable = false) private Long orderId; //getters and setters } When I update/insert the data, it's trying to update the order_id_fk to null SQL [update test_details set order_id_fk'='null where order_id_fk'='? and id'='?]; constraint [null]; Any help is much appreciated. Updating/Inserting using Spring Integration &lt;int-jpa:updating-outbound-gateway entity-class="com.aaaa.TestOrder" entity-manager-factory="myEntityManagerFactory" persist-mode="MERGE"&gt; &lt;int-jpa:transactional propagation="REQUIRED" transaction-manager="myTransactionManager" /&gt; &lt;/int-jpa:updating-outbound-gateway&gt;
has title: Hibernate One to Many Mapping is trying to update mapping column to null
answer count: 3
has comment: http://stackoverflow.com/comment/37906004
has answer: http://stackoverflow.com/a/24625544
has comment: http://stackoverflow.com/comment/37907617
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38231303
has answer: http://stackoverflow.com/a/24661488
tagged with: spring
has comment: http://stackoverflow.com/comment/37906294
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24625544
tagged with: java
tagged with: hibernate
tagged with: annotations
has comment: http://stackoverflow.com/comment/37906453
type: Question

http://stackoverflow.com/q/24489912
has comment: http://stackoverflow.com/comment/37909877
upvote count: 1
has comment: http://stackoverflow.com/comment/37909522
possible better answer: http://stackoverflow.com/a/24517402
type: Question
has comment: http://stackoverflow.com/comment/37909477
tagged with: jodatime
has answer: http://stackoverflow.com/a/24517402
has answer: http://stackoverflow.com/a/24490380
has title: How to parse a date with timezone only, in Joda-Time?
has comment: http://stackoverflow.com/comment/37909558
answer count: 2
has comment: http://stackoverflow.com/comment/37909845
downvote count: 0
has comment: http://stackoverflow.com/comment/37909499
favorite count: 0
accepted answer: http://stackoverflow.com/a/24490380
has body: I'd like to use Joda-Time to parse a date with an optional timezone: 2014-08-08+02:00 I tried ISODateTimeFormat.dateTimeParser().parseDateTime(date); but that gives me the following error: java.lang.IllegalArgumentException: Invalid format: "2014-08-08+02:00" is malformed at "+02:00"
linked to: http://stackoverflow.com/q/1327229
has comment: http://stackoverflow.com/comment/37909583
has comment: http://stackoverflow.com/comment/37913428
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/37895183
comment on: http://stackoverflow.com/a/24481672
type: Comment
score: 2
has text: +1 awesome answer; will likely accept and link to the currently accepted answer as a specific example of point "B."
type: AnswerComment

http://stackoverflow.com/q/24437954
answer count: 4
has answer: http://stackoverflow.com/a/24438140
tagged with: foreach
type: AnsweredQuestion
score: -5
accepted answer: http://stackoverflow.com/a/24438046
tagged with: java
has comment: http://stackoverflow.com/comment/51294133
has answer: http://stackoverflow.com/a/24438037
type: Question
has comment: http://stackoverflow.com/comment/37829415
upvote count: 0
has comment: http://stackoverflow.com/comment/37814144
has comment: http://stackoverflow.com/comment/37812771
downvote count: 5
has title: For Loop with Lambda Expression in JAVA
has comment: http://stackoverflow.com/comment/37812669
has comment: http://stackoverflow.com/comment/37813538
has body: Why when I use following code I get IndexOutOfBoundsException Code: List&lt;Integer&gt; ints = Stream.of(21,22,32,42,52).collect(Collectors.toList()); System.out.print("the list: "); ints.forEach((i) -&gt; { System.out.print(ints.get(i-1) + " "); }); My error stack: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 11, Size: 5 at java.util.ArrayList.rangeCheck(ArrayList.java:638) at java.util.ArrayList.get(ArrayList.java:414) at Agent.lambda$main$1(Agent.java:33) at Agent$$Lambda$8/980546781.accept(Unknown Source) at java.util.ArrayList.forEach(ArrayList.java:1234) at Agent.main(Agent.java:32) the list: Java Result: 1 but When I change my list to one digit numbers everything is fine Code: List&lt;Integer&gt; ints = Stream.of(2,8,7,4,3).collect(Collectors.toList()); System.out.print("the list: "); ints.forEach((i) -&gt; { System.out.print(ints.get(i-1) + " "); }); output: 2 8 7 4 3
has answer: http://stackoverflow.com/a/24438046
linked to: http://stackoverflow.com/q/24399181
possible better answer: http://stackoverflow.com/a/24438821
has comment: http://stackoverflow.com/comment/37812789
favorite count: 0
has answer: http://stackoverflow.com/a/24438821
has comment: http://stackoverflow.com/comment/37812674
has comment: http://stackoverflow.com/comment/37812757
tagged with: lambda
tagged with: java-8
has comment: http://stackoverflow.com/comment/37813942

http://stackoverflow.com/comment/37996728
comment on: http://stackoverflow.com/q/24536428
has text: I guess I was confusing myself, I basically just want to access the methods and set the values. I included the getters and setters in the class as well as the error.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24545595
type: Answer
has body: You can replace plus sign with %2B before sending in URL. You also can put it as an attribute in request like this request.setAttribute("itemId","&lt;CAAD0KRhXaJ5FAuOxR760HBzgaD-_JyXoVAymeQf+nQdCawEgGA@mail.gmail.com&gt;"); in sender jsp. And get in receiver jsp using request.setAttribute("itemId");
has comment: http://stackoverflow.com/comment/38012878
score: 0
has comment: http://stackoverflow.com/comment/38012818
has comment: http://stackoverflow.com/comment/38012749
answers question: http://stackoverflow.com/q/24545553

http://stackoverflow.com/a/24573365
downvote count: 0
answers question: http://stackoverflow.com/q/24573109
type: Answer
upvote count: 1
score: 1
has body: Edit the java file, compile the java file. Once it is successfully compiled and .class file is produced for the same, replace it with the old .class file and create a jar again. Help on Compile See this How to compile a .java file in Java? Help on creating a jar again (JAVA) Use Command Prompt to create .jar file from multiple .class files

http://stackoverflow.com/comment/38118984
comment on: http://stackoverflow.com/a/24567237
score: 0
type: AnswerComment
has text: dude- please help me! i know it is within your power!
type: Comment

http://stackoverflow.com/comment/37978880
type: QuestionComment
has text: public static void readMyDocument(String fileName){ POIFSFileSystem fs = null; try { fs = new POIFSFileSystem(new FileInputStream(fileName)); HWPFDocument doc = new HWPFDocument(fs); /** Read the content **/ readParagraphs(doc); int pageNumber=1; /** We will try reading the header for page 1**/ readHeader(doc, pageNumber); /** Let's try reading the footer for page 1**/ readFooter(doc, pageNumber); /** Read the document summary**/ readDocumentSummary(doc); } catch (Exception e) { e.printStackTrace(); } }
type: Comment
comment on: http://stackoverflow.com/q/24527482
score: 0

http://stackoverflow.com/comment/37887320
type: Comment
has text: @ben75 keeping aspect ratio without black border - can u provide me a solution?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24476878

http://stackoverflow.com/a/24489322
score: 0
type: Answer
has body: A simple generic example try to analyze the example i gave after reading this documentation You will automaticaly get your answer class A&lt;T&gt; { T value; public A(T x) { value=x; } public void display() { System.out.println(value); } } class GenericType{ public static void main(String arr[]) { A&lt;String&gt; x=new A("It is a String class"); A&lt;Integer&gt; y=new A(5); x.display(); y.display(); } }
answers question: http://stackoverflow.com/q/24489192

http://stackoverflow.com/comment/38002780
score: 0
comment on: http://stackoverflow.com/a/24538755
type: Comment
has text: i get the problem resolved i made a mistake by using table on jpanel and i added the panel iside the scrooll pane not the table , now i fixed by adding the table inside Jscroll pane itself now it's working correctly and thanks camickr for replay
type: AnswerComment

http://stackoverflow.com/comment/38068782
type: Comment
has text: @chrisedwards: camickr is (of course) correct as well. Your getKeyStroke is wrong. You would do well to check out the examples of key bindings to be found on this site before creating your own.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24575792

http://stackoverflow.com/comment/38089937
has text: I tried the code exactly as it is written and it compiled and ran just fine.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24586954
score: 1

http://stackoverflow.com/q/24542183
accepted answer: http://stackoverflow.com/a/25417182
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/25417182
score: 0
has body: First off I need to tell you that I am new to java I have only been using it for a bout 3 weeks. I have am putting to gather a small app, this page (activity) has a bitmap image on it with 12 buttons each button is to invoke a different math equation, I have that bit working sofar. But have 3 problems, 1, the results TextView R.id.resultstextbox named = resultsText, dos not clear when a new button is pressed. I have tried declaring the TextView object as a global but get a runtime error. 2, the results are rounded and I need it to be 3 decimal places. 3, the buttons when placed over the bitmap image in graphical layout are all in the correct place, and this is also good when running in the emulator, but when testing on my phone the buttons have all moved, how do I fix this? I would appreciate any help I can get for this problem ? thanks layout file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:paddingLeft="5dp" android:paddingRight="5dp" &gt; &lt;ImageView android:id="@+id/ohms_wheel_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginBottom="175dp" android:layout_marginTop="5dp" android:contentDescription="@string/ohms_wheel_image" android:src="@drawable/ohmslawwheel" /&gt; &lt;Button android:id="@+id/button7" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/ohms_wheel_image" android:layout_marginRight="14dp" android:layout_toLeftOf="@+id/button6" android:text="Button" /&gt; &lt;Button android:id="@+id/button9" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/butto…
answer count: 1
has comment: http://stackoverflow.com/comment/38046973
has comment: http://stackoverflow.com/comment/38006901
linked to: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/38046881
tagged with: android
has title: the results TextView R.id.resultstextbox named = resultsText, dos not clear when a new button is pressed
has comment: http://stackoverflow.com/comment/39641946
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24503054
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/37933957
has comment: http://stackoverflow.com/comment/37936986
score: 0
has title: Spring MVC application not responding for more than 1 request
has comment: http://stackoverflow.com/comment/37935537
has comment: http://stackoverflow.com/comment/37937574
type: UnansweredQuestion
has body: I have spring mvc based application which has one UI page through which we handle quartz jobs. means this UI page has all quartz job listing, last run status and hyperlinks in the row of each job to start a particular job. When user will clink on this hyperlink, request goes to server and according that job gets triggered. When that job gets completed, controller send backs the response which will get reflected on the UI. Everything is working fine in this UI. But when user want to open any other link or page in our web application, nothing is happening....means browser shows progress but at last it does not go to any page. We are expecting that user can visit any page and when again user will come at this quartz job page, it should get what ever it has. I am not able to understand why this is happening because in web application, many request can be send at a time. So why my application is not responding it. Any pointer in this regard will be really appreciated. Thanks in advance. Thanks, Gopal Lal
tagged with: spring-mvc
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37934351

cdi
tags question: http://stackoverflow.com/q/24534420
tags question: http://stackoverflow.com/q/24473660
tags question: http://stackoverflow.com/q/24446080
tags question: http://stackoverflow.com/q/24518386
tags question: http://stackoverflow.com/q/24544827
type: Tag
tags question: http://stackoverflow.com/q/24533578
tags question: http://stackoverflow.com/q/24480328
tag name: cdi
tags question: http://stackoverflow.com/q/24578646
tags question: http://stackoverflow.com/q/24581363

http://stackoverflow.com/comment/38055200
comment on: http://stackoverflow.com/q/24568294
score: 2
has text: Show these "parseInt tricks"
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37876112
has text: What is the code at **line 28** in your `CopyOfAccessRealInstanceTest` class?
comment on: http://stackoverflow.com/q/24463342
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38055233
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24567871
has text: The only person can can reliably answer this question is the administrator of your company proxy. But you should tell him why you need that information and ask him what he can do.
score: 0

http://stackoverflow.com/comment/38088062
type: Comment
type: QuestionComment
score: 0
has text: @LuiggiMendoza I am now studying about generics. Could that entity you're talking about be a generic method, or it's not a good idea?
comment on: http://stackoverflow.com/q/24579849

http://stackoverflow.com/a/24569438
type: Answer
has comment: http://stackoverflow.com/comment/38057363
answers question: http://stackoverflow.com/q/24569304
score: 0
has body: How about the easy way: String result = line.replaceAll(".*: ", ""); This line says "replace everything up to and including colon space with nothing" (ie delete it).

http://stackoverflow.com/q/24553177
tagged with: swing
possible better answer: http://stackoverflow.com/a/24553246
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24553246
tagged with: java
type: Question
has title: Is there any alternative of swing?
has answer: http://stackoverflow.com/a/24553247
duplicate of: http://stackoverflow.com/q/7358775
downvote count: 5
has body: Is there any alternative of swing? I need a high performance GUI toolkit to create desktop application on linux (Ubuntu). I've been creating swing application for 2 years, therefore I want use java.
has comment: http://stackoverflow.com/comment/38026413
linked to: http://stackoverflow.com/q/7358775
has comment: http://stackoverflow.com/comment/38026997
has answer: http://stackoverflow.com/a/24553240
has answer: http://stackoverflow.com/a/24553231
answer count: 4
accepted answer: http://stackoverflow.com/a/24553247
favorite count: 0
upvote count: 8

http://stackoverflow.com/comment/37809123
has text: At least in NT-based Windows versions, changes in the environment made by a batch are isolated to the batch run. They don't change system-wide and therefore will not affect other batch runs (even of the same batch). For system-wide changes, you need to use the dialog pointed out by Fede.
comment on: http://stackoverflow.com/q/24435358
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37904743
type: QuestionComment
has text: please explian better this sentence "I also cannot direct to the folder with cd Library/Java responding with "Folder does not exist", however I can browse to that folder manually.". what does mean you can browse to it manually? have you created the folder from root?
score: 0
comment on: http://stackoverflow.com/q/24487064
type: Comment

http://stackoverflow.com/comment/37821375
score: 0
has text: Another duplicate: [Whats the best java date recurrence pattern calculator](http://stackoverflow.com/q/492055/642706)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24437200

http://stackoverflow.com/comment/37949835
score: 0
type: Comment
type: QuestionComment
has text: Excuse me, but I do not understand you. How to establish the MTP communication? What do you mean? Is it automatic connection in OS Windows when I plug-in my Android device ? Or I have to write some code to establish?
comment on: http://stackoverflow.com/q/24504193

http://stackoverflow.com/comment/37959467
has text: I moved the `save = new JFileChooser(System.getProperty("user.home//documents"));` out of the block and added it after, and got rid of the "static" on the block because it was giving me errors, but now i get a `Exception in thread "main" java.lang.Error: Unresolved compilation problems:` and 5 `save cannot be resolved` and then a `at guiWithSwing.TextEditor.main(TextEditor.java:84)`
type: AnswerComment
comment on: http://stackoverflow.com/a/24498255
type: Comment
score: 0

http://stackoverflow.com/a/24573995
score: 1
has comment: http://stackoverflow.com/comment/38073345
type: Answer
upvote count: 1
has body: // Latin to ASCII - mostly private static final String TAB_00C0 = "" + "AAAAÄAACEEEEIIII" + "DNOOOOÖ×OUUUÜYTß" + "aaaaäaaceeeeiiii" + "dnooooö÷ouuuüyty" + "AaAaAaCcCcCcCcDd" + "DdEeEeEeEeEeGgGg" + "GgGgHhHhIiIiIiIi" + "IiJjJjKkkLlLlLlL" + "lLlNnNnNnnNnOoOo" + "OoOoRrRrRrSsSsSs" + "SsTtTtTtUuUuUuUu" + "UuUuWwYyYZzZzZzs"; private static HashMap&lt;Character, String&gt; LIGATURES = new HashMap&lt;&gt;(){{ put('æ', "ae"); put('œ', "oe"); put('þ', "th"); put("ĳ", "ij"); put('ð', "dh"); put("Æ", "AE"); put("Œ", "OE"); put("Þ", "TH"); put("Ð", "DH"); put("Ĳ", "IJ"); //TODO }}; public static String removeAllButUmlauts(String value) { value = Normalizer.normalize(value, Normalizer.Form.NFC); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; source.length(); i++) { char c = source.charAt(i); String l = LIGATURES.get(c); if (l != null){ sb.append(l); } else if (c &lt; 0xc0) { sb.append(c); // ASCII and C1 control codes } else if (c &gt;= 0xc0 &amp;&amp; c &lt;= 0x17f) { c = TAB_00C0.charAt(c - 0xc0); // common single latin letters sb.append(c); } else { // anything else, including Vietnamese and rare diacritics l = Normalizer.normalize(Character.toString(c), Normalizer.Form.NFKD) .replaceAll("[\\p{InCombiningDiacriticalMarks}]+", ""); sb.append(l); } } return sb.toString(); } and then String value = "üöäâÇæôøñÁ"; String after = removeAllButUmlauts(value); System.out.println(after) gives: üöäaCaeoonA
answers question: http://stackoverflow.com/q/24548186
downvote count: 0

http://stackoverflow.com/q/24566687
favorite count: 0
tagged with: android
has body: I have a library project that I want to share as AAR file. This library project contains several JAR files, some of them are classes I made and are used in the library project. For example I have a class in the lib project that inherits from a class inside the JAR file. I was able to create the AAR file, and now I'm testing the AAR file in a sample app made in Android Studio. I added the AAR file modifying the build.gradle file of the app module like this: repositories { flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile(name: 'mightylibrary', ext:'aar') compile 'com.android.support:appcompat-v7:20.+' } Then when I try to use methods from the parent class I'm not able to see them, only the methods implemented in the child class. Is there any known limitation of accessing classes inside JARs packaged within a AAR file? Any solution? Thanks
tagged with: android-studio
has comment: http://stackoverflow.com/comment/38069831
upvote count: 3
type: UnansweredQuestion
has title: Android Build: Classes of a JAR file inside a AAR package are not recognized
type: Question
tagged with: aar
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38055031
has answer: http://stackoverflow.com/a/24578699
tagged with: gradle
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/37942084
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24504193
has text: Yes. The app calls MediaScanner. by the method I wrote in the topic. Look more at the bottom of topic( I've added some code)
score: 0

http://stackoverflow.com/comment/37803487
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24432977
score: 0
has text: Read about [quantifiers](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).

http://stackoverflow.com/comment/37899660
type: Comment
has text: @necromancer: Thanks for asking. Feel free to change the accepted answer.
comment on: http://stackoverflow.com/a/24474871
score: 12
type: AnswerComment

http://stackoverflow.com/q/24460334
has answer: http://stackoverflow.com/a/24460442
upvote count: 1
downvote count: 1
tagged with: mouseevent
type: Question
linked to: http://stackoverflow.com/q/10462725
has comment: http://stackoverflow.com/comment/37858139
has body: I have a project where some random text is displayed in a JScrollPane. This text is coded in and is not editable. Is there a way to create a mouse click event on each line of text and have that event take the text clicked on and have it display in a textField? The part that stumps me is how to act on a line of text versus a clickevent on a button per se. Below is a rendering of the project and the areas containing the text.
answer count: 1
has comment: http://stackoverflow.com/comment/37859222
favorite count: 0
has title: Set mouse click event on text?
type: UnansweredQuestion
tagged with: swing
score: 0
tagged with: java

http://stackoverflow.com/comment/38055369
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24568347
has text: Remove the second `int` from that line.

http://stackoverflow.com/a/24646393
has comment: http://stackoverflow.com/comment/38206008
type: Answer
has comment: http://stackoverflow.com/comment/38206914
has body: You need to add one of the following to your config.xml file &lt;preference name="AndroidPersistentFileLocation" value="Internal" /&gt; &lt;preference name="AndroidPersistentFileLocation" value="Compatibility" /&gt; Check More details on this page It says If your application has previously been shipped to users, using an older (pre- 1.0) version of this plugin, and has stored files in the persistent filesystem, then you should set the preference to "Compatibility". Switching the location to "Internal" would mean that existing users who upgrade their application may be unable to access their previously-stored files, depending on their device. EDTT You can try it this way, cdvfile:///data/data/com.myapp.android Check out
has comment: http://stackoverflow.com/comment/38203311
answers question: http://stackoverflow.com/q/24585642
has comment: http://stackoverflow.com/comment/38203251
has comment: http://stackoverflow.com/comment/38207148
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/38209626
has comment: http://stackoverflow.com/comment/38206952

http://stackoverflow.com/a/24571043
answers question: http://stackoverflow.com/q/24513656
type: AcceptedAnswer
has body: Thanks Guys, This Problem is solved now. It was my mistake only. Project List that I was passing was empty So, iterator was throwing exception there.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24513656

http://stackoverflow.com/a/24548343
answers question: http://stackoverflow.com/q/24548251
has body: Under your method dbHelper.deleteUser add this code: contact_data.remove(position); To function in addition to deleting it from the database also have to delete the array of objects that you sent to adapter. EDIT: Add one remove method in your adapter for you can remove object. Code: Adapter: public void removeObject (int position) { this.data.remove(position); } Activity: Change: contact_data.remove(position); to: cAdapter.removeObject(position); cAdapter.notifyDataSetChanged(); EDIT 2: Just delete all the objects from ArrayList. contact_data.clear(); or in your adapter data.clear();
accepted answer of: http://stackoverflow.com/q/24548251
has comment: http://stackoverflow.com/comment/38018484
has comment: http://stackoverflow.com/comment/38018957
score: 0
has comment: http://stackoverflow.com/comment/38018740
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38019292
has comment: http://stackoverflow.com/comment/38017733
type: Answer

http://stackoverflow.com/q/24528708
has comment: http://stackoverflow.com/comment/37981747
has comment: http://stackoverflow.com/comment/37980911
has answer: http://stackoverflow.com/a/24529273
has title: How to show pop up the pdf file instead of saving internally using java?
tagged with: servlets
downvote count: 0
answer count: 1
tagged with: jsp
score: 1
has body: I have used iText jar to export the contents in pdf. I have used FileOutputStream to store the file in my local (like D:/filename.pdf). Instead of doing this, I need to show the popup dialog box to be appear and ask for save option in pdf. How to achieve it? Here is my code. JSP: <%@ page language="java" pageEncoding="ISO-8859-1"%> Export to Excel - Demo some text Export to Excel Servlet: import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.itextpdf.text.Document; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; /** * Servlet implementation class Sample */ public class Sample extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Sample() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("Inside doGet"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("Inside doPost"); try { actionExportToPDF(request, response); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void actionExportToPDF(HttpServletRequest request, HttpServletResponse response) throws Exception { /* Create Connection objects */ Class.forName …
favorite count: 0
accepted answer: http://stackoverflow.com/a/24529273
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
tagged with: java
tagged with: itext
upvote count: 1
type: Question

http://stackoverflow.com/comment/38014482
comment on: http://stackoverflow.com/q/24545819
type: QuestionComment
has text: Did you try to read InputStream from Process (getErrorStream() / getInputStream())?
score: 0
type: Comment

http://stackoverflow.com/a/24529614
has comment: http://stackoverflow.com/comment/37983024
has body: i got my answer: package com.usd.swipegesture; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.widget.TextView; import android.widget.Toast; public class Gesture extends Activity { float x1, x2; float y1, y2; static int b = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gesture); } // onTouchEvent () method gets called when User performs any touch event on // screen // Method to handle touch event like left to right swap and right to left // swap public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { // when user first touches the screen we get x and y coordinate case MotionEvent.ACTION_DOWN: { x1 = touchevent.getX(); y1 = touchevent.getY(); break; } case MotionEvent.ACTION_UP: { x2 = touchevent.getX(); y2 = touchevent.getY(); // if left to right sweep event on screen if (x1 &lt; x2) { // Toast.makeText(this, "Left to Right Swap Performed", // Toast.LENGTH_LONG).show(); // b--; if (b &lt; 1) { b = 1; } if (b == 1) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("1"); } if (b == 2) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("2"); } if (b == 3) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("3"); } // } // if right to left sweep event on screen if (x1 &gt; x2) { // Toast.makeText(this, "Right to Left Swap Performed", // Toast.LENGTH_LONG).show(); // b++; if (b == 1) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("1"); } if (b == 2) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("2"); } if (b == 3) { TextView tv = (TextView) findViewById(R.id.textView1); tv.setText("3"); } if (b &gt; 3) { b = 3; } // } break; } } return false; } }
has comment: http://stackoverflow.com/comment/37982434
answers question: http://stackoverflow.com/q/24528745
has comment: http://stackoverflow.com/comment/37983569
score: 0
type: Answer

http://stackoverflow.com/comment/38064371
has text: What TestRunner are you using, how do you specifiy which tests exactly to run (project, package, class)? Because my tests go through even if single tests fail..
comment on: http://stackoverflow.com/q/24572550
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24583071
tagged with: java
has comment: http://stackoverflow.com/comment/38086784
has comment: http://stackoverflow.com/comment/38082408
has comment: http://stackoverflow.com/comment/38120777
tagged with: jscrollbar
has comment: http://stackoverflow.com/comment/38135459
has body: I use a simple JScrollbar for my app for controlling the visible part of a drawing in a JPanel. Every time I move the view port I use the setValue method of the scroll-bar, and every time I drag the scroll-bar I move the view port. This is the basic code: public void adjustmentValueChanged(AdjustmentEvent event) { JScrollBar scrollbar = ((JScrollBar) event.getSource()); if (scrollbar.getValueIsAdjusting()) { _panel.moveViewport(scrollbar.getValue(), 0); } } And when I programmatically change the view port I use the method moveViewport public void moveViewport(int x, int y) { /* change the viewport */ _scrollbar.setValue(x) } All works fine. I use getValueIsAdjusting to differentiate when the value was changed from the setValue and the drag of the knob. My problem is when I try to use the unitIncrement buttons. When I press a button, the event is the same as when I call scrollbar.setValue. So if I change the if (event.getValueIsAdjusting) to accept the click, it will accept the setValue and it starts a recursion. What is the design pattern in this case? Is the only answer to extend scroll-bars as in MouseListener for JScrollBar arrow buttons? Please, do not tell me to use JScrollPane. I can not use it for other reasons. But I think that everything a scroll pane can do I could do with a JScrollBar. EDIT: I think I fixed it... but I do not understand how!!! I used removed the getIsValueIsAdjusting and used the SwingUtilities.invokeLater (thanks to this question) and now I can press the buttons without recursion. So my new question is "why it works?"
linked to: http://stackoverflow.com/q/24481823
score: 0
linked to: http://stackoverflow.com/q/9863995
has comment: http://stackoverflow.com/comment/38089956
has title: How to differentiate between setValue and clicking arrow buttons in a JScrollBar?
linked to: http://stackoverflow.com/q/24064653
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14574770
tagged with: swing
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/38082470
has comment: http://stackoverflow.com/comment/38092243
type: Question
has comment: http://stackoverflow.com/comment/38139777

http://stackoverflow.com/comment/37821669
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24442686
has text: I'd start with deleting `C:\Users\...\AppData\Roaming\NetBeans\8.0\var`, but you could try moving `C:\Users\...\AppData\Local\NetBeans\Cache\8.0` to a temp location and see what you get...
type: Comment

http://stackoverflow.com/a/24482479
answers question: http://stackoverflow.com/q/24482106
upvote count: 2
has comment: http://stackoverflow.com/comment/37896078
type: Answer
has comment: http://stackoverflow.com/comment/37897031
score: 2
has body: That's pretty perfectly obfuscated. So that it even may work without anyone noticing. Let's go through: filters.containsKey("id") Useless, drop it. filters.get("id") instanceof Integer Better throw if someone has put something else in. So drop it, too. return ((Integer)filters.get("id")).equals(employee.getId())&amp;&amp;((BigDecimal)filters.get("salary")).compareTo(employee.getSalary())&gt;=0; What would you do with 5 or 10 conditions? Combinatorial explosion? So what about this? Integer id = (Integer) filters.get("id"); if (id != null &amp;&amp; !id.equals(employee.getId())) return false; BigDecimal salary = (BigDecimal) filters.get("salary"); if (salary != null &amp;&amp; ((salary.compareTo(employee.getSalary()) &lt; 0)) return false; return true;
has comment: http://stackoverflow.com/comment/37897333
has comment: http://stackoverflow.com/comment/37896346
downvote count: 0
has comment: http://stackoverflow.com/comment/37896198
has comment: http://stackoverflow.com/comment/37897151
accepted answer of: http://stackoverflow.com/q/24482106
type: AcceptedAnswer

http://stackoverflow.com/q/24571372
has answer: http://stackoverflow.com/a/24572031
tagged with: eclipse-pde
type: AnsweredQuestion
tagged with: eclipse-indigo
tagged with: java
tagged with: eclipse
type: Question
has body: EDIT : SOLVED Background I have implemented a eclipse plugin (on indigo, 3.7.2) that provide a new icon in the bar menu. This new action is fully initialized few seconds after eclipse startup (some configuration files are loaded from my maven repository). I'm trying to disable this action until my activator finish initalization. What I'm looking for Before initialization After initialization What I've already done I added an enablement test on my action. My action will be enabled only if my plugin is activated. [...] I defined a startup class, where ignite() method initialize my plugin configuration : public class Startup implements org.eclipse.ui.IStartup{ @Override public void earlyStartup() { try { Activator.getDefault().ignite(); Activator.getDefault().setChanged(); Activator.getDefault().notifyObservers(); } catch (Exception e) { e.printStackTrace(); } } } I implemented an observing design pattern between my action and my activator (to notify the initialization end). public class ShortcutsAction extends Action implements IWorkbenchWindowPulldownDelegate, IMenuCreator, IObserver { private IAction action; private Menu menu; public boolean enabled = false; public ShortcutsAction() { super(); Activator.getDefault().addObserver(this); } @Override public void selectionChanged(IAction action, ISelection selection) { // Change action object instance at first selection if (action != this.action) { this.action = action; } // If property enabled is true, enable this action if (enabled) { action.setEnabled(true); } else { action.setEnabled(false); } } [...] @Override public void update(IObservable obs, Object obj) { this.enabled = true; ConsoleHandler.logInfo("Shortcut enabled"); action.setEnabled(true); } } Conclusion I got what I was looking for : At loading, my action is disabled Since my plugin is initialized, my action is enabled Thank you.
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
accepted answer: http://stackoverflow.com/a/24572031
score: 2
has title: Eclipse plugin : disable/enable dynamically an action from main menubar
upvote count: 2

http://stackoverflow.com/a/24519480
answers question: http://stackoverflow.com/q/24518927
has body: If the wallpapers you're setting are live ones, and it appears that is the case, use this: boolean wallpaperWasSetByAnotherApp() { WallpaperManager wp_mngr = (WallpaperManager) getSystemService(WALLPAPER_SERVICE); WallpaperInfo info = wp_mngr.getWallpaperInfo(); if (info == null) { // wallpaper is a static image return true; } else { // wallpaper is live, check implementing service return !info.getComponent().equals(new ComponentName(this, getClass())); } }
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24518927
score: 1

http://stackoverflow.com/q/24516349
has answer: http://stackoverflow.com/a/24516389
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24516397
duplicate of: http://stackoverflow.com/q/4801371
type: Question
has answer: http://stackoverflow.com/a/24516597
has comment: http://stackoverflow.com/comment/37957764
tagged with: manifest
tagged with: eclipse
answer count: 3
upvote count: 1
tagged with: launcher
linked to: http://stackoverflow.com/q/4801371
has answer: http://stackoverflow.com/a/24516397
has body: I'm getting something that looks like this: "No Launcher activity found! The launch will only sync the application package on the device!" I'm not sure how to fix this. My AndroidManifest looks like this: <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="20" /> Any help would be greatly appreciated. Thanks!
favorite count: 0
has comment: http://stackoverflow.com/comment/37957753
accepted answer: http://stackoverflow.com/a/24516389
has title: No launcher activity found in eclipse java android
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/24576028
has comment: http://stackoverflow.com/comment/38069361
has comment: http://stackoverflow.com/comment/38069315
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38069355
has answer: http://stackoverflow.com/a/24576101
has answer: http://stackoverflow.com/a/24576084
tagged with: java
tagged with: methods
has title: Ways of calling non static method from main in Java
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/24576103
has comment: http://stackoverflow.com/comment/38069456
upvote count: 0
has answer: http://stackoverflow.com/a/31339141
tagged with: program-entry-point
has comment: http://stackoverflow.com/comment/38069197
has comment: http://stackoverflow.com/comment/38069471
score: -7
has body: We all know that we cannot call a non-static method from Java's static main method directly. I've written 2 ways to call non-static method from main (shown below). What I wanted to ask is: Is there any significance difference between using code 1 and code 2 to overcome the limitation? Code 1 public class Demo { public static void main(String[] args) { Demo demo = new Demo(); demo.printText(); } public void printText() { System.out.println("Method successfully called."); } } Code 2 public class Demo { public static void main(String[] args) { new Demo().printText(); } public void printText() { System.out.println("Method successfully called."); } } NOTE: In school, our professor told us "In Java, staticmethods of a class can be invoked through the name of the class in which they are defined, without having to instantiate an object of the class first." But in code 2 no object was instantiated, yet I was able to call the non static-method?
has comment: http://stackoverflow.com/comment/38069269
favorite count: 0
has comment: http://stackoverflow.com/comment/38069487
answer count: 4
tagged with: static
has comment: http://stackoverflow.com/comment/38069618

http://stackoverflow.com/a/24478229
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24477601
has body: The Javadoc of WatchService says: File systems may report events faster than they can be retrieved or processed and an implementation may impose an unspecified limit on the number of events that it may accumulate. Where an implementation knowingly discards events then it arranges for the key's pollEvents method to return an element with an event type of OVERFLOW. This event can be used by the consumer as a trigger to re-examine the state of the object. StandardWatchEventKinds.OVERFLOW is of type WatchEvent.Kind&lt;Object&gt;, which I believe is why pollEvents needs to return a List of WatchEvent&lt;?&gt; rather than WatchEvent&lt;Path&gt;. The Javadoc for OVERFLOW also mentions: The context for this event is implementation specific and may be null which is why the type of the overflow event needs to be WatchEvent&lt;Object&gt;. Note that the tutorial that you linked suggests the following: Retrieve the type of event by using the kind method. No matter what events the key has registered for, it is possible to receive an OVERFLOW event. You can choose to handle the overflow or ignore it, but you should test for it. You should therefore add the following to your code (if you haven't already): if (kind == OVERFLOW) { continue; }
answers question: http://stackoverflow.com/q/24477601
type: AcceptedAnswer
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/37873913
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24469412
has text: My bad. 1+ to your answer.

http://stackoverflow.com/comment/37880856
score: 0
type: Comment
has text: I just added that, so my now code is: http://pastebin.com/ehMCh054 and that gives me an error of: http://pastebin.com/LmtWyba4
comment on: http://stackoverflow.com/a/24473936
type: AnswerComment

http://stackoverflow.com/a/24551672
score: 1
has body: Many Maven plugins allow to use some properties to specify the parameters. The maven.compiler.source and maven.compiler.target properties are specified by the Maven Compiler Plugin. See the "User Property" sections: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#target http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24551558
downvote count: 0

oracle-database
tags question: http://stackoverflow.com/q/24505982
tags question: http://stackoverflow.com/q/24520562
tags question: http://stackoverflow.com/q/24528222
tags question: http://stackoverflow.com/q/24443477
tags question: http://stackoverflow.com/q/24498317
tag name: oracle-database
tags question: http://stackoverflow.com/q/24509919
tags question: http://stackoverflow.com/q/24548563
tags question: http://stackoverflow.com/q/24497804
tags question: http://stackoverflow.com/q/24503219
tags question: http://stackoverflow.com/q/24485070
tags question: http://stackoverflow.com/q/24498345
tags question: http://stackoverflow.com/q/24484709
tags question: http://stackoverflow.com/q/24502568
type: Tag
tags question: http://stackoverflow.com/q/24510114
tags question: http://stackoverflow.com/q/24428824
tags question: http://stackoverflow.com/q/24434466
tags question: http://stackoverflow.com/q/24448373
tags question: http://stackoverflow.com/q/24581258
tags question: http://stackoverflow.com/q/24490776
tags question: http://stackoverflow.com/q/24583766
tags question: http://stackoverflow.com/q/24478747
tags question: http://stackoverflow.com/q/24546612
tags question: http://stackoverflow.com/q/24569602
tags question: http://stackoverflow.com/q/24566974
tags question: http://stackoverflow.com/q/24440820
tags question: http://stackoverflow.com/q/24486777
tags question: http://stackoverflow.com/q/24509062
tags question: http://stackoverflow.com/q/24538502
tags question: http://stackoverflow.com/q/24557298
tags question: http://stackoverflow.com/q/24475105
tags question: http://stackoverflow.com/q/24511923

http://stackoverflow.com/q/24486370
type: Question
has answer: http://stackoverflow.com/a/24504539
favorite count: 0
upvote count: 1
tagged with: spring
answer count: 1
has body: Hello I'm having hard time trying to configure weblogic for stateless bean (Spring). I'm new on that field. I'm having 2-layer application. Server (weblogic + DB + java app) and client written in swing. When calling this line: getCtx().lookup(SomeStatelessRemoteHome.class.getName()), SomeStatelessRemoteHome.class); I got this error: Caused by: javax.naming.CommunicationException [Root exception is weblogic.rjvm.PeerGoneException: ; nested exception is: java.io.EOFException] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:74) at weblogic.jndi.internal.WLContextImpl.translateException(WLContextImpl.java:472) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:428) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:412) at javax.naming.InitialContext.lookup(Unknown Source) at pl.com...SomeStatelessRemoteLbkProxy.<init>(SomeStatelessRemoteLbkProxy.java:49) ... 46 more Caused by: weblogic.rjvm.PeerGoneException: ; nested exception is: java.io.EOFException at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259) at weblogic.jndi.internal.ServerNamingNode_1036_WLStub.lookup(Unknown Source) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:424) ... 49 more Caused by: java.io.EOFException at weblogic.rjvm.t3.MuxableSocketT3.endOfStream(MuxableSocketT3.java:345) at weblogic.socket.SocketMuxer.deliverExceptionAndCleanup(SocketMuxer.java:827) at weblogic.socket.SocketMuxer.deliverEndOfStream(SocketMuxer.java:761) at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:958) at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:889) at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:339) at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29) at weblogic.work.Exec…
tagged with: stateless
accepted answer: http://stackoverflow.com/a/24504539
tagged with: java
has title: java.io.EOFException at weblogic
tagged with: ejb
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: weblogic-10.x

http://stackoverflow.com/comment/38057101
score: 1
has text: The key here was it should be a *request* header, not a response header.
type: AnswerComment
comment on: http://stackoverflow.com/a/24556401
type: Comment

http://stackoverflow.com/q/24500250
has comment: http://stackoverflow.com/comment/37942808
has comment: http://stackoverflow.com/comment/37941777
has comment: http://stackoverflow.com/comment/37942957
answer count: 1
has title: Java NIO filesystem
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37941693
has answer: http://stackoverflow.com/a/24500357
has comment: http://stackoverflow.com/comment/37930242
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/37943129
has comment: http://stackoverflow.com/comment/37942835
type: Question
has comment: http://stackoverflow.com/comment/37942306
tagged with: filesystems
has body: I am trying to create a Java Swing Application in which I will be storing some image files and CSV files in a subdiretory com/p/d/resources/project/MyProject In above project there will be other sub-directories in which I will be storing the images and CSV files. How to access above directory in seamless way. That is even if I run this project as a JAR(which I will ultimately do) or on Eclipse it should give me the access to above directory either as java.nio.file.Path OR java.io.File. I know I can create a filsystem to iterate JAR but the same code doesn't work when I run it as application in Eclipse. Following is the code I am using for JAR file scenario: String projectLocationPath = ApplicationProperties .get(PhaserDesktopConstants.PROJECT_LOCATION_PATH); CodeSource src = MainController.class.getProtectionDomain() .getCodeSource(); if (src != null) { URL jar = src.getLocation(); FileSystem fs = FileSystems.newFileSystem(jar.toURI().normalize(), null); Path projectDirectory = fs.getPath(projectLocationPath); if (!Files.isDirectory(projectDirectory)) { return null; } } Where PhaserDesktopConstants.PROJECT_LOCATION_PATH represents path I gave above. I want to run above code in both scenarios with JAR and without JAR. I get following path file:/D:/shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ when I run it in Eclipse and calling FileSystems.newFileSystem(..) with this gives me exception java.lang.IllegalArgumentException: Path component should be '/' Following some posts on SO I tried hardcoding and changing the path from file:/D:/shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ to file:///D:/shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ file://D:/shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ file:///shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ file://shailesh/technical/work/eclipse_ws/Phaser%20Desktop/bin/ but none worked. Just an Update: when I debug in eclipse my JAR it gives me following path as location of Cod…
tagged with: nio
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37941827
has comment: http://stackoverflow.com/comment/37943569

http://stackoverflow.com/comment/38043289
score: 1
type: AnswerComment
type: Comment
has text: I ended up figuring out that the -hmac key was just treating the key as a string, and taking the bytes of that. The version of openssl (0.9.8e) i use doesn't seem to recognize openssl dgst -sha256 -mac HMAC -macopt as a command
comment on: http://stackoverflow.com/a/24545919

http://stackoverflow.com/q/24530536
has comment: http://stackoverflow.com/comment/37986038
has comment: http://stackoverflow.com/comment/37985748
type: Question
has body: I am working on a web app and I have to implement a login/logout system. I have already implemented the login system(validating by verification through a database) in a controller servlet. Basically the most important aspect of my project is to keep a MVC approach. So here is the controller login servlet that I have implemented, package com.cid_org.controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.cid_org.model.*; import java.sql.*; /** * Servlet implementation class LoginControllerServlet */ public class LoginControllerServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LoginControllerServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /*Take the data submitted by the user though the login * form(Remember the HTTP Post request ->HttpServletRequest request object*/ String username = request.getParameter("username"); String pwd = request.getParameter("pass"); System.out.println(username + "aaa"); System.out.println(pwd); Connection connection = (Connection)getServletContext().getAttribute("connection_context_param"); LoginModelPOJO lmpojo = new LoginModelPOJO(username, pwd, connection); boolean isUserValidFlag = lmpojo.isValid(); if(isUserValidFlag){ /*Entering this block indicates the user …
has comment: http://stackoverflow.com/comment/37985402
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/37985825
has comment: http://stackoverflow.com/comment/37984799
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/37984907
has title: How do I invalidate a login session initialized in one servlet in another servlet with a href in between?
has answer: http://stackoverflow.com/a/24531198
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24531198
has comment: http://stackoverflow.com/comment/37985294
tagged with: java

http://stackoverflow.com/q/24443479
has body: In my controller I have code like the following. RedisTemplate stringRedisTemplate def accessRedis() { val = stringRedisTemplate.opsForValue().get('Key') } In my controller Test, I intent to inject a mocked RedisTemplate that return a mocked ValueOperations. My code: def template = mockFor(RedisTemplate) def val = mockFor(org.springframework.data.redis.core.ValueOperations) val.demand.get {p-&gt; println "$p"} template.demand.opsForValue { return val.createMock() } controller.stringRedisTemplate = template.createMock() controller.accessRedis() However, I got the following error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.tnd.viewport.ui.AppHawkControllerSpec$_$spock_feature_0_1_closure2@1aa55dd5' with class 'com.tnd.viewport.ui.AppHawkControllerSpec$_$spock_feature_0_1_closure2' to class 'org.springframework.data.redis.core.ValueOperations' Could you advice a solution for my scenario? Thanks!
answer count: 2
score: 5
tagged with: mocking
favorite count: 0
has answer: http://stackoverflow.com/a/33473738
tagged with: redis
has title: Controller Unit Test How do I mock RedisTemplate opsForValue with return type ValueOperations
has answer: http://stackoverflow.com/a/61382433
upvote count: 5
downvote count: 0
type: UnansweredQuestion
tagged with: unit-testing
tagged with: java
tagged with: grails
type: Question

http://stackoverflow.com/q/24525846
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37975455
answer count: 1
accepted answer: http://stackoverflow.com/a/24525948
has comment: http://stackoverflow.com/comment/37975394
tagged with: opencsv
has comment: http://stackoverflow.com/comment/37975329
tagged with: http://stackoverflow.com/tag/csv
has body: I have this CSV: 0,102000082,,2,125,'Battery location','Left-hand drive',2,2 0,300000029,102000082,3,895,'Behind the cab','Left',2,-7 0,102000082,,4,127,'Battery location','Right-hand drive',4,4 ^----- I use csvReader to map to a bean public static List&lt;BatteryBean&gt; loadAndRead{ File csvFilename = new File("C:\\my.csv"); CSVReader csvReader = new CSVReader(new FileReader(csvFilename)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(BatteryBean.class); String[] columns = new String[] { "ktypnr","sentenceId","parentId","sortOrder", "adjItemNoteId","sentText","itemNoteText","parentSortOrder1","parentSortOrder10" }; strat.setColumnMapping(columns); CsvToBean csv = new CsvToBean(); List&lt;BatteryBean&gt; list = csv.parse(strat, csvReader); return list; } public static void main(String[] args) { try { List&lt;BatteryBean&gt; list = loadAndRead("C:\\work\\battery_report_raw.csv"); for (Object object : list) { BatteryBean bb = (BatteryBean) object; System.out.println(bb.getKtypnr()); } } So the problem is that the file contains empty strings between ,, and I get an exeption at parsing : Caused by: java.lang.NumberFormatException: For input string: "" I resolved. I have another question Csv file ktypnr sentence_id parent_id sort_order adj_item_note_id sent_text iem_note_text 0 102000082 2 125 Battery location' Left-hand drive' 0 300000029 102000082 3 895 Behind the cab' Left' 0 102000082 4 127 Battery location' Right-hand drive' 0 300000029 102000082 5 898 Behind the cab' Right' So if one sentence_id = one parent_id i should combine those two so that looks like this(example first line and second line) but I should consider also the sort_order: 0, Battery location, Left-hand drive, Behind the cab, Left I don't know how to proceed
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37975318
tagged with: java
has title: CSV Reader empty values java
has answer: http://stackoverflow.com/a/24525948

http://stackoverflow.com/q/24501149
tagged with: android
accepted answer: http://stackoverflow.com/a/24501834
possible better answer: http://stackoverflow.com/a/27652675
has answer: http://stackoverflow.com/a/27652675
tagged with: android-studio
type: AnsweredQuestion
tagged with: android-gradle-plugin
has answer: http://stackoverflow.com/a/51705367
has answer: http://stackoverflow.com/a/30774581
has answer: http://stackoverflow.com/a/30401442
score: 23
upvote count: 23
type: Question
has answer: http://stackoverflow.com/a/27493215
has answer: http://stackoverflow.com/a/25575215
tagged with: java
has title: Android Studio - Resource Entry already defined
has answer: http://stackoverflow.com/a/29003030
has answer: http://stackoverflow.com/a/51583433
has body: After compiling my Android application using the Android Studio (Beta), I have the following error: Error:error: Resource entry background is already defined. res\drawable-xhdpi-v4\background.9.png:0: Originally defined here. This occurred when I had a image file called "background" in my res folder. I then made a 9 patch version of it and pasted it in the same folder. This meant that there was 2 files with the same name. So I unsurprisingly I had this error. However I now deleted all instances of the background image file (including the 9 patch version and original image) in my code and layout file and I still have this error.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24501834
answer count: 9

http://stackoverflow.com/a/24451773
score: 0
answers question: http://stackoverflow.com/q/24451368
has body: If you use a foreach statement (in Java is called "enhanced for loop") you have to declare the type of the variabile inside the statement, or it won't compile. If you want to initialize at the top, you cannot use the foreach, but a simple for loop like this: int i = 0; for (; i &lt; array.length; i++) { } or int i; for (i = 0; i &lt; array.length; i++) { }
type: Answer

http://stackoverflow.com/q/24586116
tagged with: android
has answer: http://stackoverflow.com/a/24586406
has comment: http://stackoverflow.com/comment/38089480
tagged with: mkdir
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38087855
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38087708
type: Question
tagged with: java
has body: I have some problems with my app on Android emulated devices because the Android/data folder (where private app folders are to be created, to be accessed with Environment.getExternalStorageDirectory()) is not present after the device has been created and started in emulator. I prefer not to use the mkdir command after checking if the folder exists on real users' devices for security reasons, so I hope this issue is found only in emulated devices. Is the Android/data folder present in all real hardware devices from factory?
score: 0
has comment: http://stackoverflow.com/comment/38087734
answer count: 1
tagged with: directory
has title: Is the /mnt/sdcard/Android/data folder (or equivalent) present in all hardware devices from factory?
favorite count: 0
tagged with: private

http://stackoverflow.com/a/24518739
has body: I removed int numberOfVideos = projects.videos.size(); Instead of using if(numberOfVideos==0) I used projects.videos == null I think it was because my projects are null so it crashes when trying to pull the size of the arrayList.
answers question: http://stackoverflow.com/q/24518518
type: Answer
score: 0

http://stackoverflow.com/comment/38202085
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24626107
has text: the solution I have provided is for BlankActivity not creating activtity issue in my case (Eclipse kepler with ADT 23).Creating a EmptyActivity created an activity and thereafter src folder contained that activity.I am not referring to other aspects of this issue.
score: 0

http://stackoverflow.com/comment/37813668
has text: Edit your question and add that xml layout file, maybe the `RelativeLayout` where you add the `TextViews` is hidden for some reason.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24438030

http://stackoverflow.com/q/24487686
downvote count: 0
has title: Assigning data layers to grid in Repast J
answer count: 1
favorite count: 0
tagged with: repast-simphony
has answer: http://stackoverflow.com/a/25182309
type: UnansweredQuestion
score: 1
tagged with: java
has body: I am trying to write an ABM in Repast Java Suite and am using a 3D grid for that. Two questions about the grid: 1) I want to assign a functional value for each (x,y) combination in the grid- E.g. for each f(x,y)=x+y. So, when an agent is at point (x,y), it will know that corresponding z value is z=f(x,y)=x+y. How can I assign a data layer to the grid to do that? 2) Again for the same grid, agents should be able to know that whether specific patch is visited or not. It will be updated whenever an agent visits that patch. In general, my problem is to assign additional methods, data etc. to the grid interface. As it's a fundamental question for my simulation, I can't move further without solving it.. Answers really appreciated.. Thanks!
upvote count: 1
tagged with: grid
type: Question
tagged with: agent-based-modeling

http://stackoverflow.com/comment/37897241
has text: but on what bases jvm considers most **specfic** type?its still unclear to me
comment on: http://stackoverflow.com/q/24483130
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24491124
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24491093
has body: Use Math.ceil. This will round up to nearest integer.
downvote count: 0

http://stackoverflow.com/q/24528263
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/65767351
has title: org.dom4j.DocumentException: Connection timed out: connect and Nested exception: Connection Nested exception
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38019295
upvote count: 1
accepted answer: http://stackoverflow.com/a/24549341
type: Question
has comment: http://stackoverflow.com/comment/37980489
has comment: http://stackoverflow.com/comment/37980080
has answer: http://stackoverflow.com/a/58670794
has body: I have changed my pc and i have reinstalled all: tomcat 8 and 6, netbeans 8, jdk 1.7, hibernate 4.3.4, but when i run the web app, i have this error. In past with my old pc i don't have this error but the code and the lib are the same, this error happen when i try to get data from database SEVERE: Servlet.service() for servlet Controller threw exception org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) ..cut.. Nested exception: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) ..cut.. SEVERE: Servlet.service() for servlet Controller threw exception java.lang.NoClassDefFoundError: Could not initialize class ..cut..HibernateUtil at my.package.data.DataAccess.getUser(DataAccess.java:38) this is HibernateUtil.java: package my.package; import org.hibernate.SessionFactory; import org.hibernate.service.*; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory1(); private static SessionFactory buildSessionFactory1() { Configuration configuration = new Configuration().configure(); StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder(); serviceRegistryBuilder.applySettings(configuration.getProperties()); ServiceRegistry serviceRegistry = serviceRegistryBuilder.build(); return configuration.buildSessionFactory(serviceRegistry); } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { getSessionFactory().close(); } }
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/58670794
favorite count: 0
has answer: http://stackoverflow.com/a/24549341
has comment: http://stackoverflow.com/comment/38021227
has comment: http://stackoverflow.com/comment/37982066

http://stackoverflow.com/comment/37809946
type: AnswerComment
comment on: http://stackoverflow.com/a/24433167
has text: Depends what makes sense for your application. Do you want to have partial data if something goes wrong, or go back to having nothing added? For the former commit after each result set.
score: 0
type: Comment

http://stackoverflow.com/q/24436562
has comment: http://stackoverflow.com/comment/37810297
has answer: http://stackoverflow.com/a/24436630
score: 2
type: AnsweredQuestion
upvote count: 3
has title: Basic Java: While loop for basic quiz?
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24436630
has answer: http://stackoverflow.com/a/24436591
has body: I started learning Java last night, and I'm trying to make my first code without it being dictated to me! It is a simple quiz question that asks the user "Do you think my dog is cute?" If they answer "Yes," the dog Woofs and smiles. If they say "no" He growls at them and frowns. If a different answer is given, "What? Please try again" is printed. I have no issue getting this working so far, but now I am trying to make it so that when an unrecognised answer is put in, the question is asked again, and this repeats until they answer either "Yes" or "No." Here is what I have tried: import java.util.Scanner; public class CopyOfMain { public static void main(String joel[]){ System.out.println("Do you think my dog Olly is cute? Yes or No"); Scanner ans = new Scanner(System.in); String Ans = ans.nextLine(); while (!Ans.equals("Yes") || !Ans.equals("No")); { if (Ans.equals("Yes")){ System.out.print("Woof :-)"); }else if(Ans.equals("No")){ System.out.print("Grrrr :-("); }else{ System.out.print("What? Please try again."); } } ans.close(); } } All I have added to the working code is the while loop, but now if "Yes" or "No" is entered, there is no printed woof or growl. However, if something other than "Yes" or "No" is entered, the correct words and printed, but the question is still not re-asked. Could someone please suggest a fix?
has answer: http://stackoverflow.com/a/24437908
tagged with: while-loop
has answer: http://stackoverflow.com/a/24437332
has comment: http://stackoverflow.com/comment/37810012
favorite count: 0
possible better answer: http://stackoverflow.com/a/24436621
has answer: http://stackoverflow.com/a/24436621
answer count: 5

http://stackoverflow.com/a/24565412
answers question: http://stackoverflow.com/q/24565344
has body: The &amp;&amp; gives you the behaviour you want because it requires both of those conditions to evaluate to true in order to continue. This means that if answer equals guess (the first conditions fails), or i equals five (the second condition fails), the loop will exit. However, with the || operator, you're saying continue on as long as either one of these is true. They're known as logical and and logical or, respectively. This should help: a &amp;&amp; b -> if both are true, evaluates to true, otherwise false a || b -> if either are true, evaluates to true, otherwise false
type: Answer
score: 0

http://stackoverflow.com/q/24454367
favorite count: 0
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/11932578
has title: AutoCompleteTextview in PopupWindow in Android
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/17210192
duplicate of: http://stackoverflow.com/q/11932578
has body: I am trying to implement an auto complete textview inside a popup, I'm trying to find solutions for the following Error: 06-27 16:54:19.908: E/AndroidRuntime(11236): android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@426d6eb0 is not valid; is your activity running? 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.view.ViewRootImpl.setView(ViewRootImpl.java:532) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.PopupWindow.invokePopup(PopupWindow.java:1019) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:925) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.ListPopupWindow.show(ListPopupWindow.java:625) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1096) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:971) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:953) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.os.Handler.dispatchMessage(Handler.java:102) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.os.Looper.loop(Looper.java:136) 06-27 16:54:19.908: E/AndroidRuntime(11236): at android.app.ActivityThread.main(ActivityThread.java:5001) 06-27 16:54:19.908: E/AndroidRuntime(11236): at java.lang.reflect.Method.invokeNative(Native Method) 06-27 16:54:19.908: E/AndroidRuntime(11236): at java.lang.reflect.Method.invoke(Method.java:515) 06…
linked to: http://stackoverflow.com/q/21303527
tagged with: popupwindow
downvote count: 0
tagged with: autocompletetextview

http://stackoverflow.com/q/24485207
tagged with: java
tagged with: quartz-scheduler
type: Question
has comment: http://stackoverflow.com/comment/37907895
has comment: http://stackoverflow.com/comment/37905796
upvote count: 1
has body: Two instances in a clustered JobStore are not working on the same machine inspite of having the correct quartz properties (As given in the docs). The problem seems that the load balancing is not happening and everytime it's the same instance that picks the job (The one that starts later). ============================================================================ Configure Main Scheduler Properties org.quartz.scheduler.instanceName = MyClusteredScheduler org.quartz.scheduler.instanceId = instance1 ============================================================================ Configure ThreadPool org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 25 org.quartz.threadPool.threadPriority = 5 ============================================================================ Configure JobStore org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.useProperties = false org.quartz.jobStore.dataSource = mySQLDS org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.isClustered = true org.quartz.jobStore.clusterCheckinInterval = 1000 ============================================================================ Configure Datasources org.quartz.dataSource.mySQLDS.driver = com.mysql.jdbc.Driver org.quartz.dataSource.mySQLDS.URL = jdbc:mysql://localhost:3306/quartz2 org.quartz.dataSource.mySQLDS.user = quartz2 org.quartz.dataSource.mySQLDS.password = quartz2123 org.quartz.dataSource.mySQLDS.maxConnections = 5 org.quartz.dataSource.mySQLDS.validationQuery=select 0 from dual The other instance had instance id as instance2.
favorite count: 0
has comment: http://stackoverflow.com/comment/38017012
answer count: 0
has comment: http://stackoverflow.com/comment/37917423
has comment: http://stackoverflow.com/comment/37995642
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37936222
has title: Two instances not doing automatic load balancing in Quartz scheduler on the same machine
score: 1

http://stackoverflow.com/q/24461096
tagged with: java
has comment: http://stackoverflow.com/comment/37945853
has body: I have an eclipse RCP application based on the 3.x API. My application consists of several perspectives where each contains several views and editors. The first perspective starts on the start up of the application and the navigation view is defined in the main plug-in. The problem is with the other perspectives where the views are defined in different plug-ins for a better code maintenance. I add my views within the main plug-in with a perspective extension and the following piece of code: public class Perspective implements IPerspectiveFactory { public void createInitialLayout(IPageLayout layout) { layout.addView(NavigationView.ID, IPageLayout.TOP, IPageLayout.RATIO_MAX, IPageLayout.ID_EDITOR_AREA); } } The strange thing is that it all works perfectly when I run the application within eclipse, but as soon as I make a build with Maven/Tycho and execute the created application all the perspectives defined in the plug-ins don't work anymore. The issue is when I add a new perspective this perspective opens but it doesn't contain any views, just a grey background. I already added a few println() statements for debugging purposes and it seems as the Activator of my respective plug-in, which contains the view, is never invoked. That would also explain why I cannot see any views in my perspective because the application cannot find the respective view defined in the view extension of the respective plug-in. I added the following println() statement to my createInitialLayout method from above: System.err.println(layout.getViewLayout(NavigationView.ID)); The output was null, which strengthen my previous point. The problem is now what could be the reason for that? Why doesn't my plug-in start? I also already did another experiment where I directly called one of the methods defined in the plug-in and again the Activator of the plug-in wasn't called. The Bundle-ActivationPolicy of the plug-in is set to lazy. Any suggestion what my next steps could be to track the problem down?…
has comment: http://stackoverflow.com/comment/37944003
tagged with: eclipse
has title: Execution issue with Maven/Tycho
answer count: 0
type: UnansweredQuestion
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/37944298
has comment: http://stackoverflow.com/comment/37949384
has comment: http://stackoverflow.com/comment/37944543
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37871598
tagged with: maven
tagged with: tycho

variables
tags question: http://stackoverflow.com/q/24519197
tag name: variables
tags question: http://stackoverflow.com/q/24458993
tags question: http://stackoverflow.com/q/24544363
tags question: http://stackoverflow.com/q/24582046
tags question: http://stackoverflow.com/q/24581924
type: Tag
tags question: http://stackoverflow.com/q/24481516
tags question: http://stackoverflow.com/q/24433951
tags question: http://stackoverflow.com/q/24456714
tags question: http://stackoverflow.com/q/24551989
tags question: http://stackoverflow.com/q/24464663
tags question: http://stackoverflow.com/q/24582468
tags question: http://stackoverflow.com/q/24570201
tags question: http://stackoverflow.com/q/24465979

http://stackoverflow.com/q/24486942
possible better answer: http://stackoverflow.com/a/24487023
has answer: http://stackoverflow.com/a/24487023
type: AnsweredQuestion
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/24487017
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/48226685
tagged with: jodatime
downvote count: 0
has body: I've imported an old project which uses JodaTime into IntelliJ. Everything works fine except for FromString and ToString which depend on: import org.joda.convert.FromString; import org.joda.convert.ToString; For some reason these imports and only these, cannot be resolved. What't wrong?
accepted answer: http://stackoverflow.com/a/24487017
has title: JodaTime: cannot resolve symbol "convert"
answer count: 3
favorite count: 0

http://stackoverflow.com/a/24530565
has comment: http://stackoverflow.com/comment/37984775
upvote count: 1
downvote count: 1
has body: Add a base panel to the JFrame. Then add all your panels to the base panel. I have added all your panels to the SOUTH part of base Panel. Also given colors for your understanding - public class Trial extends JFrame{ JPanel p,p1,p2,p3; JLabel l1,l2,l3,l4,l5,l6; Trial(){ p=new JPanel(); p1=new JPanel(); p2=new JPanel(); p3=new JPanel(); p.setLayout(new BorderLayout()); p1.setLayout(new BorderLayout()); p2.setLayout(new BorderLayout()); p3.setLayout(new BorderLayout()); p.setBackground(Color.orange); p1.setBackground(Color.yellow); p2.setBackground(Color.red); p3.setBackground(Color.LIGHT_GRAY); l1=new JLabel("Hello"); l2=new JLabel("Hi"); l3=new JLabel("Welcome"); l4=new JLabel("Bye"); l5=new JLabel("Visit again"); l6=new JLabel("Thanks"); p1.add(l1,BorderLayout.WEST); p1.add(l2,BorderLayout.CENTER); p2.add(l3,BorderLayout.EAST); p2.add(l4,BorderLayout.SOUTH); p3.add(l5,BorderLayout.NORTH); p3.add(l6,BorderLayout.SOUTH); p.add(p1,BorderLayout.NORTH); p.add(p2,BorderLayout.CENTER); p.add(p3,BorderLayout.SOUTH); add(p,BorderLayout.SOUTH); } public static void main(String[] args){ Trial t=new Trial(); t.setSize(500,500); t.setVisible(true); } } SO now you can see multiple components placed on one region (south) of borderlayout.
has comment: http://stackoverflow.com/comment/37984467
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24530246

configuration
tags question: http://stackoverflow.com/q/24454545
tags question: http://stackoverflow.com/q/24553348
tags question: http://stackoverflow.com/q/24511513
tags question: http://stackoverflow.com/q/24582058
tags question: http://stackoverflow.com/q/24577400
tags question: http://stackoverflow.com/q/24434579
type: Tag
tags question: http://stackoverflow.com/q/24529337
tags question: http://stackoverflow.com/q/24554373
tags question: http://stackoverflow.com/q/24551768
tags question: http://stackoverflow.com/q/24442686
tag name: configuration
tags question: http://stackoverflow.com/q/24434914

http://stackoverflow.com/q/24524529
has title: Time interval localization in Java
has comment: http://stackoverflow.com/comment/37973900
has comment: http://stackoverflow.com/comment/37978755
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24528628
has body: I need to represent a time interval as localized string like this: 10 hours 25 minutes 1 second depending on Locale. It is pretty easy to realize by hand in English: String hourStr = hours == 1 ? "hour" : "hours" etc. But I need some "out-of-the-box" Java (maybe Java8) mechanism according to rules of different languages. Does Java have it, or I need to realize it for each Locale used in app by myself?
tagged with: java
type: Question
tagged with: jodatime
score: 5
upvote count: 5
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24528628
tagged with: intervals
favorite count: 0
tagged with: time
tagged with: localization

http://stackoverflow.com/a/24452895
answers question: http://stackoverflow.com/q/24452843
has body: Actually, assertions are not for handling exceptions, they are for asserting some test cases. If an asserted case doesn't come to be true, then there is a serious problem with the input causing the problem which require special attention, that's why you get AssertionError when an assertion fails. And I think you are mixing the intentions of using exceptions and errors.
score: 0
type: Answer

http://stackoverflow.com/comment/38000874
type: AnswerComment
score: 0
type: Comment
has text: I believe you mean 31 is 0b11111 (and 0x1F)?
comment on: http://stackoverflow.com/a/24539283

http://stackoverflow.com/comment/37966305
type: Comment
comment on: http://stackoverflow.com/a/24520855
type: AnswerComment
has text: Asserts are a C-like thing that nobody actually uses except for C programmers dabbling in Java. They're intended for testing and should never be left in production code. The nice thing about JUnit is that it separates test code from production code. You probably won't learn about JUnit in school, because schools don't teach practical things like that. But you should definitely teach yourself about it.
score: 1

http://stackoverflow.com/q/24572836
has comment: http://stackoverflow.com/comment/38064740
has answer: http://stackoverflow.com/a/24584915
answer count: 1
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38063636
has comment: http://stackoverflow.com/comment/38067283
has comment: http://stackoverflow.com/comment/38065701
tagged with: java
tagged with: mysql
has body: I have one table that contains member's audit information. I have a query like: select columnsname from tablename where member id =? order by audit_date desc, audit_time desc limit 0,150 This query is taking a long time to execute. The table I'm querying contains around 2 to 3 billion records. I can't remove the order by clause as I want records in descending order of audit date and audit time. I also can't remove limit by clause because I need pagination functionality. I have already applied an index on member id, audit_date and audit_time. Can any one help me to optimize this query or suggest any other approach that I can apply in the Java tier to achieve this functionality? Below is my explain output. Left side is column name and right side is the value of it. ┌───────────────┬──────────────────────────────────┐ │ Column Name │ Column Value │ ├───────────────┼──────────────────────────────────┤ │ ID │ 1 │ │ Select Type │ simple │ │ table │ member_audit_info │ │ type │ ref │ │ possible_keys │ member_audit_info_memebrid_index │ │ key │ member_audit_info_memebrid_index │ │ ref │ const │ │ rows │ 208988 │ │ extra │ Using where,Using filesort │ └───────────────┴──────────────────────────────────┘
has comment: http://stackoverflow.com/comment/38065427
type: Question
has title: mysql query optimization with order by and limit by clause
has comment: http://stackoverflow.com/comment/38067396
has comment: http://stackoverflow.com/comment/38063704
has comment: http://stackoverflow.com/comment/38065092
tagged with: pagination
has comment: http://stackoverflow.com/comment/38067953
has comment: http://stackoverflow.com/comment/38066222
score: 0

http://stackoverflow.com/q/24479167
has comment: http://stackoverflow.com/comment/37889546
upvote count: 0
tagged with: runnable
answer count: 1
linked to: http://stackoverflow.com/q/24348745
has title: How come implements runnable always interweaves the results?
favorite count: 0
has answer: http://stackoverflow.com/a/24479910
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37889498
downvote count: 1
has comment: http://stackoverflow.com/comment/37889460
type: Question
has comment: http://stackoverflow.com/comment/37889588
accepted answer: http://stackoverflow.com/a/24479910
score: -1
has comment: http://stackoverflow.com/comment/37889464
has body: Going off my last question on threads , Why my input is showing one thread executing after another thread, not at the same time?, I received answers like "In case of Multi-threading there is no guarantee that which thread is allocated for what time to run by the processor and in that case the result is unpredictable and will generate different output for each run." However when i tested the idea that the results are unpredictable with the other way of making threads(implements Runnable), the results were always interweaved and the same. Can anyone explain this consistency compared to extending Thread? Code for implements Runnable class Runner implements Runnable{ @Override public void run() { // TODO Auto-generated method stub for(int i =0; i&lt; 10; i++){ System.out.println("Hello " + i); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } public class App { public static void main(String[] args){ Thread t1 = new Thread(new Runner()); Thread t2 = new Thread(new Runner()); t1.start(); t2.start(); } } And the output (consistent) : https://i.sstatic.net/cGJeM.jpg
has comment: http://stackoverflow.com/comment/37889530

http://stackoverflow.com/comment/38197451
comment on: http://stackoverflow.com/a/24551969
type: AnswerComment
score: 0
type: Comment
has text: Thanks for looking into it. I don't really know what I'm doing, so I don't even really know what it means when you say I'm mixing JPA and native hibernate. I'd love more info, but I understand that it's not really the type of question for StackOverflow. I've been told that hot deploying is unreliable and to not worry about it anyway, so although I would love to fix the hanging problem (or at least understand why it happens), I might just move on.

http://stackoverflow.com/q/24436085
tagged with: loading
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24436311
tagged with: java
has title: Java 2D game -- simple but efficient way to load maps?
has comment: http://stackoverflow.com/comment/37809068
type: Question
tagged with: 2d
score: 0
answer count: 2
has body: I'm having problems on deciding what way to load preset maps for a simple game I'm testing, and I'd like to get it out of the way (make it clear) before I tackle future projects. I've reviewed code from many tutorials and sources, but the code they use when loading images and implementing maps they designed either seemed too complicated or too simple(which just seems to be inefficient) examples are: 1.) (and probably the most inefficient) --> coding individual id on a 2D array int[][] map = { {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, }; 2.) Saving the map file on notepad, and is stored as ASCII characters or just the common characters. 3.) Saving the map on an image file(i.e. a png file from paint) by using colours to determine the tile. The colours in the image pixels are then translated into RGB values which is then read by the computer and then converted into a tile. I'd just like to know whether I'm over thinking it and these are good practices to code. If not, where can I find good online resources or source code(I don't have the luxury for books) Efficiency wise, load times, storage and all other things shouln't matter very much since its a very simple program (simple jumps, character movement, no mobs, no points) -- though id like to consider that textures will be part of the game in the future. edit: I'd like to add that I've finished, though not furnished simple 2d platformers using all 3 methods before at some point in time. It's just maybe theres a better way of doing things that aren't too advanced.
has answer: http://stackoverflow.com/a/24436311
possible better answer: http://stackoverflow.com/a/24442901
has answer: http://stackoverflow.com/a/24442901
has comment: http://stackoverflow.com/comment/37809001
tagged with: dictionary
has comment: http://stackoverflow.com/comment/37809069

http://stackoverflow.com/comment/38024178
has text: for maintainability one would rather keep theValue in a configuration/property file.
comment on: http://stackoverflow.com/q/24551989
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38125029
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24572082
has text: Just a few notes about your answer... As far as I know the spec does not require an implementation to use discriminator columns to implement JOINED inheritance, however, the assumption is that if @DiscriminatorColumn is specified then it would be used... On the other hand, eventhough your solution actually works, still have some doubts. Knowing that the lazyness returns proxies, why the ManyToOne returning a proxy to the parent (jpa.inheritance.issue.Parent_$$_javassist_1), and the OneToMany collection children proxies (jpa.inheritance.issue.ChildOne_$$_javassist_1) ???
score: 0

http://stackoverflow.com/q/24443493
accepted answer: http://stackoverflow.com/a/24443627
has title: Monty hall simulation not functioning as expected
has comment: http://stackoverflow.com/comment/37823346
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24443712
linked to: http://stackoverflow.com/q/23820487
has body: import java.util.Scanner; import static java.lang.System.*; import static java.lang.Math.*; import java.util.Random; public class Montyhall { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Enter number of attempts:"); int attempts = keyboard.nextInt();/*Decide how many times you want this to run. The larger the number, the more realistic an answer you will get.*/ int curtains[] = new int[3]; //like the game show, one of these will be a winner Random rand = new Random(); /*sets the methods up with the same random seed, which otherwise changes by the milisecond and could influence the response*/ withoutswitch(curtains, attempts, rand); withswitch(curtains, attempts, rand); } public static void withoutswitch(int curtains[], int attempts, Random rand) { int nsCorrect=0; for(int x=0; x &lt; attempts; x++) { int winner = rand.nextInt(3);//Sets the winner to 1, leaving the other two at 0. curtains[winner] = 1; //It then checks to see if they are the same, int guess = rand.nextInt(3); //a 1/3 chance, roughly. if(curtains[guess]==1){ nsCorrect++; } curtains[0]=0; curtains[1]=0; curtains[2]=0; //the player never changes their decision, so it does not matter if a door is opened. } System.out.println("Number of successes with no switch: " + nsCorrect); } public static void withswitch(int curtains[], int attempts, Random rand) { int ysCorrect=0; int goat = 0; for(int x=0; x &lt; attempts; x++) { int winner = rand.nextInt(3); curtains[winner] = 1; int guess = rand.nextInt(3); goat = rand.nextInt(3);//one of the doors is opened while(goat == winner || goat == guess)//the opened door is randomized until goat = rand.nextInt(3); //it isn't the guess or the winner. int guess2 = rand.nextInt(3); while(guess2 == guess || guess2 == goat) guess2 = rand.nextInt(3);//the second guess goes through a similar process if(curtains[guess2]==1){ ysCorrect++; } curtains[0]=0; curtains[1]=0; curtains[2]=0; } System.out.println("Number of success…
has answer: http://stackoverflow.com/a/24443627
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
possible better answer: http://stackoverflow.com/a/24443738
type: Question
has answer: http://stackoverflow.com/a/24443738

http://stackoverflow.com/comment/38501209
comment on: http://stackoverflow.com/q/24587059
has text: `07-17 09:17:29.562: D/Some tag(4032): backgroundImg value is android.graphics.Bitmap@b470cf00`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37946999
score: 1
comment on: http://stackoverflow.com/q/24510188
has text: @DavidWallace It can, if you make all the other duplicates point to this one. (I am not actually endorsing _this_ question to be a canonical question, just endorsing the canonical question concept.)
type: QuestionComment
type: Comment

lwjgl
tags question: http://stackoverflow.com/q/24543715
tag name: lwjgl
tags question: http://stackoverflow.com/q/24585962
tags question: http://stackoverflow.com/q/24445840
tags question: http://stackoverflow.com/q/24571888
tags question: http://stackoverflow.com/q/24499391
tags question: http://stackoverflow.com/q/24489637
tags question: http://stackoverflow.com/q/24439040
type: Tag
tags question: http://stackoverflow.com/q/24493315
tags question: http://stackoverflow.com/q/24435853

http://stackoverflow.com/q/24556733
type: Question
linked to: http://stackoverflow.com/q/21633545
tagged with: rotation
has comment: http://stackoverflow.com/comment/38039657
has comment: http://stackoverflow.com/comment/38068715
has body: I'm trying to transfer my bitmap from using rectF translation to using matrix rotation and translation. I feel like I've tried every combination of pre,set,post for rotate and translate. This is a sample of my code Matrix m; @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawBitmap(bitmap, m, null); } onTouchEvent(MotionEvent event) { m.setRotate(rotation, bitmap.getWidth()/2, bitmap.getHeight()/2); //rotation points to your finger if (fingerx1 &gt; bitmapX) { xspeed = xspeed + accel; } if (fingerx1 &lt; bitmapX) { xspeed = xspeed - accel; } if (fingery1 &lt; bitmapY) { yspeed = yspeed - accel; } if (fingery1 &gt; bitmapY) { yspeed = yspeed + accel; } } private Runnable runny = new Runnable() { public void run() { m.postTranslate(xspeed, yspeed); handler.postDelay(this, 50); } }; Not the final code since I don't know which pre,set,post to use in these situations. I feel like this would be the solution though (setRotate, postTranslate). With this combination, the bitmap looks like it tries to but can't translate. When I've tried setTranslate(bitmapX + xspeed, bitmapY + yspeed) and postRotate it gives me the right translation but crazy rotation. Using both setRotate, setTranslate gives me crazy glitches. Adding pretranslate and prerotate to the mix just gave me a headache. TL;DR: Ugh. EDIT: bitmapX = playerValues[Matrix.MTRANS_X]; bitmapY = playerValues[Matrix.MTRANS_Y]; After trying postRotate and postTranslate together, I see my bitmap rotate around it's center at first and then it moves out of the 0,0 position and continue to rotate around the 0,0 center.x,center.y position. Basically I need to fix my rotate's center x,y to make them dynamically change with my bitmap's location. Thanks pskink, I was having a very bad case of matricides.
has comment: http://stackoverflow.com/comment/38037336
score: 0
has comment: http://stackoverflow.com/comment/38033463
has title: Android Java - Bitmap Matrix Rotate and Translate together
tagged with: matrix
has comment: http://stackoverflow.com/comment/38038868
type: UnansweredQuestion
tagged with: android
tagged with: bitmap
has comment: http://stackoverflow.com/comment/38033985
has comment: http://stackoverflow.com/comment/38033406
answer count: 0
tagged with: java

http://stackoverflow.com/comment/38063097
comment on: http://stackoverflow.com/a/24572738
type: Comment
score: 0
type: AnswerComment
has text: Then please show a piece of the html source with those links.

http://stackoverflow.com/comment/37914023
score: 1
has text: @JonnyLeeds : sorry, I forgot one line ... Post edited. You should also write it in one single line `((HttpServletResponse) sr1).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24488308

http://stackoverflow.com/q/24496342
tagged with: overriding
has comment: http://stackoverflow.com/comment/37921709
upvote count: 2
tagged with: onkeydown
answer count: 1
tagged with: button
favorite count: 0
tagged with: android
has body: public boolean onKeyDown(int keyCode, KeyEvent event){ if (isSub2&amp;&amp;keyCode == KeyEvent.KEYCODE_BACK) { Intent intent = new Intent(ctxx, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intent); isReturning = true; return false; } else { return super.onKeyDown(keyCode, event); } } } There are two Activities Main--Sub2. When you push a button in Main you can go to Sub2. This code is in Sub2. I want to use back button on the bottom to make the MainActivity put on the top of stack not killing Sub2. When I run it on the phone it works all right at first, but after few more times of going back in Sub2 and going to Sub2 again the back button stops working. I don't know what is making the back button freeze.. any ideas? ps) i've tried using handlers inside the method and overriding onBackButtonPressed() instead of using onKeyDown.. but no difference at all..
has answer: http://stackoverflow.com/a/24512796
accepted answer: http://stackoverflow.com/a/24512796
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Android back button freezes when using onkeydown method or overriding onbackbuttonpressed
type: Question

http://stackoverflow.com/a/26111549
accepted answer of: http://stackoverflow.com/q/24562975
answers question: http://stackoverflow.com/q/24562975
downvote count: 0
has comment: http://stackoverflow.com/comment/65882041
type: AcceptedAnswer
score: 8
has body: I thought it could not be done too. But I saw Jinq http://www.jinq.org/ They do it for raw SQL queries. database.customerStream().where( customer -&gt; customer.getName().equals("Alice")); So I think it just depends on someone implement the same kind of logic being used in Jinq for JPA entities, and generate JPQL queries. UPDATE: They do it for JPA too. http://www.jinq.org/docs/gettingstartedjpa.html
has comment: http://stackoverflow.com/comment/65880400
upvote count: 8
type: Answer

http://stackoverflow.com/q/24555845
score: -2
favorite count: 0
accepted answer: http://stackoverflow.com/a/24556096
has body: I'm coding my first Spring application from scratch. I Know the way to inject the dependencies with the ApplicationContext -> getBean and with the annotation @autowired (and others) but I'm working on existing Spring project where I do not need getBean neither annotations. How does it work? Has anyone a clue? Thanks in advance!
possible better answer: http://stackoverflow.com/a/24556005
has answer: http://stackoverflow.com/a/24556005
has comment: http://stackoverflow.com/comment/38034757
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24556096
tagged with: java
downvote count: 3
type: Question
answer count: 2
has title: Spring injection without getBean and without annotation
tagged with: dependency-injection

http://stackoverflow.com/a/24464170
has body: I'm still not exactly sure what your professor asks you to do. But I find the way you derive the monthly interest rate from the annual rate unconvincing. While it is true that the annual rate tells you what amount of interest you've acquired after 12 months, that doesn't mean that you can just divide the rate by 12 to get the monthly rate because of compound interest. Rather, you're looking for a monthly rate that after 12 month will give you the same amount of money as the annual rate. Thus, if you start with an amount of money X, the relation between annual interest rate a and monthly rate m should be like this: If we want to solve this for m we first note that the amount of money X that we start with doesn't actually matter because it appears on both sides. So we get: Or in Java: double a = annualInterestRate / 100.0; double m = Math.pow(1 + a, 1/12.0) - 1; Now you can compute how much interest has been accumulated after n months with the basic formula for the future value of the present amount: double futureAccountAmount = savingAccounAmount * Math.pow(1 + m, n); Look, ma! No for-loop!
type: Answer
has comment: http://stackoverflow.com/comment/51879679
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/51881572
score: 1
answers question: http://stackoverflow.com/q/24463687

http://stackoverflow.com/comment/37896951
type: QuestionComment
comment on: http://stackoverflow.com/q/24482624
score: 0
has text: 06-29 21:38:31.194: E/AndroidRuntime(31152): Caused by: java.lang.NullPointerException 06-29 21:38:31.194: E/AndroidRuntime(31152): at android.app.Activity.findViewById(Activity.java) 06-29 21:38:31.194: E/AndroidRuntime(31152): at pha.viz.gesturetest.MainActivity.<init>(MainActivity.java:28) 06-29 21:38:31.194: E/AndroidRuntime(31152): at java.lang.Class.newInstanceImpl(Native Method) 06-29 21:38:31.194: E/AndroidRuntime(31152): at java.lang.Class.newInstance(Class.java:1319) 06-29 21:38:31.194: E/AndroidRuntime(31152): at android.app.Instrumentation.newActivity(Instrumentation.java)
type: Comment

http://stackoverflow.com/comment/37898063
score: 0
comment on: http://stackoverflow.com/q/24483172
type: Comment
type: QuestionComment
has text: I'm sorry, is this a stupid question? Not sure why I got downvoted... I'll look at the docs.

http://stackoverflow.com/a/24542277
answers question: http://stackoverflow.com/q/24520499
downvote count: 0
has body: This solved my issue SecurityUtils.setSecurityManager(EasyMock.createNiceMock(org.apache.shiro.mgt.SecurityManager.class)); mockSubject = Mockito.mock(Subject.class); threadState = new SubjectThreadState(mockSubject); threadState.bind();
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24454315
tagged with: android
tagged with: android-edittext
downvote count: 0
score: 1
tagged with: java
has body: I use PreferenceActivity in the Tabs and add a footer with the editText's : <?xml version="1.0" encoding="utf-8"?> <com.customitems.CustomEditText android:id="@+id/taskText" style="@style/custom_edittext" android:gravity="top|left" android:maxLength="8192" android:layout_marginLeft= "25dp" android:layout_height="110dp" android:imeOptions="actionDone" android:layout_weight="1" android:layout_width="fill_parent" android:scrollbars = "vertical" android:layout_marginRight="10dp" foo:customFont="Roboto-Regular.ttf" android:hint="@string/hint_assignment_task"/> <com.customitems.CustomEditText android:id="@+id/taskSpecReq" style="@style/custom_edittext" android:gravity="top|left" android:maxLength="8192" android:layout_marginLeft= "25dp" android:layout_height="110dp" android:imeOptions="actionDone" android:layout_weight="1" android:layout_width="fill_parent" android:scrollbars = "vertical" android:layout_marginRight="10dp" foo:customFont="Roboto-Regular.ttf" android:hint="@string/hint_assignment_specific_requirements"/> So , when I use LongClick on the taskTest EditText, the Copy/paste/cut is appears and works properly. But when I Long click on the taskSpecReq my taskSpecReq Copy/paste/cut panel and Tabs disappers from the screen. The taskSpecReq is in the bottom of the screen. Long Click on the 1st EditText : Long Click on 2nd EditText:
possible better answer: http://stackoverflow.com/a/24456352
type: Question
has title: android 4.0 and higher : Copy/paste/cut panel disappears onLongClick Listener on the EditText
type: AnsweredQuestion
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24755348
accepted answer: http://stackoverflow.com/a/24755348
favorite count: 0
has answer: http://stackoverflow.com/a/24456352

http://stackoverflow.com/comment/37918624
comment on: http://stackoverflow.com/q/24494636
has text: Exactly what is `in`? Could it potentially be reading a whole line of text into your String `se`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24575298
downvote count: 0
has body: I've never found another way of doing so other than calling it's close() method (after I've closed all client Sockets), You can set a flag closed = true; and open a dummy connection to wake up the accept()ing thread which checks the flag before continuing. which causes accept() to throw a SocketException, A SocketClosedException which is expected behaviour here. I catch that and break from the while (true) loop in the accept thread, If you catch it outside the loop, you don't need to also break out of the loop. If the exception is thrown and you have set closed = true you can discard the exception. BTW I would do while(!serverSocket.isClosed()) { causing all my threads to exit. There is no particular reason you need to have this, but you can choose to do this if you want. I think this is ugly, strictly speaking there is no exception occurring, An exceptional condition is happening. What is not happening is an Error. closing my ServerSocket is part of my programs normal operation. Or you could say it is operating normally when it is running and not shutting down.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24574059
score: 1

http://stackoverflow.com/q/24530138
has body: My previous purpose is to find all pictures in local system out. public void searchTargetFile() { String[] filterFileExtnew= new String[] {"jpg","jpeg","png","tif"}; File dirRoot= new File( android.os.Environment.getExternalStorageDirectory().getAbsolutePath() ); File[] dirOrFile= dirRoot.listFiles(); if( dirOrFile == null) return; assert(dirOrFile != null); for( File f : dirOrFile ) { if( f.isDirectory() ) { searchTargetFile( f.getAbsolutePath() ); } else { //Filter out files with certain file extension. for(String extName: filterFileExt) { if( f.getName().endsWith(extName) ) { newDisplayFile= new DisplayFile(new String( f.getAbsolutePath() ), f.length()); filesArray.add(newDisplayFile); } }//for }//else }//for }//method //DisplayFile is a subclass of File and filesArray is a ArrayList. By using recursive method, I can filter out all the images with certain file extension in the exteranl storage. However, I found I don't need some images like another app's icon or some images only belong to these app. I just want to collect all the pictures generated by different apps: Google Default Camera, CandyCamera, Line Camera and so on. I mean users may use various app to take pictures and the pictures may be stored somewhere but I don't know.(?) How should I set the dirRoot path? Or maybe I should use another approach instead of using recursive searching? Can I or should I know those app's path?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/18590514
score: 0
tagged with: android
tagged with: android-activity
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37983605
has title: Android: How to access the images in certain folders in local device?
has comment: http://stackoverflow.com/comment/37985396

http://stackoverflow.com/q/24470895
tagged with: java
possible better answer: http://stackoverflow.com/a/24470957
has body: Why can't have enum extending some class in Java? Examples below shows, that: we can have normal enum E1. we can have "complex" enum E2. but we can't obtain the same complex enum, by combining some class and extending it with enum. For example: public class Try_ExtendEnum { public static enum E1 { North, East, South, West } public static enum E2 { North(0), Eash(90), South(180), West(270); private double degrees; E2(double degrees) { this.degrees = degrees; } public double getDegrees() { return degrees; } } public static class DegreesMeasure { private double degrees; public DegreesMeasure(double degrees) { this.degrees = degrees; } public double getDegrees() { return degrees; } } public static enum E3 extends DegreesMeasure { North(0), Eash(90), South(180), West(270); E3(double degrees) { super(degrees); } } public static void main(String[] args) { DegreesMeasure dm = new DegreesMeasure(123); E3 e = dm; // should not be possible, since E3 is a subclass and not obliged to hold superclass DegreesMeasure dm2 = E3.Nort; // just holding "tagged" version of instance; see no any problem } }
has answer: http://stackoverflow.com/a/24470937
score: 4
answer count: 2
favorite count: 0
tagged with: extends
tagged with: subclass
has answer: http://stackoverflow.com/a/24470957
upvote count: 4
type: AnsweredQuestion
has title: Why can't an enum extend a class in Java?
downvote count: 0
accepted answer: http://stackoverflow.com/a/24470937
type: Question
tagged with: enums

http://stackoverflow.com/a/24435995
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37810414
accepted answer of: http://stackoverflow.com/q/24435711
type: Answer
answers question: http://stackoverflow.com/q/24435711
score: 2
has comment: http://stackoverflow.com/comment/37809954
upvote count: 3
has comment: http://stackoverflow.com/comment/37813271
downvote count: 1
has body: class replace { public static void main(String args[]) { String arr[]=new String[3]; arr[0]="Google"; arr[1]="Apple"; arr[2]="Amazon"; for(int i=0;i&lt;arr.length;i++) { int j; for(j=1;j&lt;arr[i].length();j++) { if(arr[i].charAt(j) == arr[i].charAt(j-1)) { break; } } if(j==arr[i].length()) System.out.println(arr[i]); } } } Logic : Match the characters in a String with the previous character. If you find string[i]==string[i-1]. Break the loop. Choose the next string. If you have reached till the end of the string with no match having continuous repeated character, then print the string.
has comment: http://stackoverflow.com/comment/37808956

http://stackoverflow.com/q/24464888
tagged with: php
type: Question
has comment: http://stackoverflow.com/comment/37910574
has comment: http://stackoverflow.com/comment/37879671
tagged with: java
linked to: http://stackoverflow.com/q/8010101
has comment: http://stackoverflow.com/comment/37908097
score: 0
has answer: http://stackoverflow.com/a/24465005
has body: I want to develop a script which will extract certain information from client side when he enter url for our site. For exmaple-:If he enter the url www.example.com,the code intiates and extract certain information from the client side.It will be different for each user like facebook email etc. So I was looking at the option and thinking it is nearly impossible to do so unless I have some kind of javascript code which will execute on client side whenever he visit the site.I am also looking at libraries such as Jsoup,selenium etc but I guess they are only executes locally and it didn't solve my purpose. The text I want to extract is in iframe and further in tables.So is it possible to write a code (javascript or something else )which I include in our index.php page and it executes on client site,extract the information and store the results in database? The scenario is if user is already logged in into facebook on the same browser then when he visit my site,it will automatically displays his email id related to facebook.So I want to extract that email id.Any suggestions? EDIT-->> I am trying the following code to move to frame and then get the content but it is returning empty content document. var iframe = document.evaluate('//iframe[contains(@src, \"//my.leadpages.net/forms/5620062778032128/5654100301578240/5645914630782976/html/?lp-in-iframe=1\")]',document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).contentDocument;alert(iframe); Also if you can guide me through for how can I move to frame and then get it's contents via nodes.Iframe has no id,name etc so I have used xpath way.It is detecting the frame as resulting XpathResult but I am not sure how to move into it and then extract text for various nodes.This has to be in Javascript.
has comment: http://stackoverflow.com/comment/37878294
has answer: http://stackoverflow.com/a/24474048
tagged with: javascript
has title: How to extract text using javascript on client side
answer count: 3
tagged with: xpath
linked to: http://stackoverflow.com/q/3611682
has answer: http://stackoverflow.com/a/24465048
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37862510
tagged with: web-scraping

http://stackoverflow.com/q/24584959
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24585362
has title: Service and DAO classes are doing same thing. Why would you need them both?
tagged with: java
tagged with: hibernate
downvote count: 1
has answer: http://stackoverflow.com/a/24585009
type: Question
score: 3
has body: Hi Guys I am new to Spring.Just had a doubt .The service and DAO classes do the same thing? Why would you need them both? Apart from that we can connect our controller directly to our Dao methods and we can fetch data from them. Whats the need for SERVICE Layer exactly. I went through few portals some of whom told service layer provides modularity and few of them mentioned that its for security purpose also. I am still confused Can anyone provide a clear cut answer for this query?
upvote count: 4
answer count: 3
accepted answer: http://stackoverflow.com/a/24585009
has answer: http://stackoverflow.com/a/24585187
has comment: http://stackoverflow.com/comment/38085618
favorite count: 0
possible better answer: http://stackoverflow.com/a/24585187
tagged with: spring

http://stackoverflow.com/comment/38086459
has text: What about `File "/WEB-INF/jsp/includes.jsp" not found`. Does this file exist in you project?
comment on: http://stackoverflow.com/q/24585429
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37946510
type: AnswerComment
score: 0
type: Comment
has text: @ChrisJester-Young: I there was one related to GC that I crossed once, that wasn't strictly related to the heap amount but solely on the number of small objects in there.
comment on: http://stackoverflow.com/a/24510317

http://stackoverflow.com/comment/37888404
type: AnswerComment
comment on: http://stackoverflow.com/a/24476318
type: Comment
score: 2
has text: No problem. The fact that you took the extra step to thank me with a comment, is more than enough. I'm glad I could help. P.S. Check my update.

http://stackoverflow.com/comment/37897937
has text: It is kind of clear that you have to implement the sorting method as Edward M.B said, yet how you wanna sort it out? from a to z or z to a?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24483495

http://stackoverflow.com/comment/38045681
score: 0
type: Comment
has text: Yes. When you move the declaration outside main then is no longer in scope of method but in scope of class. And then you can declare it public.
comment on: http://stackoverflow.com/a/24563034
type: AnswerComment

http://stackoverflow.com/q/24526276
has answer: http://stackoverflow.com/a/24528685
tagged with: java
has body: If an object doesn't implement it's own hashCode() method, then it will use the default implementation Object.hashCode() (provided there's no superclass in between). Object.hashCode() doesn't guarantee the same hash code to be generated in different JVM instance. We are having some problems because of this in a clustered environment. Additionally to some fixes that we applied, we would like to have static analysis detect this case. We are already using FindBugs, but unfortunatly I have no experience extending the default ruleset. I've done some research and I know that you can implement your own custom detectors, but I have not found much documentation on how to do this. I guess my questions are: Before I invest too much work here, is this approach reasonable, can FindBugs do this? What's the best resources to get me started writing custom detectors? Thanks for your input!
has title: FindBugs: Detect invocation of Object.hashCode()
type: Question
score: 4
upvote count: 4
downvote count: 0
tagged with: findbugs
tagged with: static-analysis
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24527273
answer count: 4
has answer: http://stackoverflow.com/a/24551751
has answer: http://stackoverflow.com/a/24527672

http://stackoverflow.com/comment/37909507
type: Comment
has text: @EdwardM.B. hm. how is it possible that another thread can access that list?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24485348

http://stackoverflow.com/comment/37980466
has text: If I remember correctly the Validator getMessage used a prefix. Easiest way to find out which messages the validator tries to get is a breakpoint.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24528193
type: QuestionComment

http://stackoverflow.com/comment/38041243
score: 0
type: Comment
type: QuestionComment
has text: It would be a forms error. The java code works good in Netbeans IDE. Here is the error `Error 103: symbol "ITERATOR" met in place of one of the following symbols : * & = - + ; <> or in is mod reminder...`. How can I use `BufferReader` in this case?
comment on: http://stackoverflow.com/q/24557196

http://stackoverflow.com/comment/72264658
has text: Great.. I am glad that this solution worked for you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26108826
type: Comment

http://stackoverflow.com/comment/37940736
has text: where do I have to put in selected item? in adapter? Anyway, I was testing yesterday and it wasnt working, I thought it is automatic.
comment on: http://stackoverflow.com/q/24506753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77195090
score: 0
answers question: http://stackoverflow.com/q/24519668
type: Answer
has body: Finally I found another solution that works pretty fine on Linux. It uses a trick: if the user restores the window from the maximized state manually by double clicking on the title, and then maximizes it again by double clicking on the title, this bug is not reproduced anymore. To emulate double clicking I use the Robot: stage.setMaximized(true); if (PlatformUtil.isLinux()) { // a workaround of a bug of modal dialogs shown on top of the stage stage.setAlwaysOnTop(true); stage.addEventHandler(WindowEvent.WINDOW_SHOWN, new EventHandler&lt;&gt;() { @Override public void handle(WindowEvent windowEvent) { stage.removeEventHandler(WindowEvent.WINDOW_SHOWN, this); new Thread(() -&gt; { doubleClick(); LockSupport.parkNanos(10_000_000L); doubleClick(); Platform.runLater(() -&gt; stage.setAlwaysOnTop(false)); }).start(); } private void doubleClick() { robotAction(stage, r -&gt; r.mouseClick(MouseButton.PRIMARY)); LockSupport.parkNanos(1_000_000L); robotAction(stage, r -&gt; r.mouseClick(MouseButton.PRIMARY)); } private void robotAction(Stage stage, Consumer&lt;Robot&gt; action) { var latch = new CountDownLatch(1); Platform.runLater(() -&gt; { try { var robot = new Robot(); var centerX = stage.getX() + stage.getWidth() / 2d; robot.mouseMove(centerX, stage.getY() + 3d); action.accept(robot); } finally { latch.countDown(); } }); try { latch.await(); } catch (InterruptedException e) { throw new IllegalStateException(e); } } }); } stage.show();

http://stackoverflow.com/comment/37892322
score: 0
type: Comment
type: QuestionComment
has text: Is every input delimited by a space?
comment on: http://stackoverflow.com/q/24480594

http://stackoverflow.com/comment/38079553
comment on: http://stackoverflow.com/q/24581449
score: 0
has text: Could also try `import Solution.Node;` though I can't test for sure.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38016153
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24547510
has text: it's a bit more subpackages then 2 (I minimalize the problem for asking) but it's an idea

http://stackoverflow.com/a/24550487
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38022019
has comment: http://stackoverflow.com/comment/38022315
has body: Your setOnclick should look like this your_button1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub // your logic } }); your_button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub //your logic } }); Make sure you have this import statement import android.view.View.OnClickListener; Try changing but1.setOnClickListener(new View.OnClickListener() and but2.setOnClickListener(new View.OnClickListener() to but1.setOnClickListener(new OnClickListener() and but2.setOnClickListener(new OnClickListener()
answers question: http://stackoverflow.com/q/24550234
has comment: http://stackoverflow.com/comment/38022342

http://stackoverflow.com/a/24560819
score: 2
downvote count: 0
has body: Try with: def "test someMethod"() { given: def logger = Mock(Logger) and: bolt.logger = logger when: bolt.someMethod() then: 1 * logger.error("this is an error") } You need to mock first the Logger.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24560252
type: Answer
answers question: http://stackoverflow.com/q/24560252

http://stackoverflow.com/q/24433625
has body: A newbie to Android and trying to save and view some info into/from a sql lite database. My tables are as follows: Student Course Registration ------- ------ ------------ id (PK) id(PK) sid, cid (PK) name name term email credit As far as I understand, the Model part of MVC will store all the business logic, thus my 'Student', 'Course' and 'Registration' classes will have all the get/set methods. I have a DBHelper class that extends SQLiteOpenHelper and as I saw in many tutorial, this class contains all the CRUD operations in general. But my question is, as I have multiple tables to work with, where should I place the CRUD operations like addStudent(), addCourse(), addRegistration(). I suppose it would not be feasible to have a very large DBHelper class containing all the CRUD methods in the universe. In some examples, I have seen view operations(viewStudent() for example) in MainActivity as well. Is it a good way to do it? An example (with Classes and and their methods) will be highly appreciated.
type: UnansweredQuestion
tagged with: android
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/24433798
tagged with: java
type: Question
has title: Android Database, CRUD operations for multiple tables in MVC
score: 0
tagged with: sqlite
answer count: 1

http://stackoverflow.com/comment/37937669
type: QuestionComment
has text: A) don't use hibernate for even slightly large rowsets, b) use raw SQL and a cursor to scroll through the results, so there's only one row in memory at a time
comment on: http://stackoverflow.com/q/24505131
score: 0
type: Comment

http://stackoverflow.com/q/24519208
type: Question
has title: File access denied?
upvote count: 5
has body: So I have this JFileChooser: JOptionPane.showMessageDialog(null, "Navigate into the folder you would like to use for this application's files."); final JFileChooser fcs = new JFileChooser(); int responses = fcs.showOpenDialog(fcs); if (responses == JFileChooser.APPROVE_OPTION){ dir = fcs.getCurrentDirectory().toString(); }else{ System.exit(1); } and when I try to write to dir it says java.io.FileNotFoundException: *Insert path here* (Access is denied) And it does that no matter what directory I use, even if it's something like documents or desktop. All I'm trying to do is make a file called maze.txt, and even if I don't use a file chooser and give it a directory in the code it gives me the same error. What's happening? It worked and stopped working all of the sudden after I used mkdir(); In another program...
favorite count: 0
has comment: http://stackoverflow.com/comment/37963545
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37963288
answer count: 0
tagged with: java
downvote count: 2

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/24495893
tag name: android-scrollview

http://stackoverflow.com/q/24514841
tagged with: jsp
has comment: http://stackoverflow.com/comment/37955690
tagged with: el
has answer: http://stackoverflow.com/a/24527806
has title: Iterating through ArrayList with JSP EL
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24527806
has comment: http://stackoverflow.com/comment/37954860
has comment: http://stackoverflow.com/comment/37956065
has comment: http://stackoverflow.com/comment/37956115
type: Question
has comment: http://stackoverflow.com/comment/37955861
has comment: http://stackoverflow.com/comment/37955980
tagged with: java
has comment: http://stackoverflow.com/comment/37954718
tagged with: arraylist
score: 0
has body: I have this piece of JSP with EL: Klant Nieuwe Klant <c:forEach items="${werkplaats.alleKlanten}" var="current"> <c:out value="${current.voornaam}" /> </c:forEach> werkplaats is a ServletContext attribute that contains an instance of the class Werkplaats. Werkplaats contains an ArrayList<Klant> alleKlanten which holds several Klant objects. Klant has the attribute voornaam and the method getVoornaam() but when I view the JSP it hte dropdown isn't filled, it just had the Nieuwe Klant and an empty what I expected and want is a dropdown with 'Klant voornaam' for each Klant. Werkplaats: public class Werkplaats implements Serializable { private ArrayList<Klant> alleKlanten = new ArrayList<Klant>(); public Klant zoekKlant(String voornaam, String tussenvoegsel, String achternaam) { Klant klant = null; for (Klant k : alleKlanten) { if (k.getAchternaam().equals(achternaam) && k.getVoornaam().equals(voornaam) && k.getTussenvoegsel().equals(tussenvoegsel)) { klant = k; } } return klant; } public boolean verwijderKlant(String voornaam, String ussenvoegsel, String achternaam) { boolean verwijdert = false; if (zoekKlant(voornaam, ussenvoegsel, achternaam) != null) { alleKlanten.remove(zoekKlant(voornaam, ussenvoegsel, achternaam)); verwijdert = true; } return verwijdert; } public boolean voegKlantToe(Klant klant) { boolean toegevoegd = false; if (zoekKlant(klant.getVoornaam(), klant.getTussenvoegsel(), klant.getAchternaam()) == null) { alleKlanten.add(klant); toegevoegd = true; } return toegevoegd; } public ArrayList<Klant> getAlleKlanten() { return alleKlanten; } } Klant: public class Klant implements Serializable, Persoon { private String voornaam, tussenvoegsel, achternaam; public Klant(String voornaam, String tussenvoegsel, String achternaam) { setVoornaam(voornaam); setTussenvoegsel(tussenvoegsel); setAchternaam(achternaam); } public String getVoornaam() { return voornaam; } public void setVoornaam(String naam) { this.voornaam = naam; } public String getTussenvoegsel() { ret…
answer count: 1
has comment: http://stackoverflow.com/comment/37955179

http://stackoverflow.com/a/24433289
has comment: http://stackoverflow.com/comment/37830016
has comment: http://stackoverflow.com/comment/37828348
has comment: http://stackoverflow.com/comment/37832547
has comment: http://stackoverflow.com/comment/37829759
has comment: http://stackoverflow.com/comment/37834612
has comment: http://stackoverflow.com/comment/37804999
has comment: http://stackoverflow.com/comment/37830291
answers question: http://stackoverflow.com/q/24433184
has comment: http://stackoverflow.com/comment/37805622
type: Answer
score: 0
has body: This should do the trick (of course hash codes are never guaranteed to be different) @Override public int hashCode() { return (left.hashCode()+"/"+right.hashCode()).hashCode(); } If left or right can be null, you need a bit more code to handle that.
has comment: http://stackoverflow.com/comment/37804728
has comment: http://stackoverflow.com/comment/37807242
has comment: http://stackoverflow.com/comment/37820178

http://stackoverflow.com/q/24444209
downvote count: 0
tagged with: libreoffice
favorite count: 0
tagged with: openoffice.org
tagged with: uno
has title: How to find Open Office installation path programmatically in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37824304
has comment: http://stackoverflow.com/comment/37824482
has body: I am exporting UML diagrams in Open Office Draw using Java UNO Runtime Reference Api in Open Office. Initially I tried to connect Open Office using Bootstrap.bootstrap() method but it resulted in "No office executable found exception". Then according to the post No office executable found exception while connecting to OpenOffice through Java , I downloaded bootstrapconnector.jar and it worked fine for me. But in this case the user has to provide the path of the of the Open Office installation and my requirement is to connect to the Open Office instance by programmatically finding the installation path. One method I know is by means of working with WinRegistry but in this case I think that the registry key may change with underlying OS. Therefore it would be a great help if someone can suggest me some other method of achieving this.
answer count: 0
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/14157644
type: Question
has comment: http://stackoverflow.com/comment/37824393
tagged with: api

http://stackoverflow.com/a/24477426
downvote count: 0
has comment: http://stackoverflow.com/comment/37889316
type: Answer
has comment: http://stackoverflow.com/comment/71475744
accepted answer of: http://stackoverflow.com/q/24477316
answers question: http://stackoverflow.com/q/24477316
has body: That's the default behavior. ScheduledThreadExecutor (that you're using although you're not scheduling anything) extends from ThreadPoolExecutor. Tasks submitted to a ThreadPoolExecutor are stored in a BlockingQueue until one thread is available to take them and execute them. And queues are FIFO. This is decscribed in details in the javadoc.
upvote count: 5
score: 5
type: AcceptedAnswer

http://stackoverflow.com/a/24747510
has body: The ApiDocs for the SingleThreadExecutor state the following: "Note however that if this single thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks." This appears to apply also to ThreadPools with several threads (see demo program below). So unless the program runs inro a real OutOfMemoryError (e.g. not an accidental one where a much too large byte-array is allocated), the silent thread kills will not happen. If the program runs into a real OutOfMemoryError then I do not think much can be done: all kinds of statements that must be executed (in final blocks) can suddenly fail to execute due to being out of memory and that can leave the program in an inconsistent state (like a ThreadPool without threads). The demo program below shows all tasks are executed and the thead-names show new threads are created by the ThreadPool: import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; public class SilentKillThread { public static void main(String[] args) { try { new SilentKillThread().runTest(); } catch (Exception e) { e.printStackTrace(); } } static int MAX_TASKS = 3; static long SLEEP_TIME_MS = 400; AtomicInteger tasksDoneCount = new AtomicInteger(); public void runTest() throws Exception { ThreadPoolExecutor tp = new ThreadPoolExecutor(MAX_TASKS, MAX_TASKS, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue&lt;Runnable&gt;()); for (int i = 0; i &lt; MAX_TASKS; i++) { tp.execute(new FailingTask()); } for (int i = 0; i &lt; MAX_TASKS; i++) { tp.execute(new SleepingTask()); } tp.shutdown(); if (tp.awaitTermination(SLEEP_TIME_MS * 4, TimeUnit.MILLISECONDS)) { System.out.println("Finished"); } else { System.out.println("Finished but threadpool still active."); } System.out.println("Tasks done: " + tasksDoneCount.get()); } class FailingTask implements Runnable { @Overri…
answers question: http://stackoverflow.com/q/24583064
score: 0
type: Answer

http://stackoverflow.com/a/24548998
type: Answer
has comment: http://stackoverflow.com/comment/38018980
answers question: http://stackoverflow.com/q/24548854
score: 0
has body: You should try Hex Color Codes, try #ff0055 instead of red_holo.

http://stackoverflow.com/comment/48754907
type: Comment
comment on: http://stackoverflow.com/a/24496258
has text: down vote: Why does the first code snippet print the only one of the two lines? I don't understand why. I imagine the following scenario: 1) thread 1 writes `x` to 1. 2) thread 2 writes `y` to 1. 3) thread 1 executes the if statement(false). 4) thread 2 execute the if statement(false). So, get no result. What's wrong with my comment?
score: 1
type: AnswerComment

http://stackoverflow.com/a/24430174
downvote count: 0
has comment: http://stackoverflow.com/comment/37799159
has comment: http://stackoverflow.com/comment/37798303
has comment: http://stackoverflow.com/comment/37803917
has body: Probably the diagnostics is about the fact, that XML document must have only one root element. So the provided sample is not a valid XML document.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24429788
has comment: http://stackoverflow.com/comment/37798002
has comment: http://stackoverflow.com/comment/37798867

http://stackoverflow.com/comment/37919949
comment on: http://stackoverflow.com/q/24495264
type: QuestionComment
score: 1
has text: @Sibish so long as they are Javadoc comments (double star instead of single star multi-line comments), they will appear on class, method and field in most IDEs
type: Comment

http://stackoverflow.com/comment/38069464
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24575780
has text: customer_name is an alternative unique key which contains the relevant name
score: 0

http://stackoverflow.com/q/24443447
downvote count: 0
has comment: http://stackoverflow.com/comment/75673755
favorite count: 0
has title: how to search in mongodb java with multiple conditions in where clause
type: UnansweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/10620771
upvote count: 1
type: Question
tagged with: mongodb
has body: { "_id" : ObjectId("53ace08c98dea42bb1cb84ba"), "id" : "xyz", } select this collection where id = "xyz" or id = "abc" how to write this query in mongodb by Java
has answer: http://stackoverflow.com/a/24443832
answer count: 1

http://stackoverflow.com/a/24531640
has comment: http://stackoverflow.com/comment/52806997
has body: You have to call close() on the GZIPOutputStream before you attempt to read it. The final bytes of the file will only be written when the stream object is actually closed. (This is irrespective of any explicit buffering in the output stack. The stream only knows to compress and write the last bytes when you tell it to close. A flush() won't help ... though calling finish() instead of close() should work. Look at the javadocs.) Here's the correct code (in Java); package test; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; public class GZipTest { public static void main(String[] args) throws FileNotFoundException, IOException { String name = "/tmp/test"; GZIPOutputStream gz = new GZIPOutputStream(new FileOutputStream(name)); gz.write(10); gz.close(); // Remove this to reproduce the reported bug System.out.println(new GZIPInputStream(new FileInputStream(name)).read()); } } (I've not implemented resource management or exception handling / reporting properly as they are not relevant to the purpose of this code. Don't treat this as an example of "good code".)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/71572694
type: Answer
has comment: http://stackoverflow.com/comment/52809090
score: 58
accepted answer of: http://stackoverflow.com/q/24531089
answers question: http://stackoverflow.com/q/24531089
upvote count: 58

http://stackoverflow.com/q/24514060
has answer: http://stackoverflow.com/a/24517696
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: jspinner
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24517696
type: Question
has body: So I created a spinner using JSpinner.DateEditor, and I changed the formatter a little to validate user input. JSpinner sp1 = new JSpinner(sm); JSpinner.DateEditor de = new JSpinner.DateEditor(sp1, "hh:mm:ss a"); JFormattedTextField ftf = de.getTextField(); DateFormatter formatter = (DateFormatter) ftf.getFormatter(); formatter.setAllowsInvalid(false); formatter.setOverwriteMode(true); sp1.setEditor(de); It works fine except one thing. For example the time is 11:32:12 AM if I put my cursor before the colon that is between 32 and 12. I got 11:02:12 AM but I want to get 11:30:12 AM Any help on this? Thanks
answer count: 1
downvote count: 0
tagged with: date-format
has title: JSpinner with DateFormatter deletion behavior
favorite count: 0

http://stackoverflow.com/a/24562220
has body: As kdgregory informed me, http://docs.oracle.com/javase/7/docs/api/index-files/index-7.html exists! jComponent.getMouseListeners() returns an array of all its MouseListeners. From there, I can just check its size.
has comment: http://stackoverflow.com/comment/38075208
accepted answer of: http://stackoverflow.com/q/24561953
answers question: http://stackoverflow.com/q/24561953
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24471541
score: 0
answers question: http://stackoverflow.com/q/24471504
type: Answer
has body: flag = false is an assignment, so it is carried out. After the assignment on the first if, it evaluates to false because it was just set to it. For equality it should have been flag == false, but since it was an assignment, the top if was evaluated to false, and since it was changed to false, when you get to !flag, that passes because flag is no longer true, and it prints 3. You got an error with if(x = y) because after the assignment, the value couldn't be evaluated as a boolean outcome whereas if(flag = false) can evaluate to boolean after the assignment. The big thing to remember about high-level languages is that it takes more than one low-level statement to perform the logic of even a simple if, and with the assignment case, there is a minimum of 2 operations going on, first the assignment, then the equality.

http://stackoverflow.com/comment/37841158
score: 0
has text: @user3783249 I understand but Google (search) should be your first tool to take your doubts.
comment on: http://stackoverflow.com/a/24453346
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24539889
answer count: 2
has comment: http://stackoverflow.com/comment/38002378
upvote count: 2
tagged with: java
tagged with: double-precision
has answer: http://stackoverflow.com/a/24539941
has answer: http://stackoverflow.com/a/24539908
tagged with: bigdecimal
has title: Issue with java BigDecimal storing garbage value
has body: BigDecimal b = new BigDecimal(0.05); System.out.println(b); Output: 0.05000000000000000277555756156289135105907917022705078125 How to handle this ?
possible better answer: http://stackoverflow.com/a/24539908
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38002113
favorite count: 0
accepted answer: http://stackoverflow.com/a/24539941
type: Question

http://stackoverflow.com/q/24457646
has title: How to check for an existing node with with a certain property in Neo4j through Ajax?
favorite count: 0
tagged with: ajax
tagged with: rest
has body: This is probably the dumbest question ever. I have been trying for a long long time now but I cannot seem to figure out how to check for an existing node with a certain property using Ajax and REST in neo4j. I know the cypher query just not the Ajax for it . I need to check for an Existing Email Id passed from a jsp page. I am writing something like this :: $.ajax({ type:"POST", url: "http://localhost:7474/db/data/cypher", accepts: "application/json", dataType:"json", data:{ "query" : "match n where n.email = {email} Return count(n)", "params" : {"email" $('#email'} }, I cannot figure out how to complete the function and the I dont even know if its the right way to do it ? Please Help as this is eating up a lot of my time. Thanks.
answer count: 0
type: UnansweredQuestion
score: 1
linked to: http://stackoverflow.com/q/18542208
upvote count: 1
has comment: http://stackoverflow.com/comment/37852432
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37849157
downvote count: 0
tagged with: neo4j
tagged with: jquery

http://stackoverflow.com/comment/38044459
type: Comment
has text: Any idea what this might be? This is my first experience developing for Android, and so far it has not stop running with nothing happening except logcat spamming `GC_CONCURRENT`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24561985

embeddable
type: Tag
tag name: embeddable
tags question: http://stackoverflow.com/q/24551623

http://stackoverflow.com/comment/38063436
type: Comment
comment on: http://stackoverflow.com/q/24572469
has text: @DanTemple can you please elborate this point. i am stuck on it for whole day
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37929419
type: QuestionComment
type: Comment
has text: You also miss the concepts of what class and what objects is. The class is what you write. The object is what computer create after operator `new`.
comment on: http://stackoverflow.com/q/24500497
score: 0

http://stackoverflow.com/q/24511731
tagged with: servlets
type: Question
has body: i'm new in ExtJS and Servlet. I created a form with 2 fields usinf ExtJS : var panel = Ext.create('Ext.form.Panel', { title: 'Personnal Data', bodyPainting: 5, width: 350, region:'center', url: 'save_form.php', items: [{ xtype: 'textfield', fieldLabel: 'First Name ', name: 'firstName' }, { xtype: 'textfield', fieldLabel: 'Last Name ', name: 'lastName' }], buttons: [{ text: 'Submit', handler: function() { var formData = this.up('form').getForm(); } }] }); But i don't know how to pass the value of the two fields to a servlet, by clicking on the button. And how can i retrieve the data entered in the form, in the servlet ? Thank you !
upvote count: 1
has comment: http://stackoverflow.com/comment/37953009
answer count: 1
tagged with: javascript
favorite count: 0
has title: Passing form Data to servlet using Extjs
has comment: http://stackoverflow.com/comment/37950652
tagged with: extjs4
downvote count: 0
has comment: http://stackoverflow.com/comment/37949279
has answer: http://stackoverflow.com/a/24511795
accepted answer: http://stackoverflow.com/a/24511795
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/24568738
has comment: http://stackoverflow.com/comment/38056019
has comment: http://stackoverflow.com/comment/38056044
has comment: http://stackoverflow.com/comment/38056052
has comment: http://stackoverflow.com/comment/38055948
has body: My regular expression is pretty basic, so there might be a better way, but something like ( )?-( )?, where the spaces ( ) are optional groups might help, for example... String pattern = "( )?-( )?"; String values = "+7312111111 - +7312222222-+7312333333-+7312444444- +7312555555 -+7312666666"; String parts[] = values.split(pattern); for (String part : parts) { System.out.println(part); } Would output... +7312111111 +7312222222 +7312333333 +7312444444 +7312555555 +7312666666 You could even use something like ([ ]+)?-([ ]+)? if the number of spaces are unknown or you could just use - and trim the result, for example... String values = "+7312111111 - +7312222222-+7312333333-+7312444444- +7312555555 -+7312666666 - +731277777"; String parts[] = values.split("-"); for (String part : parts) { System.out.println(part.trim()); } Updated... You could use something like \+7312[0-9]+([ ]+)?-([ ]+)\+7657[0-9]+ to find possible matches... String value = "+7312111111 - +7657222222-+7312333333-+7312444444- +7312555555 -+7312666666 - +731277777"; Pattern p = Pattern.compile("\\+7312[0-9]+([ ]+)?-([ ]+)\\+7657[0-9]+"); Matcher m = p.matcher(value); while (m.find()) { value = m.group(); } With each matching group, you could just use value.split("-") to split the two elements apart as previously demonstrated...
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/38055994
has comment: http://stackoverflow.com/comment/38056022
answers question: http://stackoverflow.com/q/24568525

http://stackoverflow.com/comment/53711254
score: 0
type: AnswerComment
type: Comment
has text: Creating an application in JavaFX for student project, I got your jar installed however my program crashes when running the line with FxIconicsLabel. Did I need to port something outside of your github page and how if so? Very new to JavaFX.
comment on: http://stackoverflow.com/a/32633081

http://stackoverflow.com/comment/37916385
type: Comment
comment on: http://stackoverflow.com/a/24492561
has text: No, my point is that even if the access is atomic, this does not mean that read-modify-write accesses will be as well.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24437593
has body: Please i will like to find out if it is possible to add a custom payment gateway to quick books POS. No, it's not.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24429482

http://stackoverflow.com/comment/37879912
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24474109
has text: @AmitChotaliya: no, it won't. == tests if two references point to the same object. `new Integer(1) == new Integer(1)` is false.
type: AnswerComment

http://stackoverflow.com/a/24576479
score: 0
answers question: http://stackoverflow.com/q/24576400
type: Answer
has body: There are two objects created and sychronization happens on individual objects having its own monitor (intrinsic lock). If you want have the method synchronized on thread access, have a common object which can be used in synchronization.

http://stackoverflow.com/q/24465722
has comment: http://stackoverflow.com/comment/37863909
tagged with: textview
has title: Get text from Html styled TextView
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24465910
accepted answer: http://stackoverflow.com/a/24465910
linked to: http://stackoverflow.com/q/17491126
score: 0
has body: I have a TextView which contains text with Html attributes like subscription, for example it's a chemical formula H2SO4. How can I get this text from textview, but with subscriptions (String isn't showing the subscript) here you can see screenshot https://www.dropbox.com/s/0u9vtmqaxdnqfy5/Capture.PNG
tagged with: android
answer count: 1

http://stackoverflow.com/comment/37810427
comment on: http://stackoverflow.com/a/24436661
type: AnswerComment
score: 0
type: Comment
has text: so does that mean that the parent activity that first init'ed the obj is now not able to access the controller's obj (at the time the child's onCreate executes the parent's onCreate) ? so, how can I make sure that it does not re-inits or if I can re-init the controller from the child with the referenced obj?

http://stackoverflow.com/q/24557746
tagged with: r.java-file
answer count: 1
has answer: http://stackoverflow.com/a/24557827
tagged with: android
has comment: http://stackoverflow.com/comment/38035174
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24557827
tagged with: java
has body: Hi I have an app written that was working perfectly. I have it localised and I realised that one of my translations was incorrect so went into one of my string resource files and changed one of the text translations. After doing that I am now getting an error in my R.java file saying: Syntax error on token "Summary", delete this token. I'm just nervous to do this as I've always been told not to edit the R file. Has anyone encountered similar problems before?
has comment: http://stackoverflow.com/comment/38035154
type: Question
has title: Error in unedited R.java file and no where else?
score: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24547350
tags question: http://stackoverflow.com/q/24558735
type: Tag

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/24532256
tags question: http://stackoverflow.com/q/24538260
tag name: osx-mavericks

http://stackoverflow.com/comment/37832090
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24448492
has text: You can find the Java EE 7 tutorial here: http://docs.oracle.com/javaee/7/tutorial/doc/
type: Comment

http://stackoverflow.com/q/24469669
has comment: http://stackoverflow.com/comment/37871538
has comment: http://stackoverflow.com/comment/37871458
has answer: http://stackoverflow.com/a/24469840
type: Question
has comment: http://stackoverflow.com/comment/37871631
answer count: 2
upvote count: 0
has title: The output I'm trying to print doesn't print, trying to make a text based alarm clock with a HashMap
has comment: http://stackoverflow.com/comment/37871748
has comment: http://stackoverflow.com/comment/37871873
favorite count: 0
has body: I'm trying to compare the current time to the values in a HashMap to print a notification message (like an alarm). However, it doesn't print when the current time hits the time equal to a value within the HashMap. Is this because there isn't enough time for the containsValue method to iterate of the HashMap or another reason? Here is my relevant code: private SimpleDateFormat timeFormat = new SimpleDateFormat("kk:mm:ss"); @Override public void run() { while (true) { String currentTime = getCurrentTime(); if (callLog.containsValue(currentTime)) { System.out.println("it works!"); } } public String getCurrentTime() { Date time = Calendar.getInstance().getTime(); String currentTIme = timeFormat.format(time); return currentTIme; } Edit: Okay, I've figured out my problem with a few tweaks. My if check works if I run the program at the exact moment I set the alarm for. If I wait for the alarm to go off (say 2 minutes after the program runs) the message doesn't get sent. Modified code below: private HashMap&lt;Integer, String&gt; callLog; private SimpleDateFormat timeFormat = new SimpleDateFormat("kk:mm:ss"); private String wakeUpMessage = "This is your automatic wake up call for room number: "; private String nextCall; private Thread thread; public HotelSystem() { callLog = new LinkedHashMap&lt;Integer, String&gt;(); this.thread = new Thread(this); this.thread.start(); setAlarmTime(4, "20:45:00"); } @Override public void run() { while (true) { if (callLog.containsValue(getCurrentTime())) { System.out.println(getCurrentTime()); sendAlarmCall(4); } } } // sends a generic alarm call message followed by the room number public void sendAlarmCall(int roomNumber) { System.out.println(wakeUpMessage + roomNumber); } public String getCurrentTime() { Date time = Calendar.getInstance().getTime(); String currentTIme = timeFormat.format(time); return currentTIme; } public void setAlarmTime(int roomNumber, String time) { Date alarmDate; try { alarmDate = timeFormat.parse(time); String al…
has comment: http://stackoverflow.com/comment/37871454
has comment: http://stackoverflow.com/comment/37871769
has comment: http://stackoverflow.com/comment/37871719
has comment: http://stackoverflow.com/comment/37871668
type: UnansweredQuestion
downvote count: 2
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37871435
score: -2
has answer: http://stackoverflow.com/a/24469890
tagged with: java

http://stackoverflow.com/comment/37960043
has text: Is a SmartQueue a Thread? Is there really reason to extend Thread?
score: 1
comment on: http://stackoverflow.com/q/24517175
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24524319
type: Answer
has comment: http://stackoverflow.com/comment/37973215
has comment: http://stackoverflow.com/comment/37972585
answers question: http://stackoverflow.com/q/24523983
has body: required String but found Object In your for each loop, you are using String as type for element whereas arrycoll is list of raw List references whose type is Object. List arrycoll You've declared list of raw List references. You have to tell the compiler that they'll be List&lt;Integer&gt; values: List&lt;Integer&gt; arrycoll and use Integer instead of String for elem Replace int[] arry = new int[siz]; with Integer[] arry = new Integer[siz]; Hence code will become: Integer[] arry = new Integer[siz]; List&lt;Integer&gt; arrycoll = Arrays.asList(arry); for (Integer elem : arrycoll) { System.out.println(elem); }
has comment: http://stackoverflow.com/comment/37973486
score: 0

http://stackoverflow.com/comment/38042999
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24561697
has text: Please start sentences with capital letters. Functions "return" results, they don't "return you" results. Make us *want* to read your question!

http://stackoverflow.com/comment/38068794
type: AnswerComment
has text: @Bluddymarri It is actually a design problem buddy. :)
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24575839

http://stackoverflow.com/comment/37845331
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24455434
has text: Duplicate? [Pausing/stopping and starting/resuming Java TimerTask continuously?](http://stackoverflow.com/questions/2098642/pausing-stopping-and-starting-resuming-java-timertask-continuously/2098678#2098678)

http://stackoverflow.com/a/24473196
has comment: http://stackoverflow.com/comment/37878219
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24473099
type: Answer
score: 1
upvote count: 1
has body: If you want to shuffle your array allCommands there are several ways you could. Here is one using Collections.shuffle() and Arrays.asList() to shuffle a List backed by allCommands, - String[] allCommands = new String[] { "start", "help", "hint", "look around", "take note", "look under bed" }; System.out.println(Arrays.toString(allCommands)); Collections.shuffle(Arrays.asList(allCommands)); // &lt;-- shuffles allCommands System.out.println(Arrays.toString(allCommands));
accepted answer of: http://stackoverflow.com/q/24473099

http://stackoverflow.com/comment/120401807
type: AnswerComment
comment on: http://stackoverflow.com/a/27705453
has text: And if you want to be defensive, you should annotate the class with the ignore-getter and enabling the visible fields with the not ignored getter.
type: Comment
score: 0

http://stackoverflow.com/comment/79181971
has text: I disable the default java compiler phase and let the scala compiler compile both scala and java. This way you can have class interdependencies between languages.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/39881116
type: Comment

http://stackoverflow.com/a/24466291
answers question: http://stackoverflow.com/q/24466173
has comment: http://stackoverflow.com/comment/37865081
has comment: http://stackoverflow.com/comment/37874923
has comment: http://stackoverflow.com/comment/37874936
has comment: http://stackoverflow.com/comment/37864985
has body: You said it printed the array just fine, so System.out.println(nepGar); works as you want it. I think your only problem is that each loop, you are setting the entire string nepGar to the current element, meaning on the last iteration, the string will be the value of the last element. Instead of setting that string to be the element each time, append each element, meaning the last element will still be part of string, but you're just adding to it. I think you just want to change this line: nepGar = npGar.getGarazoPav(); to this: nepGar += npGar.getGarazoPav() + "\n";
has comment: http://stackoverflow.com/comment/37864959
score: 0
has comment: http://stackoverflow.com/comment/37874085
type: Answer

http://stackoverflow.com/q/24509211
downvote count: 0
has answer: http://stackoverflow.com/a/24524200
accepted answer: http://stackoverflow.com/a/24524200
has comment: http://stackoverflow.com/comment/37946229
tagged with: spring-batch
possible better answer: http://stackoverflow.com/a/24524741
upvote count: 3
tagged with: batch-processing
has body: In order to be able to log all skipped record / lines (from Flat file), I have linked Item (Data model) to FieldSet.getValues() in FieldSetMapper&lt;T&gt; implementation. Here record is my Data model. public void loadRecord(FieldSet fieldSet){ record.setFieldSet(fieldSet.getValues()); } SB provides record/line for onSkipInRead in the FlatFileParseException. To have the same for onSkipInWrite and onSkipInProcess, I came up with the above solution. Also, record does not store all the fields from the flat file, hence I can't each line using just the Data model. Is this a good way to acheive this ? Are there any other ways to do this ? Is the record / line corresponding to an Item stored in any context ? Thanks for the help !
favorite count: 0
has answer: http://stackoverflow.com/a/24524741
has comment: http://stackoverflow.com/comment/37971384
tagged with: spring
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37971332
tagged with: java
type: Question
answer count: 2
has title: Spring batch, logging Skipped records / lines

http://stackoverflow.com/comment/38021180
type: AnswerComment
has text: i got it, but how to get to know the size of the stream without using the first read?
score: 0
comment on: http://stackoverflow.com/a/24550250
type: Comment

http://stackoverflow.com/comment/38458682
score: 1
has text: Yes i did actually, there's an accepted answer to this question, take a look at it.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24433504

http://stackoverflow.com/comment/38074749
score: 0
type: AnswerComment
has text: iam doing it...please wait for 5
comment on: http://stackoverflow.com/a/24578483
type: Comment

http://stackoverflow.com/q/24459153
has comment: http://stackoverflow.com/comment/37851731
score: -2
favorite count: 0
type: Question
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37854460
tagged with: log4j2
has answer: http://stackoverflow.com/a/63417670
has answer: http://stackoverflow.com/a/24459280
has comment: http://stackoverflow.com/comment/37851759
tagged with: java
upvote count: 0
type: UnansweredQuestion
has body: I've looked everywhere but couldn't find any guides (that made sense to me) on how to use log4j 2. As a background, I'm extremely new to log4j or any type of logging, and the closest to logging I've ever gotten was System.out.println() or PrintWriter in Java (if that's even considered logging). I went to Apache Log4j 2 page to download the jar files, but there are 36 jar files and I have no clue which one to use. Can anyone get me started on how to append simple String messages to a log file from my server code (in Java)? For instance, when a user connects to my server, I have a simple System.out.println("user A connected to server at " + time); code, which serves me no good during real usage. I'd like to replace all my System.out statements to logging using Log4j, so that I can read them later and detect any bugs/crashes in my server code. Thanks in advance!
has title: Write simple logs using log4j 2

http://stackoverflow.com/comment/81150152
comment on: http://stackoverflow.com/a/47097450
type: AnswerComment
type: Comment
has text: android uses close to java syntax anyway.& I was searching for this exact problem that I encountered while working in netbeans that used to be an IDE for developing in android,seems to be worth pointing out. The Step by step problems and necessary jar files provided above for android-studio is close to what will solve the same problem above if encountered in Netbeans. I'm just providing my version of it in netbeans since this could be encountered while working in netbeans too. Fact is, I am working on this java proj.in netbeans so that I could deploy it in android later with working code.
score: 0

http://stackoverflow.com/q/24568053
has comment: http://stackoverflow.com/comment/38165024
has comment: http://stackoverflow.com/comment/38164985
has body: Currently I'm working on Selenium WebDriver and Java. I have a master script which runs all the other scripts. The master script as follows: import org.openqa.selenium.WebDriver; public class MasterScript { public static void main(String[] args) throws Exception { //***************************************************** // Calling Methods //***************************************************** LoginOneReports utilObj = new LoginOneReports ();// calling my 1st LoginOneReports.java WebDriver driver; driver=utilObj.setUp(); if(utilObj.Login()){ System.out.println("Login sucessfully completed"); } else { System.out.println("Login failed"); System.exit(0); } NewPR utilObj1 = new NewPR(driver);// calling my 2st NewPR.java Here I need to change if(utilObj1.test()){ System.out.println("NewPR KPI page has opened"); } else { System.out.println("NewPR KPI not able to open"); } FilterSection utilObj2 =new FilterSection(driver);//calling my 3st Filtersection.java utilObj2.FilterMatching(); } } I have a list of kPI's as follows: Currently in my NewPR.java script I'm directly going and clicking on the NewPR The script as follows: Log.info("Clicking on Overview and Evolution PR link"); if(existsElement("ext-new-prs")==true){ JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].click();", driver.findElement(By.id("ext-new-prs") )); Thread.sleep(6000); } else{ Log.info("element not present"); System.out.println("element not present -- so it entered the else loop"); } return driver.getCurrentUrl().equals("https://10.4.16.159/extranet_newprs/reports/type/default/"); } Instead of going and clicking each time one KPI. I need to store in a property file where all the list of values in screenshot. Then i need to call any 1 or more KPI and i need to run the 3rd script that is FilterSection.java My problem is all the KPI HTML are looks like this Problem Reports (PR) Age Average Time To Assign I don't have idea how to store these set of values in a pro…
has title: How to call id values from the property file using java?
answer count: 1
has comment: http://stackoverflow.com/comment/38165074
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38164977
has comment: http://stackoverflow.com/comment/38164780
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/24626349
score: 0
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/38165004
tagged with: jquery
has comment: http://stackoverflow.com/comment/38164889
has comment: http://stackoverflow.com/comment/38160605

http://stackoverflow.com/comment/37833455
has text: For the 1., I don't think you can scale the image while downloading, maybe possible with some interleaved formats as a hack, but not generally. For 2) I think you meant filesystem instead of memory.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24449389
type: Comment

http://stackoverflow.com/comment/69729665
score: 0
type: AnswerComment
has text: Another question: being a singleton currentCounter is initialized to System.currentTimeMillis() only once. So will it create duplicates if I create let's say 2^20 in 1 millisecond, then restart my JVM and then create 2^20 again?
comment on: http://stackoverflow.com/a/24536318
type: Comment

http://stackoverflow.com/q/24489083
has title: how to show text next to marker in google map v2 for android
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/13763545
linked to: http://stackoverflow.com/q/17837510
tagged with: google-maps
has comment: http://stackoverflow.com/comment/37907941
has answer: http://stackoverflow.com/a/34281722
answer count: 2
possible better answer: http://stackoverflow.com/a/34281722
has body: I am trying to have a default map marker in google map fragment and want to show some text next to it like the one shown in the pic below. I have tried http://googlemaps.github.io/android-maps-utils/ library however, it is not giving me the desired affect. Also I have a separate infowindow which pops up when the user clicks on the marker or the text next to it. Can anybody please point me to any material or reference to achieve the above.
has answer: http://stackoverflow.com/a/24489402
favorite count: 0
accepted answer: http://stackoverflow.com/a/24489402
tagged with: android
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37907885

http://stackoverflow.com/q/24444156
answer count: 2
has answer: http://stackoverflow.com/a/24444233
score: 0
has answer: http://stackoverflow.com/a/24444316
has body: I created a thread like this: private Thread t = new Thread() { @Override public void run() { try { while(true) { // do work Thread.sleep(1000); } } catch (InterruptedException ex) { } } }; t.start(); Then i interrupted it using t.interrupt(). As soon the thread stops and get on sleep() it will interrupt and become unusable, but will it stay on memory? Do i have to call t = null, or the GC will take care of that? I'm trying to dynamically interrupt the thread and recreate it when needed (using t = new Thread()), but im not sure if just interrupt() removes the old thread from memory. I've searched but couldn't find this specfic answer.
has comment: http://stackoverflow.com/comment/37824151
possible better answer: http://stackoverflow.com/a/24444316
accepted answer: http://stackoverflow.com/a/24444233
type: Question
type: AnsweredQuestion
tagged with: java
has title: Should i nullify an interrupted thread?

http://stackoverflow.com/a/24506775
type: Answer
answers question: http://stackoverflow.com/q/24506636
has comment: http://stackoverflow.com/comment/37967662
score: 3
downvote count: 0
has body: That is because the you should go to port 8080 http://localhost:8080 It says so in the screen shot, Started ... @0.0.0.0:8080
upvote count: 3

http://stackoverflow.com/q/24496691
has answer: http://stackoverflow.com/a/24537007
accepted answer: http://stackoverflow.com/a/24537007
favorite count: 0
has comment: http://stackoverflow.com/comment/37922774
has comment: http://stackoverflow.com/comment/37927655
possible better answer: http://stackoverflow.com/a/24496879
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37923420
tagged with: java
has body: So i'm given to crop out points that are not inside my rectangle or points that lie on the boundrey line. The rectangle is made up of the two points that are taken in by the method p1, p2. so for example if you have the points [(3.0,1.0), (2.0,2.0), (1.5,1.5), (3.0,0.0)] after the crop you should have [(3.0,1.0), (3.0,0.0)] so basically the method should remove all points that are out side the given points.. I solved it this way. But i get some weird errors when it comes to negative numbers.. public void crop(Point p1, Point p2) { double highX = 0; double lowX = 0; double highY = 0; double lowY = 0; if (p1.getX() &gt; p2.getX()) { highX = p1.getX(); lowX = p2.getX(); } else { highX = p2.getX(); lowX = p1.getX(); } if (p1.getY() &gt; p2.getY()) { highY = p1.getY(); lowY = p2.getY(); } else { highY = p2.getY(); lowY = p1.getY(); } for (int i = 0; i &lt; points.size(); i++) { Point P = points.get(i); if (Math.abs(P.getX() - lowX) &lt; Point.EPSILON || Math.abs(P.getX() - highX) &lt; Point.EPSILON || Math.abs(P.getY() - lowY) &lt; Point.EPSILON || Math.abs(P.getY() - highY) &lt; Point.EPSILON) { System.out.println(Math.abs(P.getX() - highX) &lt; Point.EPSILON); System.out.println("Keeping: " + points.get(i)); // keep } else { System.out.println("Remvoing: " + points.get(i)); points.remove(i); } if (P.getX() &lt; lowX || P.getX() &gt; highX || P.getY() &lt; lowY || P.getY() &gt; highY) { System.out.println("Removing: " + points.get(i)); points.remove(i); } } } any help solving this problem would be nice i've been stuck for a while now
downvote count: 3
type: Question
answer count: 2
tagged with: for-loop
tagged with: arrays
score: -1
tagged with: arraylist
upvote count: 2
has answer: http://stackoverflow.com/a/24496879
has comment: http://stackoverflow.com/comment/37967255
has title: How to crop out given points in java
has comment: http://stackoverflow.com/comment/37923570

http://stackoverflow.com/comment/38012878
type: Comment
has text: You can set it as an attribute in those conditions also..accordingly you need to handle it in receiving JSP.
comment on: http://stackoverflow.com/a/24545595
type: AnswerComment
score: 0

http://stackoverflow.com/a/24585509
has comment: http://stackoverflow.com/comment/38089248
score: 0
has comment: http://stackoverflow.com/comment/38089928
type: Answer
has comment: http://stackoverflow.com/comment/38088560
has comment: http://stackoverflow.com/comment/38088759
has comment: http://stackoverflow.com/comment/38089056
has comment: http://stackoverflow.com/comment/38088535
has body: You are updating status in onPostExecute method of AsyncTask.And getting status after calling AsyncTask,so it do not update status text. So update status text in onPostExecute execute method of AsyncTask.i.e. Simply change ((MainActivity) getActivity()).btnDoIt(); setTextInTextView(getString(R.string.text_status) + " " + ((MainActivity) getActivity()).getStatus(), R.id.textstatus); to ((MainActivity) getActivity()).btnDoIt(); And rewrite your onPostExecute method as @Override protected void onPostExecute(JSONObject json) { pDialog.dismiss(); try { // Storing JSON item in a Variable String vypis_key = json.getString(TAG_KEY); status = json.getString(TAG_STATUS); Toast toast = Toast.makeText(getApplicationContext(), "//KEY = " + vypis_key, Toast.LENGTH_LONG); toast.show(); //it writes KEY = OK FragmentManager fm = getSupportFragmentManager(); PlaceholderFragment fragment = (PlaceholderFragmen)fm.findFragmentById(R.id.fragment_main); fragment.setTextInTextView(getString(R.string.text_status) + " " + getStatus()); } catch (JSONException e) { e.printStackTrace(); } } Edit Initialize textview in OncreateView method of fragment and declare as TextView textView; in Fragment class as TextView textView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_main, container, false); textView = (TextView) rootView.findViewById(R.id.textstatus); //rest code And Rewrite setTextInTextViewmethod as public void setTextInTextView(String text) { textView.setText(text); }
answers question: http://stackoverflow.com/q/24585420

http://stackoverflow.com/comment/37936198
score: 0
has text: I know there is a max size. that is why my content is being cut, i want to know what other method up to do this @ScaryWombat also im using weblogic not tomcat
type: Comment
comment on: http://stackoverflow.com/q/24504298
type: QuestionComment

http://stackoverflow.com/q/24544197
has answer: http://stackoverflow.com/a/28907102
tagged with: mybatis-generator
score: 1
tagged with: java
type: Question
answer count: 2
has body: Im using MyBatis Generator to generate JavaBean and Mapper.xml. But the Mapper.xml is different as I expected . Mapper.xml contain two resultMap, BaseResultMap and ResultMapWithBLOBs. I only want one resultMap contain all column.
downvote count: 0
tagged with: mybatis
has title: MyBatis Generator single resultMap
has comment: http://stackoverflow.com/comment/38010904
favorite count: 0
has comment: http://stackoverflow.com/comment/38011452
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/53198801

http://stackoverflow.com/q/24427678
answer count: 1
tagged with: jackson
has comment: http://stackoverflow.com/comment/37814352
favorite count: 0
has comment: http://stackoverflow.com/comment/37794934
type: UnansweredQuestion
downvote count: 1
tagged with: mongo-jackson-mapper
tagged with: java
has comment: http://stackoverflow.com/comment/37797372
tagged with: http://stackoverflow.com/tag/json
score: -1
has body: I have a piece of json string which I would like to extract specific fields, and it field exist I would like to deserialize it into a specific type (Class). So far I have tried using ObjectMapper, but the problem with it that it designed to work in a way that the input json value is mapped to a designated class type. and in my case I need to take specific fields out of json string and deserialize them to objects. Next, I've tried JsonParser, it offers more options since I can iterate over a json field-by-field and for each field call 'readValueAs' method. this is almost perfect for me, my problem is that I don't want to go over the json field-by-field, I would like to dynamically tell the parser which field to parse and only then deserialize it into an object. Here is an example of what I would like to achieve: Say I have this json { "name" : "Bob", "age" : 21, "status" : false } I would like only to extract "name"'s value (Bob) and then deserialize it to java.lang.String How can I do this?? EDIT: I try to describe my flow better: When the app first loads I read the arguments of a specific method using reflection, later when the app receives a json message I would like to parse the message in a way that every key in the json corresponds to one arguments of the method. so I need to deserialize the value of the key from json into an object that matches that argument. If you know reflection mechanism in JAVA-8 you can get the type of the argument as well as it's name like you wrote it in the code! Hope this make it clearer....not sure :-)
type: Question
has title: Extract specific field from json and deserialize it according to speicific Class<?>
upvote count: 0
has comment: http://stackoverflow.com/comment/37809214
has comment: http://stackoverflow.com/comment/37796843
has answer: http://stackoverflow.com/a/24438834

http://stackoverflow.com/comment/37992787
has text: Thanks for reply. I messed up method name whole editing. Actually initializeService should be initializeTouchPointService. Edited in code also. Sorry for that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24534551
type: AnswerComment

http://stackoverflow.com/q/24539648
tagged with: ant
has comment: http://stackoverflow.com/comment/38002040
score: 0
has title: Javac simple package (JavaBib)
has body: Dear Java Programmers, JavaBib (http://code.google.com/p/javabib/) is a simple open source java package for which I would like to generate bytecode. The source can also be obtained by version control via svn checkout http://javabib.googlecode.com/svn/trunk/ javabib-read-only Although it consists of only a few java files, I am not able to compile it using javac *.java I get cannot find symbol error messages for nearly all of the files. The source files of the dom package all reside in one folder. Therefore, I think it should not be a problem with the classpath. I have tried different values for it nonetheless. There are additional source files in other directories. I tried copying them all in one directory and run javac in this directory, but javac was complaining about the same imports. Unfortunately, I have hardly any experience with java and can't fix the problem myself. Therefore, I would be grateful for hints towards additional diagnostics in order to pin down the problem. I use Ubuntu 12.04 as operating system and haven't set any classpath or sourcepath variable. At least javac seems to find imports like "java.util.list". Thanks in advance for your help.
tagged with: javac
has comment: http://stackoverflow.com/comment/38003725
answer count: 0
type: UnansweredQuestion
tagged with: package
tagged with: build
has comment: http://stackoverflow.com/comment/38016717
has comment: http://stackoverflow.com/comment/38003358
tagged with: java
type: Question

http://stackoverflow.com/comment/38088349
type: QuestionComment
has text: may logcat truncates your string if too long?! http://stackoverflow.com/questions/6321555/what-is-the-size-limit-for-logcat
score: 0
comment on: http://stackoverflow.com/q/24563604
type: Comment

http://stackoverflow.com/comment/38231591
comment on: http://stackoverflow.com/a/24515501
score: 0
has text: check here: https://play.google.com/store/apps/developer?id=Diego%C2%AE you will find it
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24554158
score: 1
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
upvote count: 1
tagged with: apache
answer count: 1
tagged with: jsp
has title: Apache error running java web application
favorite count: 0
has answer: http://stackoverflow.com/a/24554311
accepted answer: http://stackoverflow.com/a/24554311
has comment: http://stackoverflow.com/comment/38028391
downvote count: 0
has body: I received a Java Web program from my friend and I'm trying to run and understand the code, but I can't seem to run it, here's the error message from Apache log 03-Jul-2014 20:33:51.873 SEVERE [http-nio-8084-exec-29] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/毕设] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application] with root cause org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:278) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:76) at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:215) at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:123) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:411) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:469) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1455) at org.apache.jasper.compiler.Parser.parse(Parser.java:139) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:229) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:200) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:375) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:355) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:342) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) at org.apache.jasper.ser…

http://stackoverflow.com/a/24429422
has comment: http://stackoverflow.com/comment/37796595
has comment: http://stackoverflow.com/comment/37796798
has comment: http://stackoverflow.com/comment/37798328
type: Answer
has comment: http://stackoverflow.com/comment/37796531
has comment: http://stackoverflow.com/comment/37797404
has body: When you call Start_TimeKeeper(); it will start an other thread without stoping the first one. So your both threads decreases the time. That is why it is counting faster. Instead of creating a new thread every time, can't you just check if old thread is finished, if so, start a new one otherwise just reset the Question_Timeint. class TimeKeeper extends Thread { private volatile boolean run = false; @Override public void run() { run=true;//run while run=true while (run) { if (Question_Time &gt;= 0) { mHandler.post(new Runnable() { @Override public void run() { Question_Time--; UpdateUI(); } }); } try { Thread.sleep(Question_Time &gt;= 0 ? 1000 : 5000);//loop with longer delays if question time is below zero } catch (InterruptedException e) { e.printStackTrace(); } } } public void finish() { run = false; } } Use this TimeKeeper class. Start it once, use every time, reset variable to restart.
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/24429285
score: 1
has comment: http://stackoverflow.com/comment/37796676

http://stackoverflow.com/comment/37891113
type: Comment
comment on: http://stackoverflow.com/a/24480005
score: 0
type: AnswerComment
has text: The OP already knows this works, perhaps you could add "why in the example code its written as long l = 890L;"

http://stackoverflow.com/a/24492561
has comment: http://stackoverflow.com/comment/37943337
upvote count: 1
has comment: http://stackoverflow.com/comment/37916385
has comment: http://stackoverflow.com/comment/37915948
has comment: http://stackoverflow.com/comment/37921737
has comment: http://stackoverflow.com/comment/37919145
has comment: http://stackoverflow.com/comment/37916715
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37915415
answers question: http://stackoverflow.com/q/24492061
downvote count: 0
has comment: http://stackoverflow.com/comment/37916319
has body: The usual example: while(!condition) sleep(10); if condition is volatile, this behaves as expected. If it is not, the compiler is allowed to optimize this to if(!condition) for(;;) sleep(10); This is completely orthogonal to atomicity: if condition is of a hypothetical integer type that is not atomic, then the sequence thread 1 writes upper half to 0 thread 2 reads upper half (0) thread 2 reads lower half (0) thread 1 writes lower half (1) can happen while the variable is updated from a nonzero value that just happens to have a lower half of zero to a nonzero value that has an upper half of zero; in this case, thread 2 reads the variable as zero. The volatile keyword in this case makes sure that thread 2 really reads the variable instead of using its local copy, but it does not affect timing. Third, atomicity does not protect against thread 1 reads value (0) thread 2 reads value (0) thread 1 writes incremented value (1) thread 2 writes incremented value (1) One of the best ways to use atomic volatile variables are the read and write counters of a ring buffer: thread 1 looks at read pointer, calculates free space thread 1 fills free space with data thread 1 updates write pointer (which is `volatile`, so the side effects of filling the free space are also committed before) thread 2 looks at write pointer, calculates amount of data received ... Here, no lock is needed to synchronize the threads, atomicity guarantees that the read and write pointers will always be accessed consistently and volatile enforces the necessary ordering.

http://stackoverflow.com/a/24537204
has comment: http://stackoverflow.com/comment/38035881
has comment: http://stackoverflow.com/comment/38127630
has comment: http://stackoverflow.com/comment/38037562
answers question: http://stackoverflow.com/q/24528729
has body: The STS will issue a SAML 1.1 or 2.0 token by default depending on the TokenType that is sent. Thus to support both 1.1 + 2.0, no action is needed in terms of the STS configuration. The STSClient will return a SecurityToken Object. You can get the DOM representation of the returned token via stsClient.getToken(). You can then use something like WSS4J's DOM2Writer.nodeToString(node) to convert to a String. Colm.
score: 0
type: Answer

http://stackoverflow.com/q/24568408
has answer: http://stackoverflow.com/a/24568597
tagged with: inheritance
linked to: http://stackoverflow.com/q/8531292
has comment: http://stackoverflow.com/comment/38055412
has comment: http://stackoverflow.com/comment/38055633
downvote count: 0
has answer: http://stackoverflow.com/a/24568606
has comment: http://stackoverflow.com/comment/38055512
favorite count: 0
has comment: http://stackoverflow.com/comment/38055555
tagged with: constructor
linked to: http://stackoverflow.com/q/2515477
type: UnansweredQuestion
tagged with: interface
has body: I'm new to Java programming and right now, I am trying to understand OOP concepts (inheritance, polymorphisms, etc.). I know that, when a subclass extends a superclass (abstract or not), subclass constructor calls the constructor of that superclass first (super()). My questions are: 1) Is it the same case for Interfaces? I've read some articles saying that interfaces don't have constructors, so how exactly are they being extended? 2) How come multiple inheritance is not supported in Java but an interface can "extend" multiple other interfaces? Thanks in advance.
has title: In Java, what really happens when an interface "extends" another interface?
answer count: 4
tagged with: oop
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24568512
type: Question
linked to: http://stackoverflow.com/q/13773714
has answer: http://stackoverflow.com/a/24568835

http://stackoverflow.com/q/24515102
has comment: http://stackoverflow.com/comment/37955189
favorite count: 0
has comment: http://stackoverflow.com/comment/37956311
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has body: I am trying to integrate Facebook with my application.I read that i had to install OpenSSL which i downloaded and installed. now the problem is that i want to generate the application signature and i, using the cmd, wrote the following as instructed: C:\Program Files\Java\jre7\bin&gt;keytool -exportcert -alias androiddebugkey -keyst ore "C:\Users\Andre\.android\debug.keystore" | openssl sha1 -binary | openssl ba se64 All i got was an error saying: 'openssl' is not recognized as an internal or external command, operable command or a batch file. Any ideas on how to fix this?
has comment: http://stackoverflow.com/comment/37959384
tagged with: command-prompt
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has title: openssl issues: generating application signature
tagged with: openssl
linked to: http://stackoverflow.com/q/11896304
upvote count: 1
duplicate of: http://stackoverflow.com/q/11896304

http://stackoverflow.com/a/24505053
upvote count: 3
answers question: http://stackoverflow.com/q/24504549
type: Answer
score: 3
has body: I'll try to keep it simple. Java uses classloaders to load classes inside JVM. Java is able to load classes from binaries (*.class files) on filesystem or *.class files inside jar files. ClassLoader is something that has a "loadClass" functionality - it gets a string name of the class (with package and everything) and returns Class - a class file that describes this object. Once loaded, the class can be used inside the JVM. Example (pseudocode): ClassLoader myCl = ... Class&lt;Foo&gt; fooClass = myCl.loadClass("some.package.Foo") Why would you even bother about classloaders? Well, usually you don't really create your own classloaders. Hoewever sometimes you need them. Lets say, you're creating application server/web server. It's possible to load the application in runtime, applications should not interfere. In this case you might want to implement your own class loader and load each WAR with the help of its own classloader (this is essentially what actually happens in JBoss, tomcat and so forth). Another example, Lets say you store your class definitions in some "weird" places - like database, you you get the class definitions via network. In this case you'll implement your classloader that fetches the class definition and then loads. And the last note. Your own class loader shouldn't really "load" the class by itself, usually its only responsible to bring the byte stream and then call its parent's method to do actual loading (all class loaders extends java.lang.ClassLoader). Of course its a very broad theme to be covered in this post, I just tried to give a general directions to start with. You should probably read some documentation about classloaders. For example: this one should be good Hope, this helps
downvote count: 0

http://stackoverflow.com/q/24428750
favorite count: 0
upvote count: 1
tagged with: http-unit
has answer: http://stackoverflow.com/a/24428923
has body: Been trying to find a way of getting the String representation of an HTMLElement in HTTPUnit. I'm using HTTPUnit in some tests to get response HTML, and can get the text content of an element, however this does not include a text representation of its surrounding HTML, which I want to compare with a test value. Any help appreciated.
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24428923
downvote count: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has title: String representation of HTML element in HTTPUnit

http://stackoverflow.com/comment/37880921
has text: @BoristheSpider JDBC schold convert it in this style.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24471400
type: AnswerComment

http://stackoverflow.com/q/24539916
has answer: http://stackoverflow.com/a/24540080
type: AnsweredQuestion
downvote count: 0
has title: Java which element in the ListIterator is considered previous?
type: Question
score: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/24540080
upvote count: 3
tagged with: iterator
answer count: 2
accepted answer: http://stackoverflow.com/a/24539974
has body: I'm currently trying to learn how to implement my own ListIterators. I have most of it implemented and ready to go, except I'm confused by the previous() method. By standard convention, can I get an explanation of how previous() is usually interpreted. i.e.: &gt;cursor&lt; dog cat fish bird frog snake According to Oracles Java Platform 7 API: E previous() Returns the previous element in the list and moves the cursor position backwards. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next() to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.) What I don't quite understand is if previous() is called, does it return 'fish' or 'cat'. I understand it in 2 ways: 1) 'fish' was the object that you were previously at 2) 'cat' is the object at the index numerically previous to the index of 'fish' If previous returns 'fish', then does remove() actually remove the same element regardless of the direction of traversal?
tagged with: listiterator
favorite count: 0
has answer: http://stackoverflow.com/a/24539974

http://stackoverflow.com/comment/38067042
has text: I've got another idea: can it happen that two threads are running "at the same time"? Maybe there is a problem when two threads read images at the same time, or maybe (even more probable), if one sets it's parameters while the other thread reads the image?? Please try to add a mutex lock at the beginnging and unlock at the end of the function!!!
comment on: http://stackoverflow.com/q/24557965
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24451526
score: 1
answers question: http://stackoverflow.com/q/24451296
upvote count: 1
has body: try this StringBuilder sb = new StringBuilder(); Integer[] arr = new Integer[10]; if(arr[arr.length-1]&lt;0) sb.append("-"); for(int x = arr.length-1; x&gt;=0; x--){ sb.append(Math.abs(arr[x])); } String check = sb.toString(); System.out.println(check);
type: Answer
downvote count: 0

apache-storm
tags question: http://stackoverflow.com/q/24436216
tags question: http://stackoverflow.com/q/24560177
type: Tag
tags question: http://stackoverflow.com/q/24559983
tags question: http://stackoverflow.com/q/24510456
tags question: http://stackoverflow.com/q/24518408
tag name: apache-storm
tags question: http://stackoverflow.com/q/24511365

http://stackoverflow.com/a/24517183
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/24516994
has body: Method references and lambdas both evaluate to the same thing, a functional interface: method references are defined in JLS 15.13 lambdas are defined in JLS 15.27 functional interfaces are defined in JLS 9.8 So, the two are essentially equivalent. In the case of the method reference, the target is explicitly this, and in the case of the lambda, it's implicitly this. So, their "warning-ness" is the same. The next question is: which one did the compiler get wrong? Is the warning wrong, or the lack of warning? The reason the warning is there is that leaking this from the constructor has a couple of big dangers. One relates to multithreading: any memory visibility guarantees you get from final field semantics (as well as some other guarantees) are gone if you leak this from the reference. The other concern is that the addListener method will invoke the method on this right away, before the constructor has finished. That is, it'll be invoking a method on a partially-constructed object. This is especially problematic for overridable methods, because it could be that this constructor is for somebody else's superclass, and that somebody else has overridden the method in question. In that case, you'll be invoking the method on that subclass, whose constructor hasn't even had a chance to start yet (since a superclass's constructor is run first). So, yes, the warning on the lambda is correct. And it should be there for the method reference, too.
accepted answer of: http://stackoverflow.com/q/24516994

http://stackoverflow.com/q/24586308
has comment: http://stackoverflow.com/comment/38088179
upvote count: 0
tagged with: performance
has comment: http://stackoverflow.com/comment/38088426
tagged with: java
has comment: http://stackoverflow.com/comment/38088894
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38088442
score: -2
has comment: http://stackoverflow.com/comment/38089075
has comment: http://stackoverflow.com/comment/38088974
has comment: http://stackoverflow.com/comment/38088421
has title: Java performance optimization
downvote count: 2
has answer: http://stackoverflow.com/a/24586447
has comment: http://stackoverflow.com/comment/38089046
has comment: http://stackoverflow.com/comment/38089150
has comment: http://stackoverflow.com/comment/38088348
has comment: http://stackoverflow.com/comment/38088452
has comment: http://stackoverflow.com/comment/38088334
favorite count: 0
has body: For a JOGL game I get very low fps, now with some testing I found out the problem is not in the JOGL part, but in pure Java calculations. I need to define a lot of float variables, which takes up 90% of the time. I have tested for 45 float variables, where only 16 get an initial value. The rest is just float z1; float z2;, etc. This took around 5-10 milliseconds, according to System.currentTimeMillis(). But this code with the 45 floats is in a method called by a double loop. In total this method is called 49 times (7*7). All this is inside the JOGL method to draw the game in a JFrame, but because of this many float variables it takes a total of 100ms, which means only 10fps. So basically the problem is that I have to initialize 45*49=2205 floats. Is there any way to optimize this to get a better fps? For example, would a double be faster than a float? Or would it help to define the variables first outside the loop, and give them their value inside the loop? Does anyone know a way to make this code run faster? Thanks a lot in advance. EDIT As requested, here is the source code: for (int x = -4; x &lt; 3; x++) { // Loops 7 times for (int y = -4; y &lt; 3; y++) { // Loops 7 times long t1 = System.currentTimeMillis(); float z0 = terrain.getHeight(x-1, y-1); // Simple method, but takes up about half of the time float z1 = terrain.getHeight(x , y-1); float z3 = terrain.getHeight(x+1, y-1); float z4 = terrain.getHeight(x+2, y-1); float z5 = terrain.getHeight(x-1, y ); float z6 = terrain.getHeight(x , y ); float z7; float z8; float z9; float z10 = terrain.getHeight(x+1, y ); float z11 = terrain.getHeight(x+2, y ); float z12; float z13; float z14; float z15; float z16; float z17; float z18; float z19; float z20; float z21; float z22; float z23; float z24; float z25; float z26; float z27; float z28; float z29; float z30; float z31; float z32; float z33 = terrain.getHeight(x-1, y+1); float z34 = terrain.getHeight(x , y+1); float z35; float z36; float z37; float z38 = terrain.g…
linked to: http://stackoverflow.com/q/6241927
has comment: http://stackoverflow.com/comment/38089059
has answer: http://stackoverflow.com/a/24586427
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38088231
has comment: http://stackoverflow.com/comment/38088287
has comment: http://stackoverflow.com/comment/38088157

http://stackoverflow.com/comment/37955485
comment on: http://stackoverflow.com/q/24515120
type: Comment
type: QuestionComment
has text: @MrEngineer13 on the answer that is duplicate will the dialog sent me to this setting when i try to enable it?
score: 0

http://stackoverflow.com/a/24555378
downvote count: 0
type: Answer
has body: Inheritance lets you make functions more specific. You can reduce the number of things you throw, you can return a subtype of the return type, you can accept a supertype of a parameter type. This is because any possible call to your method most be a legal call to the super method, but the reverse does not need to be true. In other words in your example: new B().bar1() You know it doesn't throw the exception, you don't need to catch. ((A)new B()).bar1() You need to catch the exception as since you are now processing any A or subclass of A you might need to handle it. If you tried to do the reverse though and create a class C: public class C extends A implements I3 { @Override protected void bar4() {} public void bar1() throws IOException, SomeOtherException {} } This would not be allowed as now if you tried to use a C as an A you are not going to be catching SomeOtherException.
upvote count: 1
answers question: http://stackoverflow.com/q/24555352
score: 1

http://stackoverflow.com/q/24562232
has body: for (int l = 1; j &lt; 5; l++) { int l = (int)(Math.random()*5) +1; System.out.print(l + ","); } I generate a random number between 1-5 five times but instead of printing it out like this: 1, 3, 3, 5, 5 I would only like to print out something like this 1 has been printed once 3 has been printed twice 5 has been printed twice In summary, I would like to only count the number of repeated and non repeated integers in the loop and then print it.
type: AnsweredQuestion
tagged with: numbers
tagged with: java
accepted answer: http://stackoverflow.com/a/24562309
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/38043636
answer count: 2
has comment: http://stackoverflow.com/comment/38043661
tagged with: for-loop
has comment: http://stackoverflow.com/comment/38043763
score: 0
has comment: http://stackoverflow.com/comment/38043841
has title: Counting number of repeated numbers in loop and print
possible better answer: http://stackoverflow.com/a/24562323
has answer: http://stackoverflow.com/a/24562309
favorite count: 0
has answer: http://stackoverflow.com/a/24562323
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/38043682
tagged with: repeat

http://stackoverflow.com/comment/37826295
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24445170
score: 0
has text: @Aayush just tried with proper api url and still the error. How would I redirect to final before reading the input stream?

http://stackoverflow.com/comment/38075341
has text: no, i tried already but it occurs errors.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24579268
type: QuestionComment

http://stackoverflow.com/comment/37977662
score: 0
type: Comment
type: QuestionComment
has text: Not getting your question, especially - "But when I open and click buttons they couldnt make change on editText. When i write number on keybord, it edited."
comment on: http://stackoverflow.com/q/24527066

http://stackoverflow.com/comment/38070666
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24576793
score: 0
has text: Circular dependency? You're reading `MyMainHolder.INSTANCE` AS you're writing to it with a `new MyMain()`, that's definitely not going to work...

http://stackoverflow.com/q/24568477
tagged with: android-asynctask
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38055595
tagged with: android-fragments
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24568721
type: Question
accepted answer: http://stackoverflow.com/a/24568689
score: 0
has body: I am well aware that blocking the UI is not a good idea in general but there are some scenarios where my app simply cannot do any other work until some long running operations (e.g. loading data from a server) are complete. Assume the user clicks the "Load Data" button. To indicate that no UI interaction is possible until the data is loaded I would like to grey out the screen and show some kind of activity indicator. This is no problem at all, I simply overlay the screen with a new Fragment. The question is: How can I present this overlay fragment? public void onLoadDataClick() { // grey out the screen by simple showing a new Fragment showActivityIndicatorOverlay(); // Start the long running opeartion doVeryMuchWork(); dismissActivityIndicatorOverlay(); } public void showActivityIndicatorOverlay() { FragmentTransaction ft = context.getSupportFragmentManager().beginTransaction(); ActivityIndicatorOverlayFragment overlayFragment = ActivityIndicatorOverlayFragment.newInstance("Loading Data"); overlayFragment.show(ft, "activityIndicator"); } This does NOT work. The overlay does not show up. If I remove dismissActivityIndicatorOverlay() the overlay shows up after the long running operation completed. This is not too suprising: I assume that the showing the new fragment is handeled at the end of the current run-loop or at the start of the next loop. Of course the long running operation has to complete before the run-loop ends and thus the overlay is displayed too late... The obvious solution is of course to run the operation in a background thread using an AsyncTask: public void onLoadDataClick() { LoadDataTask loadTask = new LoadDataTask(); loadTask.execute(); } private class LoadDataTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { showActivityIndicatorOverlay(); } @Override protected Void doInBackground(Void... params) { doVeryMuchWork(); } @Override protected void onPostExecute() { dismissActivityIndicatorOverlay(); } } I was s…
answer count: 3
has answer: http://stackoverflow.com/a/24568689
has answer: http://stackoverflow.com/a/24568614
has answer: http://stackoverflow.com/a/24568721
has title: How to present a progress screen before/while a long running operation starts?

http://stackoverflow.com/a/24526334
type: Answer
answers question: http://stackoverflow.com/q/24525997
score: 2
has body: To do so, First you have to convert the integer value of IP-Address into a valid IP-Address using InetAddress#getByAddress(byte[]) : int ipAddress = -1406991772; byte[] bytes = BigInteger.valueOf(ipAddress).toByteArray(); String address = InetAddress.getByAddress(bytes).getHostAddress(); and then pass the address to client.connect(address);
upvote count: 3
has comment: http://stackoverflow.com/comment/37976373
downvote count: 1
has comment: http://stackoverflow.com/comment/37979075
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24525997

http://stackoverflow.com/q/24502984
tagged with: java
has title: ClassCastException: com.example.test.MyView can not be cast to com.example.test.MyView at
type: Question
has comment: http://stackoverflow.com/comment/37938917
has comment: http://stackoverflow.com/comment/37933804
has comment: http://stackoverflow.com/comment/37936334
score: 0
has comment: http://stackoverflow.com/comment/37933674
has comment: http://stackoverflow.com/comment/37933678
has comment: http://stackoverflow.com/comment/37933670
type: UnansweredQuestion
tagged with: classcastexception
tagged with: android
has body: As the title shows, I have encountered such a problem. I'm pretty sure my xml layout is correct and it should work perfectly in general. Why I would get that exception? And under what scenario? EDIT: the exception occurs at this line. The tag in xml is correct and I just got this crashed for few times. BTW, I didn't find any useful information in my code or log output. mInputView = (MyView) mRootLayout.findViewById(R.id.myview);
answer count: 0

http://stackoverflow.com/a/24518417
upvote count: 6
answers question: http://stackoverflow.com/q/24518393
has body: The classpath separator character is different on Linux (and on Unix) than it is on Windows. It's ; on Windows, but it's : on Linux (and Unix). Try this on Linux: javac -cp ".:dependency.jar" File.java java -cp ".:dependency.jar" File
score: 6
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24518393

jsf
tags question: http://stackoverflow.com/q/24576997
type: Tag
tags question: http://stackoverflow.com/q/24534420
tags question: http://stackoverflow.com/q/24427480
tags question: http://stackoverflow.com/q/24506234
tags question: http://stackoverflow.com/q/24536907
tags question: http://stackoverflow.com/q/24548785
tags question: http://stackoverflow.com/q/24488841
tags question: http://stackoverflow.com/q/24468940
tags question: http://stackoverflow.com/q/24498716
tags question: http://stackoverflow.com/q/24474667
tags question: http://stackoverflow.com/q/24504383
tags question: http://stackoverflow.com/q/24447584
tags question: http://stackoverflow.com/q/24446280
tags question: http://stackoverflow.com/q/24508281
tags question: http://stackoverflow.com/q/24489719
tags question: http://stackoverflow.com/q/24486010
tags question: http://stackoverflow.com/q/24490270
tag name: jsf
tags question: http://stackoverflow.com/q/24525160
tags question: http://stackoverflow.com/q/24468339
tags question: http://stackoverflow.com/q/24547467
tags question: http://stackoverflow.com/q/24581363
tags question: http://stackoverflow.com/q/24457872
tags question: http://stackoverflow.com/q/24546793
tags question: http://stackoverflow.com/q/24544242
tags question: http://stackoverflow.com/q/24457361
tags question: http://stackoverflow.com/q/24556376

http://stackoverflow.com/q/24452186
score: -2
has answer: http://stackoverflow.com/a/24452491
tagged with: arraylist
has answer: http://stackoverflow.com/a/24453143
tagged with: string
favorite count: 0
tagged with: android
has title: Comparing user input to String Array list
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24452517
accepted answer: http://stackoverflow.com/a/24453143
possible better answer: http://stackoverflow.com/a/24452271
tagged with: java
has answer: http://stackoverflow.com/a/24452271
downvote count: 3
upvote count: 1
type: Question
has body: So i've been trying to do this for a couple of days, been searchin' and trying different stuff, but none of them seem to work for me. I wan't to compare user input to the String ArrayList and see if it has that value. I do this to prevent users to send in whatever text they want, only what is in the String ArrayList. Here's the simplified code: ` private ArrayList&lt;String&gt; searchNames = new ArrayList&lt;String&gt;(); EditText nameCaptureNo; EditText nameCaptureUz; Button send; TextView tvTi; public void sendTestMsg() { // TODO Auto-generated method stub send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub for (int i = 0; i &lt; searchNames.size(); i++) { if (searchNames.get(i).toString().toUpperCase() .contains(nameCaptureNo .getText().toString().toUpperCase()) &amp;&amp; searchNames.get(i).toString().toUpperCase() .contains(nameCaptureUz .getText().toString().toUpperCase()) ) { send.setVisibility(View.VISIBLE); //here goes code wich sends info }else{ send.setVisibility(View.INVISIBLE); //warning tvTi.setText("Izvēlies pilsētu no saraksta!"); tvTi.setTextColor(Color.RED); continue; } break; } ` This is as far as I've gotten. This code seems to be sending the info, but the textview still changes to warning. Can you help? Many thanks for reading.

http://stackoverflow.com/q/24535475
accepted answer: http://stackoverflow.com/a/24535546
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37993621
has body: I'm having problems with my android code. Could i get some help? My java is as follows: package ryan.helloworld; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; public class mainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } final Button button = (Button) findViewById(R.id.HWbutton); button.setOnClickListener(new View.OnClickListener() } I'm getting an error with my button.setOnClickListener My XML is as follows &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainActivity" &gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" /&gt; &lt;/menu&gt; Its saying menu items should specify a name. Any help here?
answer count: 2
possible better answer: http://stackoverflow.com/a/24535630
upvote count: 0
has answer: http://stackoverflow.com/a/24535546
has answer: http://stackoverflow.com/a/24535630
favorite count: 0
tagged with: android
has title: Android java and xml error
has comment: http://stackoverflow.com/comment/37993520
score: -1
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/37927443
type: QuestionComment
has text: I thought this only occurred then the appropriate accelerator was activated (ie the ALT key on windows)
score: 0
comment on: http://stackoverflow.com/q/24499500
type: Comment

http://stackoverflow.com/comment/37952214
comment on: http://stackoverflow.com/q/24513400
type: Comment
score: 2
has text: Which datastructure you have? In Question you write `Set`, but you add `map` tag
type: QuestionComment

http://stackoverflow.com/q/24467014
has title: Closing a Thread's GUI after using Runtime.exec()
tagged with: libgdx
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/20169108
has comment: http://stackoverflow.com/comment/37869361
type: Question
has comment: http://stackoverflow.com/comment/37867324
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/4157303
linked to: http://stackoverflow.com/q/18447542
has comment: http://stackoverflow.com/comment/37867112
linked to: http://stackoverflow.com/q/779405
favorite count: 0
has answer: http://stackoverflow.com/a/24471177
linked to: http://stackoverflow.com/q/4633678
has comment: http://stackoverflow.com/comment/37869290
has body: I am making a game with LibGDX, now I am trying to restart the game by re-running the jar, for that I am using the jar's path, finding it by using: String location = new File(DesktopLauncher.class .getProtectionDomain().getCodeSource().getLocation() .getPath()).toString().replace("%20", " "); After using that I attempt to restart using a Process and the Runtime.getRuntime().exec("java -jar " + location + "\\Test.jar"); Now that far it works, but the problem is that the first instance of the game from which I create the new instance (from which I restart), remains on the screen and won't close until the second instance closes. This is my code for the restart: public static void restart() { Gdx.app.exit(); try { String location = new File(DesktopLauncher.class .getProtectionDomain().getCodeSource().getLocation() .getPath()).toString().replace("%20", " "); System.out.println(location); Process pro = Runtime.getRuntime().exec( "java -jar " + location + "\\Test.jar"); BufferedWriter writer = new BufferedWriter(new FileWriter(new File( "reprot.txt"))); InputStream stream = pro.getErrorStream(); BufferedReader reader = new BufferedReader(new InputStreamReader( stream)); String line = ""; writer.write(location); while ((line = reader.readLine()) != null) { writer.write(line); } writer.close(); } catch (IOException e) { e.printStackTrace(); } } Am I doing something wrong? How can I close the first instance of the game after starting the second instance? I tried doing it using a different thread, having this code: public static void main(String[] args) { try { String location = new File(DesktopLauncher.class .getProtectionDomain().getCodeSource().getLocation() .getPath()).toString(); System.out.println(location); Process pro = Runtime.getRuntime().exec( "java -jar " + location + "\\Test.jar"); BufferedWriter writer = new BufferedWriter(new FileWriter(new File( "report.txt"))); InputStream stream = pro.getErrorStream(); BufferedReader reader = new BufferedReader(new InputStrea…
has answer: http://stackoverflow.com/a/24472603
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37869470
linked to: http://stackoverflow.com/q/6356340
tagged with: process
upvote count: 1

http://stackoverflow.com/comment/37899903
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24484558
score: 0
has text: `javax.swing.Timer` has `stop` and `restart` methods

http://stackoverflow.com/q/24473796
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37879419
tagged with: multithreading
has title: Java - Define a timeout for Callable within a ExecutorCompletionService
has answer: http://stackoverflow.com/a/24473985
upvote count: 9
tagged with: java
tagged with: timeout
has answer: http://stackoverflow.com/a/24473918
type: Question
downvote count: 0
tagged with: callable
favorite count: 0
has comment: http://stackoverflow.com/comment/37879487
has body: I've got the following problem using ExecutorCompletionService. I want to call a lot of Callable in different Threads. These Callable don't share any information with each other. I need to define a timeout for each Callable, eg. do not run longer than 5 seconds. Each Callable can run in a different time that I do not know when starting. After the timeout the Thread should be stopped/killed and the result is not interesting any more for me. The other 'normal' running Threads should not be infuenced. So lets take the following example with a simple callable and my current java code. import java.util.Date; import java.util.concurrent.Callable; public class Job implements Callable<Integer> { int returnValue = 0; long millis = 0; public Job(long millis, int value) { this.millis = millis; this.returnValue = value; } @Override public Integer call() throws Exception, InterruptedException { try { System.out.println(new Date() + " " + returnValue + " started"); Thread.sleep(millis); System.out.println(new Date() + " " + returnValue + " finished"); return returnValue; } catch (InterruptedException e) { System.out.println(new Date() + " " + returnValue + " interrupted"); throw e; } } } And the other Class where the Callable is used. import java.util.ArrayList; import java.util.Date; import java.util.concurrent.*; public class CallableTest { public static void main(String[] args) { ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(2); CompletionService<Integer> pool = new ExecutorCompletionService<Integer>(newFixedThreadPool); for (int i = 10; i > 0; i--) { Job job = new Job(i * 1000, i); pool.submit(job); } ArrayList<Integer> results = new ArrayList<Integer>(); for (int i = 1; i < 11; ++i) { try { Future<Integer> future = pool.take(); Integer content = future.get(5, TimeUnit.SECONDS); results.add(content); System.out.println(new Date() + " added " + content); } catch (InterruptedException e) { e.printStackTrace(); } catch (TimeoutException e) { e.printStackTrace…
has answer: http://stackoverflow.com/a/29939501
tagged with: executorservice
answer count: 4
has answer: http://stackoverflow.com/a/24474244
score: 9

http://stackoverflow.com/comment/38047249
comment on: http://stackoverflow.com/a/24562759
has text: Based on your suggestion i added the spring solution to my question. Somehow adding it to our answer got rejected... Thank you.
type: AnswerComment
score: 0
type: Comment

resultset
tags question: http://stackoverflow.com/q/24483176
tags question: http://stackoverflow.com/q/24547406
tags question: http://stackoverflow.com/q/24432633
tags question: http://stackoverflow.com/q/24559911
tags question: http://stackoverflow.com/q/24476119
tags question: http://stackoverflow.com/q/24554084
tags question: http://stackoverflow.com/q/24578904
tag name: resultset
tags question: http://stackoverflow.com/q/24571839
type: Tag

http://stackoverflow.com/comment/37996960
comment on: http://stackoverflow.com/q/24522519
score: 0
has text: And where does that single row get created?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24441731
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24441804
has answer: http://stackoverflow.com/a/24441783
has answer: http://stackoverflow.com/a/24441804
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/24441783
has body: I am new to android. And i am making mortgage application. I want to find the monthly interest with following equation. M= (P *(J/1-(1+J)^-n)) + T I have received all the values of different fields .But i don't understand how to implement with this equation. Please suggest me or guide me the way to do so. Thanks
has title: Android: How to use mathematical expression in android
has answer: http://stackoverflow.com/a/24441829
score: 0
answer count: 3

tomcat
tags question: http://stackoverflow.com/q/24547779
tags question: http://stackoverflow.com/q/24516174
tags question: http://stackoverflow.com/q/24431386
tags question: http://stackoverflow.com/q/24473470
tags question: http://stackoverflow.com/q/24552937
tags question: http://stackoverflow.com/q/24532295
tags question: http://stackoverflow.com/q/24585429
tags question: http://stackoverflow.com/q/24520842
tags question: http://stackoverflow.com/q/24575428
tags question: http://stackoverflow.com/q/24511424
tags question: http://stackoverflow.com/q/24518179
tags question: http://stackoverflow.com/q/24427847
tags question: http://stackoverflow.com/q/24493230
tags question: http://stackoverflow.com/q/24560917
tags question: http://stackoverflow.com/q/24565133
tags question: http://stackoverflow.com/q/24534286
tags question: http://stackoverflow.com/q/24505159
tags question: http://stackoverflow.com/q/24519531
tags question: http://stackoverflow.com/q/24538517
tags question: http://stackoverflow.com/q/24456886
tags question: http://stackoverflow.com/q/24490976
tags question: http://stackoverflow.com/q/24490898
tags question: http://stackoverflow.com/q/24500740
tags question: http://stackoverflow.com/q/24435819
tags question: http://stackoverflow.com/q/24568775
tags question: http://stackoverflow.com/q/24477995
tags question: http://stackoverflow.com/q/24574046
tags question: http://stackoverflow.com/q/24517610
tags question: http://stackoverflow.com/q/24431711
tags question: http://stackoverflow.com/q/24434931
tag name: tomcat
tags question: http://stackoverflow.com/q/24536559
tags question: http://stackoverflow.com/q/24555765
tags question: http://stackoverflow.com/q/24533019
tags question: http://stackoverflow.com/q/24545553
tags question: http://stackoverflow.com/q/24546469
tags question: http://stackoverflow.com/q/24548216
tags question: http://stackoverflow.com/q/24482900
tags question: http://stackoverflow.com/q/24505035
tags question: http://stackoverflow.com/q/24509919
tags question: http://stackoverflow.com/q/24477556
tags question: http://stackoverflow.com/q/24462040
tags question: http://stackoverflow.com/q/24505847
tags question: http://stackoverflow.com/q/24535926
tags question: http://stackoverflow.com/q/24559723
tags question: http://stackoverflow.com/q/24451517
tags question: http://stackoverflow.com/q/24497270
tags question: http://stackoverflow.com/q/24480442
tags question: http://stackoverflow.com/q/24449873
tags question: http://stackoverflow.com/q/24491328
tags question: http://stackoverflow.com/q/24525825
tags question: http://stackoverflow.com/q/24537017
tags question: http://stackoverflow.com/q/24538007
tags question: http://stackoverflow.com/q/24522340
type: Tag
tags question: http://stackoverflow.com/q/24517967
tags question: http://stackoverflow.com/q/24491816
tags question: http://stackoverflow.com/q/24493333
tags question: http://stackoverflow.com/q/24552906
tags question: http://stackoverflow.com/q/24570768
tags question: http://stackoverflow.com/q/24433920
tags question: http://stackoverflow.com/q/24488814
tags question: http://stackoverflow.com/q/24456508
tags question: http://stackoverflow.com/q/24524915
tags question: http://stackoverflow.com/q/24447079
tags question: http://stackoverflow.com/q/24431901
tags question: http://stackoverflow.com/q/24445901
tags question: http://stackoverflow.com/q/24559007
tags question: http://stackoverflow.com/q/24451777

http://stackoverflow.com/comment/38070693
comment on: http://stackoverflow.com/q/24576844
score: 0
has text: Please remove [tag:php] tag
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37991822
comment on: http://stackoverflow.com/q/24534298
score: 0
type: Comment
has text: It's really hard to read that. Please remove the leading `>` and add your web.xml.
type: QuestionComment

http://stackoverflow.com/comment/37834101
type: Comment
has text: It will work in a few cases and fail in many other cases. It is not reliable. Plus, the question mentions opening the applet in a web site, so looking for files on the client computer may work when testing but is certainly going to fail when deployed.
score: 1
comment on: http://stackoverflow.com/a/24438962
type: AnswerComment

http://stackoverflow.com/a/24571563
accepted answer of: http://stackoverflow.com/q/24571463
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24571463
has comment: http://stackoverflow.com/comment/38072733
has comment: http://stackoverflow.com/comment/38064884
type: Answer
upvote count: 37
has body: It's more general than "inside loops" - it's any time you want to do concatenation over multiple statements, and don't need the intermediate result as a string. For example: StringBuilder builder = new StringBuilder("Start"); if (someCondition) { builder.append("Foo"); } if (someOtherCondition) { builder.append("Bar"); } builder.append("End"); String result = builder.toString(); While you could write that as: String result = "Start" + (someCondition ? "Foo" : "") + (someOtherCondition ? "Bar" : "") + "End"; ... that becomes hard to read. And if there are more statements within the if bodies, it may not even be feasible. To correct something within your question though: As I understand it, when I do String baz = "foo" + "bar" + "123" the java compiler internally replaces the expression with a StringBuilder. No, when you write that expression the compiler recognizes that it's a compile-time constant, and replaces it with String baz = "foobar123"; That's a very good reason not to explicitly use a StringBuilder - the code above is clearly more efficient at execution time than String baz = new StringBuilder("foo").append("bar").append("123").toString(); When it isn't a compile-time constant, the Java compiler will perform the concatenation using a StringBuilder, usually leaving you with easier-to-understand code than with the explicit use of StringBuilder, but with no performance hit. I suspect your teacher either doesn't properly understand string concatenation, or simply read somewhere else that you should use StringBuilder without fully understanding when it's appropriate.
has comment: http://stackoverflow.com/comment/38074575
downvote count: 0
has comment: http://stackoverflow.com/comment/38066490
has comment: http://stackoverflow.com/comment/38066474
score: 37
has comment: http://stackoverflow.com/comment/38061579

http://stackoverflow.com/q/24574648
has comment: http://stackoverflow.com/comment/38066458
tagged with: mockito
has comment: http://stackoverflow.com/comment/38068932
upvote count: 3
answer count: 3
tagged with: rest-assured
tagged with: junit
has answer: http://stackoverflow.com/a/24957318
has comment: http://stackoverflow.com/comment/38067413
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
has answer: http://stackoverflow.com/a/53736619
score: 3
has body: I have a put method that accepts inputstream. I want to call this method using rest assured in JUnit. This is what I used: with().body(inpustream).put("/service/1"); // i got error 404 forbidden.
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/7981640
has title: How to call put method in REST assured
type: Question
has answer: http://stackoverflow.com/a/40377017

http://stackoverflow.com/a/24500027
type: Answer
has body: The problem is here: objectMatrix.addElement(objectVector); System.out.println(objectMatrix.elementAt(0).size()); objectVector.clear(); Keep in mind that objectVector is a reference. So when you call objectMatrix.addElement(objectVector);, you're storing a reference to objectVector into objectMatrix. The actual object that that reference points to has not been copied or altered in any way. Thus, when you call objectVector.clear(), you clear out the objet that objectVector points to, which also happens to be the object whose reference you most recently added to objectMatrix. To solve this, either allocate a new Vector() for every iteration of your while loop or copy the contents of objectVector() into a new Vector() before adding it to objectMatrix. On a side note, you probably should use ArrayList instead of Vector. Vector is a legacy class which almost never needs to be used these days.
answers question: http://stackoverflow.com/q/24499942
score: 0

http://stackoverflow.com/comment/38075538
has text: You should try to teach the asker something, instead of just handing them code/doing it for them.
type: Comment
comment on: http://stackoverflow.com/a/24579048
type: AnswerComment
score: 0

http://stackoverflow.com/q/24431319
has comment: http://stackoverflow.com/comment/37800353
score: 0
tagged with: types
answer count: 1
favorite count: 0
has title: Why "int/boolean/..." are primary types which have no "behavior" where type is "behavior specification"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37802867
has body: From this paper: http://www-public.int-evry.fr/~gibson/Teaching/CSC7322/ReadingMaterial/Wegner87.pdf It defines type: type: A type is a behavior specification that may be used to generate instances having the behavior. But I found in this document: http://www.ccs.neu.edu/home/riccardo/courses/csu370-fa07/lect4.pdf It says Java has: primitive types: types corresponding to primitive values, including int, short, long, byte, char, float, double, and boolean. null type: the type of the value null But the "primitive types" are values which don't have behavior, and null is also value. Why are they "type"s? Do they reference the same concept "type"? About "behavior", in my current understand, it's what a variable or entity provides us to invoke (seems I'm talking about object). But since type is not only for "object" related languages, so I'm really not sure what "behavior" is now. Maybe the real question should be: What does "behavior" mean in the definition of "type"?
has comment: http://stackoverflow.com/comment/37800437
has answer: http://stackoverflow.com/a/24432466
has comment: http://stackoverflow.com/comment/37801592
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37800493
type: Question

http://stackoverflow.com/q/24460743
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37855749
has comment: http://stackoverflow.com/comment/37854751
has answer: http://stackoverflow.com/a/32617724
score: 0
has answer: http://stackoverflow.com/a/24461340
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I've been following these tutorials on how to make a top down shooter in java from Foreign Guy Mike on youtube, in eclipse. But I ran into a weird bug where the player could move diagnally when not shooting, but when the player shoots, they can't move to the north and west at the same time, I looked a little deeper but I couldn't find anything. Here is the player movement code: if(left) { dx = (0 - speed); } if(right) { dx = speed; } if(down) { dy = speed; } if(up) { dy = (0 - speed); } x += dx; y += dy; if(x &lt; r) x = r; if(y &lt; r) y = r; if(x &gt; GamePanel.WIDTH - r) x = GamePanel.WIDTH - r; if(y &gt; GamePanel.WIDTH - r) y = GamePanel.WIDTH - r; dx = 0; dy = 0; if(firing) { long elapsed = (System.nanoTime() - firingTimer) / 1000000; if(elapsed &gt; firingDelay) { GamePanel.bullets.add(new Bullet(270, x, y)); firingTimer = System.nanoTime(); } } And here is the entire bullet class: package games.duphus.wave; import java.awt.*; public class Bullet { private double x; private double y; private int r; private double dx; private double dy; private double rad; private int speed= 10; private Color color1; public Bullet(double angle, int x, int y) { this.x = x; this.y = y; r = 2; rad = Math.toRadians(angle); dx = Math.cos(rad) * speed; dy = Math.sin(rad) * speed; color1 = Color.YELLOW; } public boolean update() { x += dx; y += dy; if(x &lt; -r || x &gt; GamePanel.WIDTH + r || y &lt; -r || y &gt; GamePanel.HEIGHT + r) { return true; } return false; } public void draw(Graphics2D g) { g.setColor(color1); g.fillOval((int) (x - r), (int) (y - r), 2 * r, 2 * r); } } Any and all help is appreciated.
downvote count: 1
tagged with: youtube
has title: Java Game Development: Weird Movement bug
tagged with: java

http://stackoverflow.com/q/24586910
tagged with: jpa-2.0
upvote count: 1
has title: Is there any JPAv2-compatible vendor agnostic persistence api public available
has answer: http://stackoverflow.com/a/24589792
accepted answer: http://stackoverflow.com/a/24587581
favorite count: 0
downvote count: 0
has body: The JPA 2 maven packages I've met so far was only complete realizations either from hibernate or eclipse. But I want to build my package agains vendor agnostic api. Is it available public?
tagged with: maven
has answer: http://stackoverflow.com/a/24587581
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/24589792
tagged with: java
type: Question
answer count: 2
tagged with: jpa
tagged with: persistence

http://stackoverflow.com/a/24483007
downvote count: 0
has body: You are missing the Project name/context path in your url: http://localhost:8080/ProjectName/sayhello
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24482900
answers question: http://stackoverflow.com/q/24482900
type: AcceptedAnswer

http://stackoverflow.com/comment/38121513
type: Comment
comment on: http://stackoverflow.com/q/24575816
has text: That is not the correct answer i m looking for .
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37835197
comment on: http://stackoverflow.com/q/24448481
has text: @bean_droid, Do you mean, I put those pieces together in the `findAll()` method? Coz I already have them exactly the way you have put them here but only that they are in different sections of the code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24574781
type: Answer
score: 0
has body: Without knowing the inputs, it's harder to tell. But the way it looks with the limited info currently available is that you're not accessing the same thing, at least in those code samples. Java: Integer.toHexString(tempString.charAt(d)); In python would be: hex(ord(tempString[d])).replace('0x', '') Whereas currently, you're accessing the ord() of the index, not the character location in the input string. It would be worth checking your inputs, first, to ensure the issue is the conversion, rather than the inputs (which is how it appears).
answers question: http://stackoverflow.com/q/24574531

http://stackoverflow.com/comment/38088185
comment on: http://stackoverflow.com/q/24585901
score: 0
has text: what do you get with `HttpClientBuilder.create();`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/134537351
comment on: http://stackoverflow.com/a/48021072
score: 0
has text: Did not work for me with Spring Boot 2.7.10 / Java 17. But I posted separate [Answer](https://stackoverflow.com/a/76293145/1357094) that does work with those versions.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24513745
has comment: http://stackoverflow.com/comment/37955613
has comment: http://stackoverflow.com/comment/37956484
has comment: http://stackoverflow.com/comment/37953305
score: 0
has comment: http://stackoverflow.com/comment/37955414
has body: try and catch? List&lt;ArrayRecord&gt; records; try{ List&lt;ArrayRecord&gt; records = (List&lt;ArrayRecord&gt;) jpaem.getActiveSession().executeQuery(query, Arrays.asList(part, productNr, lang)); }catch(DatabaseException ex){ records = new ArrayList&lt;ArrayRecord&gt;(); return records; //RETURN EMPTY LIST, OR YOU CAN HANDLE YOUR OWN EXCEPTION } It is a specific driver Exception, so you must handle it yourself (it is not a common empty resultset). If your query doesn't execute SELECT operation, but executes either INSERT, UPDATE, or DELETE operation, then use executUpdate instead of executeQuery, therefore preventing the driver exception.
has comment: http://stackoverflow.com/comment/37953194
has comment: http://stackoverflow.com/comment/37956324
type: Answer
answers question: http://stackoverflow.com/q/24509224

http://stackoverflow.com/comment/37994456
comment on: http://stackoverflow.com/q/24527687
type: Comment
has text: If all data is of same type, just specify the type. Otherwise, find a common denominator (interface or abstract class), and make all classes that can go in data to extend / implement this super-type.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37835148
type: Comment
comment on: http://stackoverflow.com/q/24437564
score: 0
has text: @r.bhardwaj see the answer I posted
type: QuestionComment

http://stackoverflow.com/comment/55557131
score: 0
type: Comment
has text: you might as well go ahead and post your answer as the actual answer-
type: QuestionComment
comment on: http://stackoverflow.com/q/24446783

http://stackoverflow.com/a/45421781
downvote count: 0
has body: You can also call getLegendItems(), save it as a LegendItemCollection and set plot.setFixedLegendItems(legendItems) before any action listener occurs. This way it'll set all the legend items from the initial state, even when legend items are clicked on and off. XYPlot plot = chart.getXYPlot(); LegendItemCollection legendItems = plot.getLegendItems(); plot.setFixedLegendItems(legendItems); chartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent chartMouseEvent) { ChartEntity entity = chartMouseEvent.getEntity(); if (chartMouseEvent.getEntity() instanceof LegendItemEntity) { LegendItemEntity itemEntity = (LegendItemEntity) entity; XYDataset dataset = (XYDataset) itemEntity.getDataset(); int index = dataset.indexOf(itemEntity.getSeriesKey()); XYPlot plot = (XYPlot) chartMouseEvent.getChart().getPlot(); //set the renderer to hide the series XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesVisible(index, !renderer.isSeriesVisible(index), true); } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24562775

http://stackoverflow.com/a/24516353
has comment: http://stackoverflow.com/comment/37958662
score: 0
has body: Make sure there is a folder by the name imagesapp under the WEB-INF and as you have //C:/Users/achraf/workspace19/guidepro/WebContent/WEB-INF/imagesapp/profileapp" which means it will append the fileName to profileapp and store it in imagesapp.But if you are assuming that the file will be kept under profileapp then just put a slash atfer it like this C:/Users/achraf/workspace19/guidepro/WebContent/WEB-INF/imagesapp/profileapp/"
has comment: http://stackoverflow.com/comment/37958772
type: Answer
has comment: http://stackoverflow.com/comment/37958719
answers question: http://stackoverflow.com/q/24516214
has comment: http://stackoverflow.com/comment/37958387
has comment: http://stackoverflow.com/comment/37958308
has comment: http://stackoverflow.com/comment/37958839

http://stackoverflow.com/q/24496280
accepted answer: http://stackoverflow.com/a/24497985
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am using org.jdom2 to parse xml files. I need to know if the file is marked as version 1.1 or version 1.0. How do I access the xml declaration? Also how do I set the version when writing the output using the XMLOutputter?
has answer: http://stackoverflow.com/a/24516601
tagged with: jdom-2
has answer: http://stackoverflow.com/a/24497985
answer count: 2
possible better answer: http://stackoverflow.com/a/24516601
downvote count: 0
favorite count: 0
has title: How do you get the xml version of a document using org.jdom2?

http://stackoverflow.com/q/24475778
type: Question
tagged with: tiff
has comment: http://stackoverflow.com/comment/37905361
tagged with: artifacts
has comment: http://stackoverflow.com/comment/37905893
has comment: http://stackoverflow.com/comment/37900537
tagged with: jai
accepted answer: http://stackoverflow.com/a/24504117
answer count: 1
downvote count: 0
has body: I have been using JAI to write and read TIFF images, but I recently encountered a problem when encoding a gray image where I get 7 black (0) pixels at the end of each strip (8 lines per strip): I've been able to reproduce it only when setting DEFLATE compression with deflate level 0 using the SSCE below. Any other value seem to work. I have also witnessed sometimes that strips of the image were being shifted left by 30 pixels or so. I was not able to get a stable reproduction of that problem though, but if you know some hidden tips about encoding TIFF in JAI, it might also get rid of that. private static byte[] genImage(int width, int height) { byte[] pix = new byte[width * height]; Arrays.fill(pix, (byte)0xcf); for (int j = 0; j &lt; height; j++) { Arrays.fill(pix, j*width + width/3, j*width + 2*width/3, (byte)0x7f); } return pix; } public static void main(String[] args) throws Exception { int width = 256; int height = 256; byte[] pix = genImage(width, height); BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); System.arraycopy(pix, 0, ((DataBufferByte)img.getRaster().getDataBuffer()).getData(), 0, width * height); TIFFEncodeParam comp = new TIFFEncodeParam(); comp.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE); comp.setDeflateLevel(0); // Changing 0 to values 1-9 "solves" the problem FileOutputStream fos = new FileOutputStream("bugjai.tiff"); ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", fos, comp); encoder.encode(img); fos.close(); } EDIT: I made further investigation checking the file content on an 8x8 image. I deflated the byte content with level 0 (using java.util.zip.Deflater) an got an additional 11 bytes. I inserted these bytes at the end of my strip and patched the header to reflect the new length (value 4B instead of 40 at position 75h), and voilà! No more 7 pixels. So it seems there is a misencoding in JAI "forgetting" to put/count bytes when deflating. However, TIFF6 specification says at the beginnin…
favorite count: 0
tagged with: deflate
has title: JAI TIFF codec creating artifacts
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/24504117

http://stackoverflow.com/q/24505374
tagged with: xsd-validation
tagged with: web-services
has body: We have a request XSD that we use in our system and have a Spring Web service that used this request XSD. Everything compiles and deployed correctly. I can type the WSDL url into IE and view it. I can navigate to the request XSD in IE. So nothing seems to be wrong with the request XSD. But when I am trying to call the web service via SOAP UI: create a new project and add the WSDL and hit OK I get the following error ERROR:error: src-ct.2: To Extend the specified base type ‘Name@*MyNAMESPACE*‘ it must be a simple type or be a complex type with simple content. In my XSD I have a name field &lt;xs:simpleType name="Name"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:minLength value="1"/&gt; &lt;xs:maxLength value="15"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; And then I use this in several places where I extend it by adding an attribute &lt;xs:complexType name="MyCustomeName"&gt; &lt;xs:simpleContent&gt; &lt;xs:extension base="mc:Name"&gt; &lt;xs:attribute name="MyTypeOfName" fixed="MCN"/&gt; &lt;/xs:extension&gt; &lt;/xs:simpleContent&gt; &lt;/xs:complexType&gt; From what I can see the only way to enforce a length restriction and add an attribute is like the way I have defined it. No idea what is defined incorrectly. Any ideas? As requested here is my WSDL of the service &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions name="the-location" xmlns="http://schemas.mycomp.com/myowndir/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.mycomp.com/myowndir/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt; &lt;wsdl:types&gt; &lt;xs:schema&gt; &lt;xs:import namespace="http://schemas.mycomp.com/myowndir/" schemaLocation="../xsd/MyRequest-1.0.xsd"/&gt; &lt;xs:import namespace="http://schemas.mycomp.com/myowndir/" schemaLocation="../xsd/MyResponse-1.0.xsd"/&gt; &lt;xs:element name="TheServiceResponse"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="Me…
has comment: http://stackoverflow.com/comment/37948121
has title: Error adding an attribute and length restriction on a complex type
has comment: http://stackoverflow.com/comment/37941315
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/38075836
has comment: http://stackoverflow.com/comment/37974156
type: Question
tagged with: spring
tagged with: xsd
score: 0
tagged with: java

http://stackoverflow.com/comment/38066984
type: QuestionComment
comment on: http://stackoverflow.com/q/24574804
type: Comment
has text: So would I put the shuffle in the randomColor method? (shuffle each time the method is called)?
score: 0

http://stackoverflow.com/a/24488917
answers question: http://stackoverflow.com/q/24488809
has body: What you have so far wont even comile, elements of an ArrayList cannot be accessed using the index oberator []. You need to use the List#get(index) of list. also for comparuing Strings you are using the equal operator, this is not correct, it only compairs references wicht are in most cases not equal for the different String instances (unless interned). You need to use String#equals(otherString) or String#equalsIgnoreCase(otherString) method. for (int i = 0; i &lt; books.size(); i++) { if (books.get(i).getTitle().equals(title)) { books.get(i).borrowed(); } } You could also use the enhanced for-loop for (Book book : books) { if (book.getTitle().equals(title)) { book.borrowed(); } }
score: 0
type: Answer

http://stackoverflow.com/comment/37885816
type: Comment
comment on: http://stackoverflow.com/a/24476876
score: 0
type: AnswerComment
has text: Hi ur jsp page is working I tried in my local check whether this posted code is same to ur working code sometimes a small tag mistake corrupts everything

http://stackoverflow.com/comment/38039425
type: Comment
comment on: http://stackoverflow.com/q/24559472
score: 0
type: QuestionComment
has text: I have tried, but nothing happends

http://stackoverflow.com/q/24576484
upvote count: 2
tagged with: java
type: Question
has title: How do I set default Urls in Grails UrlMappings?
has body: I want to include a default url mapping for Grails. This is, if an url is requested which has no rule in the url mapping should be redirected to home/index. My url mapping currently is: class UrlMappings { static mappings = { "/$controller/$action?/$id?(.$format)?" { constraints { // apply constraints here } } "/"(controller:"home", action:"index") "/admin"(controller:"login",action:"authadmin") "/robots.txt"(controller:"home",action:"robots") "/sitemap.xml"(controller:"home",action:"sitemap") "404"(controller:"home",action:"notfound") "500"(view:'/error') "/**"(controller:"home", action:"index") } } I use the last rule starting with /** to map all incoming requests which do not have a certain rule in the url mapping. The problem is that when I put the following in my GSP file &lt;g:link controller="home" action="index"&gt;&lt;div class="MainLogo"&gt;&lt;/div&gt;&lt;/g:link&gt; Then the url looks like this: http://www.example.com/** Is there a way to correct this? How do I create a default mapping for urls where no rule in the url mapping was defined?
tagged with: grails
has answer: http://stackoverflow.com/a/24576934
tagged with: groovy
tagged with: grails-2.0
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24576934
tagged with: spring-mvc
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/24454972
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24454571
answers question: http://stackoverflow.com/q/24454571
has body: As you said you have the structure /workspace/A/A.java just open the terminal and browse to workspace directory then type the following command For compiling javac A/A.java For executing java A.A

http://stackoverflow.com/comment/38018919
score: 0
type: Comment
type: AnswerComment
has text: Good point. In which case I would just use multiple `AsyncTasks` to do your job. When your first task finishes, produce the prompt and then start the next to continue the job.
comment on: http://stackoverflow.com/a/24548749

http://stackoverflow.com/comment/38055881
type: Comment
type: QuestionComment
has text: Plus I added few functionality to the error collector for my convenience like finding bug within a range of asserts etc.
score: 0
comment on: http://stackoverflow.com/q/24568488

http://stackoverflow.com/comment/38017248
score: 0
type: Comment
has text: @ScaryWombat I dont know, maybe because part of the question was resolved?. I asume you was the one that remove that vote. Thanks buddy
type: AnswerComment
comment on: http://stackoverflow.com/a/24548109

http://stackoverflow.com/q/24487928
score: 7
favorite count: 0
has body: I'm trying to write a console program to display the current time recursively on the same line and position. I tried a lot but it is getting printed in multiple line using normal System.out.println, so I used PrintStream object. Now the thing is that it is appearing in the same position, but not getting updated. I couldn't be sure whether problem is with thread or PrintStream. Please help me with this problem or is there any other method to make things appear recursively on the same position in a console app? import java.util.Date; import java.io.IOException; import java.io.*; public class DateDemo { // boolean flag=true; public static void main(String args[]) { DisplayTime dt=new DisplayTime(); Thread thread1=new Thread(dt,"MyThread"); //thread1.start(); thread1.run(); } } class DisplayTime extends Thread { public void run() { try { while(true){ showTime(); Thread.sleep(1000); } } catch(InterruptedException e){ System.err.println(e); } } public void showTime(){ try { PrintStream original = new PrintStream(System.out); // replace the System.out, here I redirect to System.setOut(new PrintStream(new FileOutputStream("stdout.log"))); // System.out.println("bar"); // no output Date date =new Date(); original.print(date.toString()); // System.out.println(date.toString()); System.out.flush(); // output to stdout // original.close(); } catch(Exception e){ System.err.println(e); } } }
has answer: http://stackoverflow.com/a/24488157
tagged with: multithreading
tagged with: datetime
answer count: 4
has answer: http://stackoverflow.com/a/24488616
has title: Console program for making time appear on the same position
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37906047
tagged with: java
possible better answer: http://stackoverflow.com/a/24488616
upvote count: 7
linked to: http://stackoverflow.com/q/439799
has answer: http://stackoverflow.com/a/24488170
type: Question
has comment: http://stackoverflow.com/comment/37906412
has answer: http://stackoverflow.com/a/24489062
downvote count: 0
accepted answer: http://stackoverflow.com/a/24488170

http://stackoverflow.com/comment/37944228
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24508281
has text: Jetty version is 9.2.0.M1. In web.xml, web-app is declared as version 3.1, with context params: com.sun.faces.expressionFactory com.sun.el.ExpressionFactoryImpl Method signature is public void invokeController(String controllerId, Object... args)

http://stackoverflow.com/comment/38071385
type: AnswerComment
type: Comment
score: 2
has text: I wouldn't use this approach, personally - I'd generally just go for either an enum with a single value (for various reasons) or simply `private static final MyMain instance = new MyMain();`. For *full* laziness, I'd use the resource holder approach as shown in the OP's code. But your "answer" really isn't answering the question at all.
comment on: http://stackoverflow.com/a/24577163

http://stackoverflow.com/comment/43063779
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25918810
has text: [https://www.youtube.com/watch?v=8IIrf_JSuQk](https://www.youtube.com/watch?v=8IIrf_JSuQk)

http://stackoverflow.com/comment/38057003
comment on: http://stackoverflow.com/q/24567871
has text: Are you running this from localhost?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37818177
comment on: http://stackoverflow.com/q/24440443
has text: Thank you for you reply, for example delimiteer maybe some date. Or the ID of the record. In my case the delimiter is date of transactions. For example: "19.11.2014 11:44 Transaction begin: blabla 19.12.2014 11.22 Transaction failed blabla"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24478511
tagged with: java
has body: We have machine hostname as - dbx111.dc1.host.com dbx112.dc2.host.com dcx113.dc3.host.com dcx115.dev.host.com Here dc1, dc2, dc3 and dev are our datacenter and we will be having only four datacenter as of now. And also it might be possible that machine hostname can have more dots in between separated by another domain in future. Now I need to find out which datacenter my current machine is in as I will be running below code on the actual machine. And also I have two flows as of now one is USERFLOW and other is DEVICEFLOW. public enum FlowTypeEnum { USERFLOW, DEVICEFLOW } Problem Statement:- If my machine is in DC1 and flow type is USERFLOW then I need to return /test/datacenter/dc1 but if flow type is DEVICEFLOW then I need to return /testdevice/datacenter/dc1 But if my machine is in DC2 and flow type is USERFLOW then I need to return /test/datacenter/dc2 but if flow type is DEVICEFLOW then I need to return /testdevice/datacenter/dc2. And if my machine is in DC3 and flow type is USERFLOW then I need to return /test/datacenter/dc3 but if flow type is DEVICEFLOW then I need to return /testdevice/datacenter/dc3. But if my machine datacenter is in DEV, and flow type is USERFLOW then I need to return "/test/datacenter/dc1" but if flow type is DEVICEFLOW then I need to return /testdevice/datacenter/dc1. I have my below code which works fine but it doesn't use FlowTypeEnum at all. How do I pass typeEnum value from Java main to DatacenterEnum class and return string as shown in the above algorithm - Below is my TestsingEnum class - public class TestingEnum { public static void main(String[] args) { // FlowTypeEnum typeEnum = FlowTypeEnum.USERFLOW; // how to pass this typeEnum value to DatacenterEnum class with the current setup I have // and return basis on above algorithm System.out.println(DatacenterEnum.LOCAL_POOK); } } And below is my DatacenterEnum class - public enum DatacenterEnum { DEV, DC1, DC2, DC3; private static final Random random = new Random(); public static …
type: Question
tagged with: inetaddress
tagged with: enums
has title: How to efficiently return the string basis on current datacenter?
has answer: http://stackoverflow.com/a/24478746
answer count: 1
accepted answer: http://stackoverflow.com/a/24478746
tagged with: hostname
type: AnsweredQuestion
score: 0

http://stackoverflow.com/a/24474137
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37879948
accepted answer of: http://stackoverflow.com/q/24474126
type: Answer
has comment: http://stackoverflow.com/comment/37879887
has body: You can do it using back referencing: String.matches("^([0-9])\1{9}$") or: String.matches("^([0-9])\\1{9}$") DEMO This only matches exactly 10 digits in a line that are all the same.
answers question: http://stackoverflow.com/q/24474126
upvote count: 5
has comment: http://stackoverflow.com/comment/37879867

http://stackoverflow.com/q/24528125
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: java
type: Question
has title: InputSource not working in Android while retrieving data from Assets?
tagged with: dom
score: 0
has comment: http://stackoverflow.com/comment/37979649
tagged with: assets
has comment: http://stackoverflow.com/comment/37979728
has body: After checking the answers from the other questions and applying them to my program, I still have problems loading assets from my Project. Here is the block of code which has the problem and it seems to not go past the line with the comment //BUG public void parseXmlFile(String xml_file, String object, String xml_class, String pointer, Activity activity, TextView test) throws ParserConfigurationException, SAXException, IOException{ view = test; view.setText("2.1"); categories_list = new ArrayList&lt;Category&gt;(); //instantiate String object sto be used throughout class object_name = object; class_type = xml_class; value_pointer = pointer; //get factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); //get instance of document builder to build document from xml file DocumentBuilder builder = factory.newDocumentBuilder(); //Create bytestream which allows a stream of data from xml to document builder ByteArrayInputStream byte_stream = new ByteArrayInputStream(xml_file.getBytes("utf-8")); //create an input source for the bytestream InputSource input_src = new InputSource(activity.getAssets().open(xml_file)); dom = builder.parse(input_src); //BUG parseDocument(); byte_stream.close(); } My XML is in the assets folder and the app doesn't crash, it just doesn't do anything. The response i'm supposed to get is a listview of buttons gotten from the parsing of the XML. The algorithm to parse the XML works as it has been tested in a normal Java application. I just want to apply it to the Android app. If you want more info just comment.
type: UnansweredQuestion

http://stackoverflow.com/q/24581202
has comment: http://stackoverflow.com/comment/38086860
type: Question
has title: Stackoverflow at Arrays.asList(str.split(",")) -> due to wrong recursion
has comment: http://stackoverflow.com/comment/38079043
has comment: http://stackoverflow.com/comment/38079025
tagged with: stack-overflow
has body: EDIT : The commaString operation wasn't the problem. It was my fault. See below. I wrote a method to convert a comma String to an String List. But i got a stackoverflow in this method. Exception in thread "main" java.lang.StackOverflowError at java.util.ArrayList.subList(Unknown Source) at java.lang.String.split(Unknown Source) at java.lang.String.split(Unknown Source) at de.dhbw.horb.routePlanner.SupportMethods.commaStrToStrList(SupportMethods.java:82) public static List&lt;String&gt; commaStrToStrList(String commaStr) { if (commaStr == null) return null; return new ArrayList&lt;String&gt;(Arrays.asList(commaStr.split(","))); } So why is this happening? Is my commaStr to big? If yes, what else can use for this? The method doNextNode(id) is an recursion.: https://github.com/Spenhouet/RoutenplanerProjekt/blob/master/Routenplaner/main/de/dhbw/horb/routePlanner/parser/JDomGraphDataCreator.java EDIT : The problem was due to a missing clause in my recursion method. So the recursion got very deep. At first i pushed my max stack size to 3GB (-Xss3g) but it ended off in an out of memory exception. :/ Then i thought of if it could be possible that my recursion starts over at one point and is doing the same thing again and again. Therefor i've added a map that holds every visited node (id) with removing the nodes for failed recusions (backtracking). Now it works like a charm. Thanks to Marco13 for pointing out that eventually my recursion is getting to deep.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38079086
has comment: http://stackoverflow.com/comment/38080028
has answer: http://stackoverflow.com/a/24581362
has comment: http://stackoverflow.com/comment/38079072
has comment: http://stackoverflow.com/comment/38079084
has comment: http://stackoverflow.com/comment/38086515
has comment: http://stackoverflow.com/comment/38079867
tagged with: backtracking
has comment: http://stackoverflow.com/comment/38079042
type: AnsweredQuestion
tagged with: recursion
has comment: http://stackoverflow.com/comment/38079131
tagged with: java
accepted answer: http://stackoverflow.com/a/24581362
has comment: http://stackoverflow.com/comment/38079035

mysql
tags question: http://stackoverflow.com/q/24512166
tags question: http://stackoverflow.com/q/24519111
tags question: http://stackoverflow.com/q/24492366
tags question: http://stackoverflow.com/q/24432134
tags question: http://stackoverflow.com/q/24526006
tags question: http://stackoverflow.com/q/24576844
tags question: http://stackoverflow.com/q/24432987
tags question: http://stackoverflow.com/q/24575780
tags question: http://stackoverflow.com/q/24557298
tags question: http://stackoverflow.com/q/24438879
tags question: http://stackoverflow.com/q/24510490
tags question: http://stackoverflow.com/q/24547262
tags question: http://stackoverflow.com/q/24576422
tags question: http://stackoverflow.com/q/24503151
tags question: http://stackoverflow.com/q/24566413
tag name: mysql
tags question: http://stackoverflow.com/q/24565274
tags question: http://stackoverflow.com/q/24504712
tags question: http://stackoverflow.com/q/24556601
tags question: http://stackoverflow.com/q/24447636
tags question: http://stackoverflow.com/q/24485283
tags question: http://stackoverflow.com/q/24481405
tags question: http://stackoverflow.com/q/24488841
tags question: http://stackoverflow.com/q/24571839
tags question: http://stackoverflow.com/q/24451317
tags question: http://stackoverflow.com/q/24573771
tags question: http://stackoverflow.com/q/24558094
tags question: http://stackoverflow.com/q/24558092
tags question: http://stackoverflow.com/q/24564272
tags question: http://stackoverflow.com/q/24528222
tags question: http://stackoverflow.com/q/24523218
tags question: http://stackoverflow.com/q/24438359
tags question: http://stackoverflow.com/q/24546619
tags question: http://stackoverflow.com/q/24446998
tags question: http://stackoverflow.com/q/24493264
tags question: http://stackoverflow.com/q/24495573
tags question: http://stackoverflow.com/q/24487057
tags question: http://stackoverflow.com/q/24563564
tags question: http://stackoverflow.com/q/24471752
tags question: http://stackoverflow.com/q/24586043
tags question: http://stackoverflow.com/q/24530086
tags question: http://stackoverflow.com/q/24528337
tags question: http://stackoverflow.com/q/24467738
tags question: http://stackoverflow.com/q/24567588
tags question: http://stackoverflow.com/q/24500664
tags question: http://stackoverflow.com/q/24487033
tags question: http://stackoverflow.com/q/24506675
tags question: http://stackoverflow.com/q/24445343
tags question: http://stackoverflow.com/q/24501324
tags question: http://stackoverflow.com/q/24482016
tags question: http://stackoverflow.com/q/24494656
tags question: http://stackoverflow.com/q/24446280
tags question: http://stackoverflow.com/q/24572836
tags question: http://stackoverflow.com/q/24518202
tags question: http://stackoverflow.com/q/24582836
type: Tag
tags question: http://stackoverflow.com/q/24527883
tags question: http://stackoverflow.com/q/24548613
tags question: http://stackoverflow.com/q/24536880
tags question: http://stackoverflow.com/q/24455622
tags question: http://stackoverflow.com/q/24449470
tags question: http://stackoverflow.com/q/24427693
tags question: http://stackoverflow.com/q/24492874
tags question: http://stackoverflow.com/q/24570768
tags question: http://stackoverflow.com/q/24545166
tags question: http://stackoverflow.com/q/24478747
tags question: http://stackoverflow.com/q/24570249
tags question: http://stackoverflow.com/q/24524419
tags question: http://stackoverflow.com/q/24441944
tags question: http://stackoverflow.com/q/24570858
tags question: http://stackoverflow.com/q/24444573
tags question: http://stackoverflow.com/q/24502173
tags question: http://stackoverflow.com/q/24507711
tags question: http://stackoverflow.com/q/24534630
tags question: http://stackoverflow.com/q/24474450
tags question: http://stackoverflow.com/q/24564164
tags question: http://stackoverflow.com/q/24563385
tags question: http://stackoverflow.com/q/24478068
tags question: http://stackoverflow.com/q/24478273
tags question: http://stackoverflow.com/q/24504101

http://stackoverflow.com/comment/37928774
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24494169
has text: This question sould be posted on some IBM user group or bug trace. The Stack is not the best place for discussion as this is more question and answer.

http://stackoverflow.com/comment/48587132
score: 1
type: AnswerComment
has text: Took me a while to adapt to my app, and align and format code to Java/Android standards, but eventually it worked fine.
type: Comment
comment on: http://stackoverflow.com/a/26826692

http://stackoverflow.com/comment/37864689
type: Comment
has text: If you already checked that there are not JavaDoc than Maven is not able to download them either. So what exactly is your problem?
comment on: http://stackoverflow.com/q/24466059
score: 0
type: QuestionComment

http://stackoverflow.com/a/70678690
has body: Please add an apostrophe before number in Excel cell. That solved my similar problem when using Revit API. E.g: '123
score: 0
answers question: http://stackoverflow.com/q/24529486
type: Answer

http://stackoverflow.com/q/24478559
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24488248
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/25074145
has comment: http://stackoverflow.com/comment/38073452
has title: installing android sdk 23
has body: i am updating android sdk 23 and i'm getting this error. I am using windows xp. Error: Cannot complete the install because of a conflicting dependency. Software being installed: Android Development Tools 23.0.0.1245622 (com.android.ide.eclipse.adt.feature.feature.group 23.0.0.1245622) Software currently installed: Android Developer Tools 22.3.0.v201310242005-887826 (com.android.ide.eclipse.adt.package.product 22.3.0.v201310242005-887826) Only one of the following can be installed at once: ADT Package 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt.package 22.6.3.v201404151837-1123206) ADT Package 23.0.0.1245622 (com.android.ide.eclipse.adt.package 23.0.0.1245622) Cannot satisfy dependency: From: Android Development Tools 23.0.0.1245622 (com.android.ide.eclipse.adt.feature.feature.group 23.0.0.1245622) To: com.android.ide.eclipse.adt.package [23.0.0.1245622] Cannot satisfy dependency: From: Android Development Tools 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt.feature.group 22.6.3.v201404151837-1123206) To: com.android.ide.eclipse.adt.package [22.6.3.v201404151837-1123206] Cannot satisfy dependency: From: ADT Package 22.3.0.v201310242005-887826 (com.android.ide.eclipse.adt.package.feature.group 22.3.0.v201310242005-887826) To: com.android.ide.eclipse.adt.feature.group 22.2.0 Cannot satisfy dependency: From: Android Developer Tools 22.3.0.v201310242005-887826 (com.android.ide.eclipse.adt.package.product 22.3.0.v201310242005-887826) To: com.android.ide.eclipse.adt.package.feature.group [22.3.0.v201310242005-887826]
has answer: http://stackoverflow.com/a/24488248
has answer: http://stackoverflow.com/a/25074145
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

executorservice
type: Tag
tags question: http://stackoverflow.com/q/24534842
tags question: http://stackoverflow.com/q/24477316
tag name: executorservice
tags question: http://stackoverflow.com/q/24526675
tags question: http://stackoverflow.com/q/24473796

http://stackoverflow.com/a/24480309
upvote count: 2
answers question: http://stackoverflow.com/q/24480282
type: Answer
score: 2
downvote count: 0
has body: canGoBack is an instance (non-static) method. It can only be called on an instance of the WebView class. WebView is the class. Calling WebView.function() only works if function is a static function. You need to get the instance of the WebView and call it on that. For the record, the difference between a static and instance method- a static method may not use any non-static data. An instance method can. Static data only has 1 copy per class. Non-static data has 1 copy per instance of the class.

http://stackoverflow.com/comment/108777670
type: Comment
type: QuestionComment
has text: https://stackoverflow.com/a/47820334/11905599 Answer from Sairam Krish worked for me.
comment on: http://stackoverflow.com/q/24563694
score: 0

http://stackoverflow.com/q/24462043
upvote count: 2
type: UnansweredQuestion
has title: Cannot Find Symbol errors everywhere
tagged with: swing
has body: This is supposed to a three part panel with the top panel being a label that is updated with a number when a button in the middle panel is pressed. The label is cleared when a clear button on the bottom is pressed. The Problem is that almost every mention of each button from the middle panel causes a "cannot find symbol" error... Any help would be appreciated. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class NumericKeypadPanel2 extends JPanel { //---------------------------------------------------------------------- public NumericKeypadPanel2() { JButton b1 = new JButton ("1"); JButton b2 = new JButton ("2"); JButton b3 = new JButton ("3"); JButton b4 = new JButton ("4"); JButton b5 = new JButton ("5"); JButton b6 = new JButton ("6"); JButton b7 = new JButton ("7"); JButton b8 = new JButton ("8"); JButton b9 = new JButton ("9"); JButton b10 = new JButton ("*"); JButton b11 = new JButton ("0"); JButton b12 = new JButton ("#"); JButton clear = new JButton ("Clear"); NumListener listener = new NumListener(); b1.addActionListener (listener); b2.addActionListener (listener); b3.addActionListener (listener); b4.addActionListener (listener); b5.addActionListener (listener); b6.addActionListener (listener); b7.addActionListener (listener); b8.addActionListener (listener); b9.addActionListener (listener); b10.addActionListener (listener); b11.addActionListener (listener); b12.addActionListener (listener); clear.addActionListener (listener); String num = " "; JPanel panel_main = new JPanel(); panel_main.setLayout(new BorderLayout()); //top JLabel display = new JLabel(num); display.setBorder (BorderFactory.createLineBorder (Color.black, 3)); panel_main.add(display, BorderLayout.NORTH); //mid JPanel keypad = new JPanel(); keypad.setLayout(new GridLayout (4, 3)); keypad.setBorder (BorderFactory.createLineBorder (Color.black, 3)); //adding the buttons keypad.add (b1); keypad.add (b2); keypad.add (b3); keypad.add (b4); keypad.add (b5); keypad.add (b6)…
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24462053
has comment: http://stackoverflow.com/comment/37857487
answer count: 2
tagged with: user-interface
tagged with: button
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24462364
score: 2
tagged with: compiler-errors

serialization
tags question: http://stackoverflow.com/q/24566653
tags question: http://stackoverflow.com/q/24451257
tags question: http://stackoverflow.com/q/24547673
tags question: http://stackoverflow.com/q/24473428
tags question: http://stackoverflow.com/q/24544130
tags question: http://stackoverflow.com/q/24429639
tags question: http://stackoverflow.com/q/24556629
tags question: http://stackoverflow.com/q/24450611
tag name: serialization
tags question: http://stackoverflow.com/q/24573643
tags question: http://stackoverflow.com/q/24429920
tags question: http://stackoverflow.com/q/24429194
tags question: http://stackoverflow.com/q/24486589
tags question: http://stackoverflow.com/q/24455144
tags question: http://stackoverflow.com/q/24449238
tags question: http://stackoverflow.com/q/24562029
type: Tag
tags question: http://stackoverflow.com/q/24484022
tags question: http://stackoverflow.com/q/24519595
tags question: http://stackoverflow.com/q/24541673
tags question: http://stackoverflow.com/q/24432095
tags question: http://stackoverflow.com/q/24498423
tags question: http://stackoverflow.com/q/24521718
tags question: http://stackoverflow.com/q/24544107
tags question: http://stackoverflow.com/q/24432295
tags question: http://stackoverflow.com/q/24438108
tags question: http://stackoverflow.com/q/24452367

http://stackoverflow.com/comment/37912061
has text: Adding to that there's also the content-type property for messages, that could be (ab)used similarly.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24472520

http://stackoverflow.com/comment/37816994
type: QuestionComment
has text: Also, don't use raw types.
score: 1
comment on: http://stackoverflow.com/q/24440078
type: Comment

http://stackoverflow.com/comment/38229455
type: Comment
comment on: http://stackoverflow.com/a/24496499
has text: If you suspect that it's taking more time than you expect somewhere in your code, you really need to find out that that code is doing, i.e. where exactly is that time spent, and doing what? A profiler would be able to tell you this. Rather than trying to guess, get your code setup with a profiler and find out exactly what is going on. Netbeans has a built in profiler - take a look at that if you don't have any other options.
type: AnswerComment
score: 0

geography
type: Tag
tag name: geography
tags question: http://stackoverflow.com/q/24587681

http://stackoverflow.com/q/24461130
has body: I have a project that still uses Java 1.6. In java 1.7, I can write like his public ASTParseUnit(final IParserSelector parserSelector) { Data = new ArrayList &lt;&gt;(); // this is error in java 1.6 this.parserSelector = parserSelector; } How can I representate statement in Java 1.6 form this code Data = new ArrayList &lt;&gt;(); ? Thanks Solved. Sorry, this is an old project from antoher hands. now the code looked like this List&lt;ReportChart&gt; Data; ReportChart detailChart; public ASTParseUnit(final IParserSelector parserSelector) { Data = new ArrayList &lt;ReportChart&gt;(); this.parserSelector = parserSelector; }
type: Question
favorite count: 0
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/24461283
has answer: http://stackoverflow.com/a/24461264
has title: ArrayList not allowed with diamond sign in Java 1.6
has answer: http://stackoverflow.com/a/24461152
has comment: http://stackoverflow.com/comment/37855393
upvote count: 3
type: UnansweredQuestion
downvote count: 1
score: 2
tagged with: java

http://stackoverflow.com/q/24585884
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38130833
has title: Can I use the same connection object when calling within Methods?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38100625
linked to: http://stackoverflow.com/q/5149135
has comment: http://stackoverflow.com/comment/38288506
has comment: http://stackoverflow.com/comment/38270989
has answer: http://stackoverflow.com/a/24653841
score: 0
answer count: 2
has body: I have got a program this way: public void MethodOne() { String sqlquery = "select * from vendor_items where category_id = 1 "; PreparedStatement consildatedPst = connection.prepareStatement(sqlquery); ResultSet consilatedReslset = consildatedpst.executeQuery(); while(consilatedReslset.next()) { String name = consilatedReslset.getString("name"); if(name!=null) { MethodTwo(); } } } public void MethodTwo(String name) { String sqlquery2 = "select ename from Vendor where name=?"; PreparedStatement otherPst = connection.prepareStatement(sqlquery2); otherPst.setString(1,name); } This is the way connection is established (Later I will go for Connection Pooling). public class DBConnection { public static Connection getDBConnection() { String sURL="jdbc:mysql://localhost:3306/oms"; String sUserName="root"; String sPwd=""; Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(sURL, sUserName,sPwd); return conn; } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return conn; } } My question is Can I use the same connection object when calling within Methods??
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24605449
has comment: http://stackoverflow.com/comment/38251367
has comment: http://stackoverflow.com/comment/38290036

http://stackoverflow.com/a/24584648
upvote count: 1
has body: connection is asynchronous. the GoogleApiClient will execute a callback when it has connected or, more likely the first time, failed to connect and requires further action. review the documentation for how to implement onConnectionFailed(), onConnectionSuspended(), and onConnected(). you can only use the GoogleApiClient when you have received an onConnected() callback without a corresponding onConnectionSuspended() callback.
downvote count: 0
answers question: http://stackoverflow.com/q/24584578
type: Answer
score: 1

http://stackoverflow.com/comment/38152299
comment on: http://stackoverflow.com/a/24615204
type: AnswerComment
type: Comment
has text: I need to access it from java, how can I do that? Is it an input parameter?
score: 0

http://stackoverflow.com/q/24544763
type: UnansweredQuestion
has body: I'm trying send email over Java, and I've already done this before, but the ISP that I'm using now seems to have blocked all the ports as I have this code: Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); // tried props.put("mail.smtp.port", "25"); //props.put("mail.smtp.port", "8889"); For my personal host setting props.put("mail.smtp.timout", "10000"); The problem is I keep getting Could not connect to port error, so in case the ISP blocks all the ports, is there any possible way to send emails or just in case, could be something wrong with my approach. (it works with some ISPs but not with the one that I need to run the code on)
tagged with: port
has comment: http://stackoverflow.com/comment/38013295
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38011307
has comment: http://stackoverflow.com/comment/38011325
has comment: http://stackoverflow.com/comment/38011689
score: 0
tagged with: email
answer count: 1
has title: Java mail fails to connect to port
has answer: http://stackoverflow.com/a/24545840

http://stackoverflow.com/comment/38044767
score: 0
type: Comment
type: QuestionComment
has text: Dump a HPROF file from DDMS and see what's happening there.
comment on: http://stackoverflow.com/q/24561985

http://stackoverflow.com/comment/37906707
comment on: http://stackoverflow.com/q/24488317
has text: If you want us to do your sorting homework, then you are sort of ou of sort.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38020931
has text: @PavelHoral turns out you guys were right! Taking down the server is not a good thing to do. I've decided to take a different route instead - I've posted in my answer below
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24456886
type: QuestionComment

http://stackoverflow.com/comment/37852357
comment on: http://stackoverflow.com/a/24459455
type: Comment
has text: Examples are included in the picture
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38073774
has text: I'm slightly suprised its in onResume at all. Would it be fair to say you have to close and minimise your app before it starts working at all? I would have registered the listener within `onCreate()`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24578280

http://stackoverflow.com/comment/37970612
has text: I tried this the first time got unexpected cast to Picture, I didnt change the xml though. Eveything works fine now...just learned a new thing ^^. Thank you very much
type: Comment
comment on: http://stackoverflow.com/a/24520451
type: AnswerComment
score: 0

http://stackoverflow.com/q/24468902
has body: I am using RStudio on Windows. system2("java C:/myClass", args = as.character(myVector)) Warning message: running command '"java C:/myClass" 1 1 1' had status 127 From my understanding, this should mean that the command prompt is not able to recognise my call to a Java class file (which, however, should work). How to solve this problem? Thanks!
type: Question
tagged with: system2
has comment: http://stackoverflow.com/comment/37870433
tagged with: http://stackoverflow.com/tag/r
upvote count: 3
has comment: http://stackoverflow.com/comment/37870726
favorite count: 0
has title: Calling Java from R with System2 and Status 127
type: UnansweredQuestion
tagged with: rstudio
score: 3
answer count: 0
downvote count: 0
tagged with: java

http://stackoverflow.com/q/24545576
upvote count: 69
downvote count: 0
has answer: http://stackoverflow.com/a/28820997
has comment: http://stackoverflow.com/comment/38013406
has answer: http://stackoverflow.com/a/68599706
has answer: http://stackoverflow.com/a/62823729
has answer: http://stackoverflow.com/a/26604814
has answer: http://stackoverflow.com/a/67270295
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/51815623
has body: I've recently updated the android studio IDE to 0.8 to work with the new android L SDK. To start I imported a finished android project that receives no errors in the older version of android studio. In version 0.8 i lines such as import android.support.v4.app.Fragment; get: Support cannot be resolved causing the rest of the code to have errors. The logcat returns 101 instances of Error:(8, 30) error: package android.support.v4.app does not exist 1 for each time I call the support library in an import statement. I've tried reinstalling the IDE deleting contents of idea folder re installing all the SDK's - including the support libraries syncing the gradle copying the support library into the libs folder manually rebuilding the project as well as creating a new project to test the library not entirely sure what's left to do.
tagged with: java
has answer: http://stackoverflow.com/a/62853900
type: Question
has answer: http://stackoverflow.com/a/72768068
has answer: http://stackoverflow.com/a/31360671
has comment: http://stackoverflow.com/comment/50336143
tagged with: ide
has answer: http://stackoverflow.com/a/58313593
has answer: http://stackoverflow.com/a/28660443
possible better answer: http://stackoverflow.com/a/26604814
has answer: http://stackoverflow.com/a/52014948
has comment: http://stackoverflow.com/comment/38014924
score: 69
tagged with: sdk
has answer: http://stackoverflow.com/a/56128957
has answer: http://stackoverflow.com/a/78894695
has answer: http://stackoverflow.com/a/75689673
answer count: 17
has title: package android.support.v4.app does not exist ; in Android studio 0.8
has answer: http://stackoverflow.com/a/77242037
favorite count: 0
tagged with: android-support-library
tagged with: android-studio
has answer: http://stackoverflow.com/a/24546058
accepted answer: http://stackoverflow.com/a/24546058

http://stackoverflow.com/comment/38036647
type: Comment
comment on: http://stackoverflow.com/a/24555842
type: AnswerComment
score: 0
has text: Yes, the question is basically how can one determine and prove using memory model terms which reordering is legal. Happens-before is not the thing that defines that fully from my understanding: for this particular case, in a non-volatile variant, the 1 and 2 can be reordered and appears to happen even for the executing thread in non program order as there is no data/control dependency and it won't break anything. That violates HB relationship which is OK according to the model. For volatile case it's not, so certain violations are allowed and some are not. The question is the criteria.

http://stackoverflow.com/a/24480388
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/70577593
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/92490604
accepted answer of: http://stackoverflow.com/q/24480282
has body: Try changing: @Override public void onBackPressed() { if(WebView.canGoBack()){ WebView.goBack(); }else{ super.onBackPressed(); } } to: @Override public void onBackPressed() { WebView webView = (WebView) findViewById(R.id.webView1); if(webView.canGoBack()){ webView.goBack(); }else{ super.onBackPressed(); } } Explanation: You should call canGoBack() and goBack() for the webview instance that you're using (move to the previous view). This is also why the method is declared at the instance level and not at the class level (static)
answers question: http://stackoverflow.com/q/24480282

http://stackoverflow.com/a/24670671
has body: I solved this problem and I am attaching my solution jsut in case somebody else bumps into this.Also,I used Threads because I found it easier to do it with Threads. The ideea behind my solution was one thread was in charge of getting all the files that end in ".java" [producer] another parsing through those files to get the ones that contain a specific text The Producer: public class ThreadProducator extends Thread { public Bufferino buffer ; File directory ; static ArrayList&lt;File&gt;files = new ArrayList&lt;File&gt;(); public ThreadProducator(Bufferino a){ this.buffer = a; directory = new File("src"); } public static ArrayList&lt;File&gt; getFiles(File f){ ArrayList&lt;File&gt; files1= new ArrayList&lt;File&gt;(); for ( File fis : f.listFiles()){ if ( fis.isDirectory()){ getFiles(fis); } else{ if(fis.getName().endsWith(".java")){ files.add(fis); //System.out.println(files.toString()); } } } return files; } public void run() { // TODO Auto-generated method stub if(directory.isDirectory()){ ArrayList&lt;File&gt;files =new ThreadProducator(buffer).getFiles(directory); // System.out.println(files.toString()); buffer.put(files); try { sleep((int)Math.random()*1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } The Consumer: public class ThreadConsumator implements Runnable { private Bufferino buf; String lookedFor = "asdas"; public ThreadConsumator(Bufferino bufi){ this.buf = bufi; } @Override public void run() { // TODO Auto-generated method stub ArrayList&lt;File&gt; res = new ArrayList&lt;File&gt;(); String content=""; System.out.println("Files containing the word "+lookedFor+" are:"); for ( int i = 0 ; i &lt;25;i++){ res = buf.get(); for (File f : res) try { content = new Scanner(f).useDelimiter("\\Z").next(); if(content.contains(lookedFor)){ System.out.println(f.getName()); } /*System.out.println("-----------------------"); System.out.println(content); System.out.println("-----------------------");*/ } catch …
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24555689

http://stackoverflow.com/comment/37947251
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24510743
type: AnswerComment
has text: @dystroy No it shouldn't. It's an answer to the question.

http://stackoverflow.com/comment/51881572
score: 0
type: AnswerComment
type: Comment
has text: @DavidWallace I don't know why you call these calculations "bizarre". I think I have quite clearly argued what the rationale is (compound interest) and provided links to further illustrate my point. The $100 example of the original question also indicates that compound interest is what user1066367 had in mind (see the (unfortunately wrong) calculation that follows the sentence "After the second month..."). Nowhere does the original question mention banks or whether they use this or a different practice in real life, the question is obviously an exercise.
comment on: http://stackoverflow.com/a/24464170

http://stackoverflow.com/comment/38055714
comment on: http://stackoverflow.com/a/24546632
type: Comment
has text: I now have ADT 23, and now the **MainActivity.java** and the **activity_main.xml** files are not created in _any_ new projects. I believe it's an issue with the ADT plugins. I tried the update plugins solution [here](http://stackoverflow.com/questions/22243651/src-folder-in-eclipse-is-empty-mainactivity-class-not-created-after-creating-a), but it gave me a "conflicting dependencies" error. I am also unable to uninstall the current plugins without uninstalling Eclipse, an issue that others have mentioned but I have not seen a solution for.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24606660
has body: You don't have to start eclipse in debug mode, all it needs is starting Tomcat in your server view in debug mode with the bug icon. Assuming the same code is deployed as visible in your project, then you can set breakpoints and step through your code. In case you want to do the same with a remote Tomcat, then you have to manually add the debug settings in the start script and connect with a Remote Java Application runtime configuration.
type: Answer
answers question: http://stackoverflow.com/q/24586307
score: 0

http://stackoverflow.com/comment/37906498
comment on: http://stackoverflow.com/a/24487782
type: Comment
score: 0
type: AnswerComment
has text: Yeah I am looking for android integration. do you have sample for android?

http://stackoverflow.com/comment/37897835
type: Comment
has text: Thank you, that did change the format of the output to what I want, however, it is still displaying incorrect information. The output is Sun 1/11.
comment on: http://stackoverflow.com/a/24483212
type: AnswerComment
score: 0

http://stackoverflow.com/q/24488273
tagged with: lotus-notes
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24489114
tagged with: java
tagged with: lotus-domino
type: Question
has title: Extracting a word document attatchment from an IBM notes database
has body: I am developing a Java Application which will connect to an IBM notes database and extract the attachment (which will be a word document) from a given database entry. The word document then needs to be saved to the local disk. I have read through similar situations on here but I cant seem to get any further than confirming there is an embedded file within that document, I cant seem to access it. The code I have so far is: import java.util.Enumeration; import java.util.Vector; import lotus.domino.*; import lotus.domino.cso.RichTextItem; public class notesRetrieval extends NotesThread { public void runNotes() { try { Session s = NotesFactory.createSessionWithFullAccess("testpassword"); Database db = s.getDatabase("Server1", "dev/test.nsf", false); View materialview = db.getView("MaterialNumberLU"); Document doc = materialview.getDocumentByKey("3005"); System.out.print(doc.hasEmbedded()); } catch (Exception e) { e.printStackTrace(); } } } My hasEmbedded test statement returns true so I know there is an attatchment. If it is of any benefit, the word document on this particular notes entry is named "C4-P0007-BRS.doc". I have had play about with getAttachment(), getEmbeddedObjects(), and getFirstItem() but no avail. Any help much appreciated. Thanks.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24489114

http://stackoverflow.com/a/25049891
answers question: http://stackoverflow.com/q/24437564
downvote count: 0
type: Answer
score: 3
has body: How to update from 22.xx.x to 23.0.2 (my solution). This will beat the dependency issues. I was suffering from this issue for days, and I have tried every single solution on this link, but no luck. I finally figured out a solution that actually works! Please note that this solution works in Windows 7 (64 bit). It should probably work for other Windows operating systems. Here we go: download the latest ADT bundle from http://developer.android.com/sdk/index.html#download unzip it and open "eclipse" folder --> "plugins" folder Now go to your old eclipse and open "eclipse" folder --> "plugins" folder, and copy everything inside. Now paste them into the "plugins" folder of the (NEW ECLIPSE), but DO NOT overwrite anything. While inside of the "plugins" folder of your new Eclipse, do the search. Type in 22. (notice 22 with a dot) and hit enter. The search result will show up all the files or folders with .....22.6...... For example, com.android.ide.eclipse.adt_**22.6.2**.v201403212031-1085508 Highlight all of these files/folders and hit delete key. Make sure to update your old API/SDK to the latest version and load this sdk directory to work with your new eclipse. or You can watch this video, which shows you how to move all your SDK/API to your new SDK folder. Link: https://www.youtube.com/watch?v=jPZpJdnbbN0 I have not tried to update from any other ADT versions, but I think it should work for any old ADT versions too. Don't forget to backup stuff before attempting.
upvote count: 3

http://stackoverflow.com/a/24497371
has comment: http://stackoverflow.com/comment/49150430
has body: Joda module uses com.fasterxml.jackson.datatype.joda.deser.LocalDateDeserializer for deserializing org.joda.time.LocalDate objects. This class looks like this: @Override public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // [yyyy,mm,dd] if (jp.isExpectedStartArrayToken()) { jp.nextToken(); // VALUE_NUMBER_INT int year = jp.getIntValue(); jp.nextToken(); // VALUE_NUMBER_INT int month = jp.getIntValue(); jp.nextToken(); // VALUE_NUMBER_INT int day = jp.getIntValue(); if (jp.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after LocalDate ints"); } return new LocalDate(year, month, day); } switch (jp.getCurrentToken()) { case VALUE_NUMBER_INT: return new LocalDate(jp.getLongValue()); case VALUE_STRING: String str = jp.getText().trim(); if (str.length() == 0) { // [JACKSON-360] return null; } return parser.parseLocalDate(str); default: } throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, String or Number"); } As you can see, if LocalDate is array this deserializer expects ints in this array. You can write your custom deserializer and extend this implementation. See below example: class LocalDateWithStringsDeserializer extends LocalDateDeserializer { private static final long serialVersionUID = 1L; @Override public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // [yyyy,mm,dd] or ["yyyy","mm","dd"] if (jp.isExpectedStartArrayToken()) { return parseArray(jp, ctxt); } return super.deserialize(jp, ctxt); } private LocalDate parseArray(JsonParser jp, DeserializationContext ctxt) throws JsonParseException, IOException { int year = getNextValue(jp); int month = getNextValue(jp); int day = getNextValue(jp); if (jp.nextToken() != JsonToken.END_ARRAY) { throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after LocalDate ints"); } return new LocalDate(year, month, day); }…
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/37945287
answers question: http://stackoverflow.com/q/24432828
type: Answer
accepted answer of: http://stackoverflow.com/q/24432828
upvote count: 4
has comment: http://stackoverflow.com/comment/37942703

http://stackoverflow.com/a/24526445
accepted answer of: http://stackoverflow.com/q/24526398
answers question: http://stackoverflow.com/q/24526398
score: 6
type: Answer
downvote count: 0
has body: Ultimately both statements are same. In this case there is no difference since every class in java extends Object. You'll see the difference , if you take any specific object other than Object. For ex: List&lt;String&gt; vs List
upvote count: 6
has comment: http://stackoverflow.com/comment/37977080
type: AcceptedAnswer

http://stackoverflow.com/comment/93446282
score: 1
comment on: http://stackoverflow.com/a/24507383
type: AnswerComment
type: Comment
has text: CDATA does not make invalid characters valid. They will still make the XML fail validation.

http://stackoverflow.com/a/24480104
accepted answer of: http://stackoverflow.com/q/24480083
has comment: http://stackoverflow.com/comment/37891484
upvote count: 5
has comment: http://stackoverflow.com/comment/37891441
has body: The difference is in literal values. According to Primitive values, literal numeric values belong for int and double types. From Java Language Specification. Chapter 3. Lexical Structure. 3.10 Literals: An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (§4.2.1) (...) A floating-point literal is of type float if it is suffixed with an ASCII letter F or f; otherwise its type is double and it can optionally be suffixed with an ASCII letter D or d (§4.2.3).
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24480083

http://stackoverflow.com/comment/37942249
type: QuestionComment
comment on: http://stackoverflow.com/q/24507567
score: 0
type: Comment
has text: and "interests" is not null. It gives the correct output on the system.out.println();

http://stackoverflow.com/q/24452292
has answer: http://stackoverflow.com/a/24452336
favorite count: 0
has body: public class Afgh { public static void main(String[] args) { String s2=new String("Thisissurya"); char[] buf= new char[30]; s2.getChars(0,4,buf,0); System.out.println(buf); } } it will give output correctly : This but if we change code when we write like this public class Afgh { public static void main(String[] args) { String s2=new String("Techfortelangana"); char[] buf= new char[30]; s2.getChars(0,4,buf,0); System.out.println("the chars are :"+buf); } } but it will giving as output: the chars are :[C@138532dc why char array directly converted into string?? when concatenating??!
type: UnansweredQuestion
tagged with: java
type: Question
score: -2
tagged with: arrays
has title: when we combine char array with strings in pritln method why char array will converted into byte code in java?
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/24452383
upvote count: 1
tagged with: string

http://stackoverflow.com/a/24547469
accepted answer of: http://stackoverflow.com/q/24522363
type: Answer
answers question: http://stackoverflow.com/q/24522363
score: 0
type: AcceptedAnswer
has body: I can resolve my problem as the following code public static void main( String[] args) { ExecutorService executor = Executors.newCachedThreadPool(); executor.execute(new Runnable() { @Override public void run() { try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { } finally { System.out.println("Thread 2 is finished"); } } }); executor.shutdown(); System.out.println("Thread 1 is finished"); }

http://stackoverflow.com/comment/38083100
has text: i call the pack() but now it appears an strange frame with like 100x25 ... are you sure the frame size count the title bar?
comment on: http://stackoverflow.com/a/24583452
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24484851
has comment: http://stackoverflow.com/comment/37900548
has title: Get HTML styled text from TextView
has comment: http://stackoverflow.com/comment/37900677
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37900843
has comment: http://stackoverflow.com/comment/37900703
has answer: http://stackoverflow.com/a/24489886
has comment: http://stackoverflow.com/comment/37901006
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24484919
upvote count: 1
downvote count: 1
tagged with: textview
has body: I have a textview, and there is a HTML styled text on it like this on H2O. I want to get that text from TextView, I tried to get string from it ( getText().toString() ), but it brings the text without subscription like this H2O. How can I get text from textview with subscription?
favorite count: 0
tagged with: jlabel
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37900873

http://stackoverflow.com/comment/79570351
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24528628
has text: @jpangamarca Thanks, but this post is a little bit outdated (now Time4J supports 86 languages).

http://stackoverflow.com/q/24575353
answer count: 2
has title: How can i select text from browser screen with help of mouse events in selenium?
downvote count: 0
has body: I am trying to select text which is already present on the browser. I want to select that particular text and perform right click operation on it. However, the page on the browser has disabled right click. How can I select text in such situation?
favorite count: 0
tagged with: text
score: 2
has answer: http://stackoverflow.com/a/24577495
linked to: http://stackoverflow.com/q/11428026
upvote count: 2
has answer: http://stackoverflow.com/a/45045993
tagged with: selenium
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/45045993
tagged with: java
tagged with: mouseevent
type: Question
accepted answer: http://stackoverflow.com/a/24577495
has comment: http://stackoverflow.com/comment/38069433

http://stackoverflow.com/comment/37871394
type: Comment
score: 0
type: AnswerComment
has text: @Zodrak: and I don't see how we can tell you how to use your obiect since this would depend much on code you've not shown us. Think of how would you create a new table model with this variable, and then do so. Then set your JTable with this model.
comment on: http://stackoverflow.com/a/24469571

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/24582058

http://stackoverflow.com/a/24519791
score: 16
type: Answer
accepted answer of: http://stackoverflow.com/q/24517434
answers question: http://stackoverflow.com/q/24517434
upvote count: 16
has comment: http://stackoverflow.com/comment/126680040
has body: It looks that you're leaving some important details out of your question, and without a Minimal, Complete, and Verifiable example it is hard to say where is the problem. However, note that the sample you're trying to adopt is very old. JGraph has moved on to JGraphX. Consider the following sample that demonstrates the link of JGraphT and JGraphX using JGraphXAdapter. import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.jgrapht.ListenableGraph; import org.jgrapht.ext.JGraphXAdapter; import org.jgrapht.graph.DefaultWeightedEdge; import org.jgrapht.graph.ListenableDirectedWeightedGraph; import com.mxgraph.layout.mxCircleLayout; import com.mxgraph.layout.mxIGraphLayout; import com.mxgraph.swing.mxGraphComponent; public class DemoWeightedGraph { private static void createAndShowGui() { JFrame frame = new JFrame("DemoGraph"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ListenableGraph&lt;String, MyEdge&gt; g = buildGraph(); JGraphXAdapter&lt;String, MyEdge&gt; graphAdapter = new JGraphXAdapter&lt;String, MyEdge&gt;(g); mxIGraphLayout layout = new mxCircleLayout(graphAdapter); layout.execute(graphAdapter.getDefaultParent()); frame.add(new mxGraphComponent(graphAdapter)); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } public static class MyEdge extends DefaultWeightedEdge { @Override public String toString() { return String.valueOf(getWeight()); } } public static ListenableGraph&lt;String, MyEdge&gt; buildGraph() { ListenableDirectedWeightedGraph&lt;String, MyEdge&gt; g = new ListenableDirectedWeightedGraph&lt;String, MyEdge&gt;(MyEdge.class); String x1 = "x1"; String x2 = "x2"; String x3 = "x3"; g.addVertex(x1); g.addVertex(x2); g.addVertex(x3); MyEdge e = g.addEdge(x1, x2); g.setEdgeWeight(e, 1); e = g.addEdge(x2, x3); g.setEdgeWeight(e, 2); e = g.addEdge(x3, x1); g.setEdgeWeight(e, 3…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24582793
has body: Works for me. When I run your code, it sorts the list correctly in ascending order of employee age and prints it in that order. You should add a toString() method on your Employee class though, so you can actually see what it prints. P.S. Be aware that subtracting the ints to be compared would not work correctly if the values were extremely large, because the result then would overflow. The best practice would be to replace the subtraction with Integer.compare(this.age, compareAge.age). P.P.S. In Java 8 or above, the simplest way to do that sort would be to not bother with the compareTo method or Comparable interface, and simply write either: employeeList.sort((e1, e2) -&gt; Integer.compare(e1.age, e2.age)); or: employeeList.sort(Comparator.comparingInt(e -&gt; e.age));
has comment: http://stackoverflow.com/comment/38082203
has comment: http://stackoverflow.com/comment/38082166
type: Answer
has comment: http://stackoverflow.com/comment/38082072
has comment: http://stackoverflow.com/comment/38082243
has comment: http://stackoverflow.com/comment/38082082
has comment: http://stackoverflow.com/comment/38082303
has comment: http://stackoverflow.com/comment/38081999
has comment: http://stackoverflow.com/comment/38081917
answers question: http://stackoverflow.com/q/24582733
score: 0
has comment: http://stackoverflow.com/comment/38081935
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38082288
has comment: http://stackoverflow.com/comment/38082253
has comment: http://stackoverflow.com/comment/38081885

http://stackoverflow.com/a/32266112
score: 6
downvote count: 0
upvote count: 6
has body: Intellij IDEA 15 seems to make it even easier, it allows to stop in a part of the line where lambda is, see the first feature: http://blog.jetbrains.com/idea/2015/06/intellij-idea-15-eap-is-open/
type: Answer
answers question: http://stackoverflow.com/q/24541786

http://stackoverflow.com/comment/37896732
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24481429
type: Comment
has text: Yes all is same In my case I have Class1 which has many relationship with Class2 and with Class3. I have done mapping through xml but that doesn't make diff.

http://stackoverflow.com/q/24492765
type: Question
has title: CFEngine 3.5 Oracle JDK promise
has body: CFEngine 3 newbie here. Am trying to get Oracle JDK installed on an Ubuntu system, how should I script it in CFEngine? I can do something like this in shell by using PPA provided by webupd8team: add-apt-repository ppa:webupd8team/java apt-get update echo "Installing JDK 7..." echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections apt-get install -y oracle-java7-installer Am totally lost doing this in CFEngine. So far I have: body common control { inputs =&gt; { "$(sys.libdir)/stdlib.cf" }; bundlesequence =&gt; { "manage_properties", "manage_jdk"}; } bundle agent manage_properties { vars: "prop_pkgs" slist =&gt; {"python-software-properties", "software-properties-common"}; "cmds" slist =&gt; { "/usr/bin/add-apt-repository ppa:webupd8team/java", "/bin/echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections", "/bin/echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections", "/usr/bin/apt-get update" }; methods: "$(prop_pkgs)" handle =&gt; "manage_properties", comment =&gt; "Make sure required properties packages are installed", usebundle =&gt; package_latest("$(prop_pkgs)"); commands: "$(cmds)" comment =&gt; "Firing preinstall commands for JDK"; } bundle agent manage_jdk { methods: "JDK" handle =&gt; "manage_jdk", comment =&gt; "Make sure Java is installed", usebundle =&gt; package_latest("oracle-java7-installer"); } But the promise fails with following error: 2014-06-30T14:11:18+0000 error: /default/manage_jdk/methods/'JDK'/default/package_latest/packages/'oracle-java7-installer'[0]: Finished command related to promiser 'oracle-java7-installer' -- an error occurred, returned 100 2014-06-30T14:11:18+0000 error: /default/manage_jdk/methods/'JDK'/default/package_latest/packages/'oracle-java7-installer'[0]: Bulk package schedule execution failed somewhere - unknown outcome for 'oracle…
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cfengine
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47310233
score: 2
tagged with: java

http://stackoverflow.com/comment/38023856
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24550337
has text: ok i extract my restclient class in order to put it directly in my android project (no more maven dependencies now) and it still doesn't work...

http://stackoverflow.com/q/24546440
has body: I basically have an object to which there is a list of other objects associated. Like say, every country object has a list of its state objects in a HashMap. I wanna be able to pass this hashmap to my jsp and access the attributes of the key (which is country) and also its value's (list of its states). Using JSTL, I might use ${map.value.name}, etc to access the states' info. But how can I access the attributes of the key, i.e., country name, continent etc. Would ${map.key.name} etc work? Regards
type: AnsweredQuestion
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/24546615
type: Question
tagged with: jakarta-ee
tagged with: jstl
upvote count: 0
score: -1
tagged with: servlets
has comment: http://stackoverflow.com/comment/38014406
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/38015372
favorite count: 0
has answer: http://stackoverflow.com/a/24546615
has title: Passing a HashMap with object as Key and List of objects as Value to JSP

http://stackoverflow.com/q/24566343
has body: I have the code as below: object a = getObjectFromBlahBlah(); //'a' may possibly be null try{ a.beginTransaction(); . . . } catch (Exception e) { logger.debug(e.getMessage()); } After I run JTest, it will warn me 'a' may possibly be null. I don't want to do one more checking like if (a == null) return; since I already cover the NullPointerException in the try/catch block. Can anyone explain what happen to this? How I can get rid of this warning from JTest by alter the code?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38052625
tagged with: jtest
has comment: http://stackoverflow.com/comment/38052601
type: Question
accepted answer: http://stackoverflow.com/a/24567197
has comment: http://stackoverflow.com/comment/38052757
answer count: 1
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/38051581
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/24567197
has title: JTest - variable may possibly be null in try catch block
type: AnsweredQuestion

http://stackoverflow.com/comment/37814252
type: Comment
comment on: http://stackoverflow.com/a/24431566
has text: The issue has been fixed already, see the comments under the opening post.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24560068
has comment: http://stackoverflow.com/comment/38043671
answers question: http://stackoverflow.com/q/24559849
downvote count: 0
has body: You should look into using Shared Preferences . SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); Writing to Shared Preferences : SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putInt(getString(R.string.saved_high_score), newHighScore); editor.commit(); Reading from Shared Preferences SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE); int defaultValue = getResources().getInteger(R.string.saved_high_score_default); long highScore = sharedPref.getInt(getString(R.string.saved_high_score), defaultValue); Also here is a very simple tutorial on implementing them. Requested Example Code : Main Activity Class : package com.zeus.example; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.widget.CheckBox; public class MainActivity extends Activity { CheckBox chkBox1, chkBox2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); chkBox1 = (CheckBox) findViewById(R.id.checkBox1); chkBox2 = (CheckBox) findViewById(R.id.checkBox2); SharedPreferences getPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean value = getPrefs.getBoolean("checkbox_preference", true); chkBox1.setSelected(value); // Setting the value reflected from the preference chkBox2.setSelected(!value); // Setting the value opposite of the preference(Just an example) } } Preference Activity Class : package com.zeus.example; import android.os.Bundle; import android.preference.PreferenceActivity; public class Prefs extends PreferenceActivity{ @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.setti…
has comment: http://stackoverflow.com/comment/38043874
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38041623

http://stackoverflow.com/comment/43212860
type: Comment
comment on: http://stackoverflow.com/a/24455640
has text: @ツPratikButaniツ No Android Studio is now out with a stable version after 18 months of development and if I well remember the ADT is missing now in the download page, the message from Google is: Please use Android Studio :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38014311
type: QuestionComment
has text: Eh? The default servlet should automatically be serving static content. Unless you've really messed up the config. What happens when you visit your link?
comment on: http://stackoverflow.com/q/24546469
score: 0
type: Comment

http://stackoverflow.com/q/24541920
score: -1
has title: One DateFormat to another DateFormat using SimpleDateFormat, without using external lib
answer count: 1
accepted answer: http://stackoverflow.com/a/24543881
has comment: http://stackoverflow.com/comment/38008469
favorite count: 0
has comment: http://stackoverflow.com/comment/38142184
has comment: http://stackoverflow.com/comment/38008817
tagged with: datetime
tagged with: regex
has answer: http://stackoverflow.com/a/24543881
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has body: I'm trying to get the following bit of code to work with both input Strings. It works for the one without the dash (this is a limitation of SimpleDateFormat). I get the ParseException for the second input. JodaTime has been a suggestion in related posts, however, I can't use that and I'm on Java 6. I'd like to avoid regex solutions, though, a simple one for the format I have that works for both Strings would do. I'm going to drive home now, and check this out again in a couple of hours, with updates on what I find. import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class testcc { public static void main(String[] args) { String input = "Wed Jul 02 00:00:00 EDT 2014"; // String input = "Wed Jul 02 00:00:00 GMT-400 2014"; DateFormat df = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy"); Date date = null; try { date = df.parse(input); } catch (java.text.ParseException e) { e.printStackTrace(); } DateFormat dfTarget = new SimpleDateFormat("dd-MMM-yyy"); System.out.println(dfTarget.format(date)); } }
has comment: http://stackoverflow.com/comment/38006178
upvote count: 0
has comment: http://stackoverflow.com/comment/38006156

http://stackoverflow.com/q/24548153
score: 0
answer count: 2
tagged with: android-activity
favorite count: 0
has body: I am trying to create a service that will show a toast every second with the most recent running application. Every time I start the service, I get a NullPointerException. What can I do to avoid this? public class CheckRunningActivity extends Service { private static final String TAG = "CheckRunningActivity"; boolean checkApps; private Timer mTimer = null; private Handler mHandler = new Handler(); private ActivityManager am; public static final long NOTIFY_INTERVAL = 1000; // 1 second @Override public void onDestroy() { mTimer.cancel(); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { Log.d(TAG, "I created it"); ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); // cancel if already existed if(mTimer != null) { mTimer.cancel(); } else { // recreate new mTimer = new Timer(); } // schedule task mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(), 0, NOTIFY_INTERVAL); } class TimeDisplayTimerTask extends TimerTask { @Override public void run() { // run on another thread mHandler.post(new Runnable() { @Override public void run() { Log.d(TAG, "Its running"); String packageName = am.getRunningTasks(1).get(0).topActivity .getPackageName(); Toast.makeText(getBaseContext(), packageName, Toast.LENGTH_LONG).show(); Log.d(TAG, "Make Toast"); } }); } } }
tagged with: android
has answer: http://stackoverflow.com/a/24548243
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/38017549
tagged with: java
accepted answer: http://stackoverflow.com/a/24548317
upvote count: 1
has comment: http://stackoverflow.com/comment/38017589
has comment: http://stackoverflow.com/comment/38017503
downvote count: 1
linked to: http://stackoverflow.com/q/12498226
type: Question
has title: Show toast of the most recently opened application in android
has answer: http://stackoverflow.com/a/24548317
possible better answer: http://stackoverflow.com/a/24548243

http://stackoverflow.com/comment/37826316
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24445171
has text: Though I want to emphasize that I think these all count as data structures, and the asker's bewilderment is totally understandable and IMHO technically correct. If the interviewer had asked "without any other *classes*", that would make more sense.

http://stackoverflow.com/q/24525389
tagged with: netbeans
type: UnansweredQuestion
has body: i am a beginner in javafx and hence designing the form for desktop application in javafx. I am using netbeans. i have gone through some javafx tutorials. My problem is i am trying to embed my custom css to my javafx code and i am using SceneBuilder with netbeans. Now, the changes or the tags in my css is not reflecting the change in my UI. For ex: if it is background color- if i use .login{-fx-background-color: #368ee0;} in my css it works, but if i write .login{background-color: #368ee0;} it does not work. I don't know where am i doing wrong. Please help and i can provide some part of code or some file for your ref. if required.
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has answer: http://stackoverflow.com/a/24525897
type: Question
has title: Designing Form with css in javafx
answer count: 1
score: 0
tagged with: css

http://stackoverflow.com/comment/65791102
score: 2
comment on: http://stackoverflow.com/q/24471109
type: Comment
type: QuestionComment
has text: check this tutorial http://wiki.workassis.com/android-recyclerview-example/

http://stackoverflow.com/a/24515412
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24456886
type: Answer
upvote count: 2
has body: Ok so I did this in the end. I've basically used the ideas above but thought there was enough extra to post my own answer. It turns out you really shouldn't do this as other people suggested and I've added a bit at the bottom to say why! Here's my filter: public class FailOnErrorFilter implements Filter { @Override public void init(FilterConfig config) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { try { filterChain.doFilter(request, response); } catch (Exception exception) { System.exit(1); } } @Override public void destroy() { } } To get this working you have to modify the web.xml: failingFilter fullyQualified.FailOnErrorFilter true failingFilter /* The top one defines the filter + the second one says use it everywhere. ExtDirectSpring After doing the above I realised that ExtDirectSpring was a further culprit. It's default behaviour is to swallow all exceptions in server side methods. I was worried I was going to have to patch the library but thankfully someone else had already complained about this and it got fixed in 1.3.6. Initially I tried upgrading to the latest version but it broke a load of code! What a great library. Anyway 1.3.6 added in the ability to switch off the suppression of errors by doing the following: //this is to switch off blanket switching of exceptions in extdirect spring @Component public class NoExceptionHandling implements RouterExceptionHandler { @Override public Object handleException(MethodInfo methodInfo, BaseResponse baseResponse, Exception e, HttpServletRequest httpServletRequest) { throw new RuntimeException(e); } } As the name suggests extdirectspring uses spring and so doesn't make its dependencies obvious to calling code, however if you go digging (its on github). You'll see in RouterController it calls the following method in the catch private Object handleException(MethodInfo methodInfo, BaseResponse …

http://stackoverflow.com/comment/37903611
has text: You could try using `GridBagLayout` as I did, or start with an outer panel with `BorderLayout`, to which you add the logo, then an inner pane with a `BorderLayout` onto which you add everything else and put this at the `CENTER` of the outer panel
type: AnswerComment
comment on: http://stackoverflow.com/a/24481508
score: 0
type: Comment

http://stackoverflow.com/q/24541559
accepted answer: http://stackoverflow.com/a/24563157
has comment: http://stackoverflow.com/comment/38005513
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has body: I am trying to understand how it is possible to get sql error message from database during failed query through hibernate. my database has a table like this: TABLE applications ( id serial NOT NULL, name character varying(80) NOT NULL, CONSTRAINT applications_pkey PRIMARY KEY (id), CONSTRAINT applications_name_key UNIQUE (name) ) i try two times insert into this table row with same cell name value. Firs query already done, when second is queried i get only message from caught exception: could not execute statement that is too few, that should help me to find what is wrong? I want get information from database something like SQL Error. Duplicate column 'name' values Hibernate with HibernateException just cover true cause error. Anyone know how to avoid situation like this?
type: Question
has answer: http://stackoverflow.com/a/24563157
has title: How to determinate hibernate to return sql error
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38005948

http://stackoverflow.com/comment/37848049
type: Comment
type: QuestionComment
has text: Please post the whole class, I think you have missed an `extends`.
score: 0
comment on: http://stackoverflow.com/q/24457129

http://stackoverflow.com/a/28170853
has body: Try the trick below, it works for me every time: Select the project and go to Properties > Deployment Assembly Click on Add Select Java Build Path Entries If in there exists any Maven Dependencies, select all (Ctrl+A) and click Finish Clean and refresh your project Publish and try to start your server now, Hope this help, Best Regards,
has comment: http://stackoverflow.com/comment/126664941
answers question: http://stackoverflow.com/q/24580383
type: Answer
score: 0

http://stackoverflow.com/q/24587542
type: UnansweredQuestion
tagged with: eclipse-plugin
tagged with: keylogger
type: Question
has body: Does anyone know if it would be possible to create an eclipse plug-in that would log all your keystrokes (a keylistener/keylogger) in the editor and save this data to a text file? I would like to eventually analyse that data and provide useful information. I have never made a plug-in before so I was hoping someone with more experience could let me know if its possible. Cheers.
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24588683
tagged with: keylistener
tagged with: eclipse
has title: Creating Eclipse Keylogger Plugin?

http://stackoverflow.com/comment/37829350
type: Comment
type: QuestionComment
has text: Please edit your question if you want to include additional code.
comment on: http://stackoverflow.com/q/24446767
score: 0

http://stackoverflow.com/comment/37878543
comment on: http://stackoverflow.com/a/24473433
has text: Yes. But my explanation might be confusing.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24436311
answers question: http://stackoverflow.com/q/24436085
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24436085
has body: It really depends on how large you maps are. For small stuff, hardcoding is just fine, it finds its natural limits in the limits imposed by the class file format (max. size of initializer code). Any of the other methods you describe just use a more or less simple to read format and (abuse) a third party program (notepad, paint etc) as the "editor". Efficiency wise they aren't escpecially good or bad, consider that the overhead of using an ASCII file is relatively small (one byte per tile, in the worst case you only have 2 tiles, 7 bits wasted) or in case of PNG you even get free compression from the PNG format. Go with what fits your project best - if its complicated (many tiles, possibly multiple layers) and maps are large consider making your own editor (you should already have all the code for rendering in your game, just add a basic UI for editing...) to simplify editing. Store in any format you find practical, be it raw byte arrays or serialized objects. It won't matter in any normal sized project a single person can pull off.

http://stackoverflow.com/a/24557442
has comment: http://stackoverflow.com/comment/38037046
has body: You can iterate over your map with JSTL using foreach. &lt;c:forEach var="entry" items="${myList}"&gt; Key : &lt;c:out value="${entry.key}"/&gt; User : &lt;c:out value="${entry.value.user}"/&gt; Id : &lt;c:out value="${entry.value.id}"/&gt; Data : &lt;c:out value="${entry.value.data}"/&gt; &lt;/c:forEach&gt;
has comment: http://stackoverflow.com/comment/38037576
answers question: http://stackoverflow.com/q/24556976
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/38036485
score: 2
has comment: http://stackoverflow.com/comment/38040000
downvote count: 0
has comment: http://stackoverflow.com/comment/38037987
has comment: http://stackoverflow.com/comment/38040078
has comment: http://stackoverflow.com/comment/38037449

http://stackoverflow.com/comment/37863846
type: AnswerComment
has text: Both forms are incorrect. It should be the Fully Qualified Classname, which is `opennote.OpenNote`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24458545

http://stackoverflow.com/q/24463284
has comment: http://stackoverflow.com/comment/37860000
has title: How do I to make a sprite move using a timer in java?
score: 0
tagged with: timer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37859485
has answer: http://stackoverflow.com/a/24465566
has body: Well, I'm very(meaning just started a few months ago) new to Programming, I'm learning java. Anyway, How do I make a sprite move using a timer say: private Timer timer = new Timer(5000,this); and a Sprite like this: private JLabel player = new JLabel(new ImageIcon("Sprites/apple.png")); With a constructor like this: public timing() { Container c = getContentPane(); c.setLayout(null); setVisible(true); setSize(1280,720); player.setBounds(x,y,100,100); //Use this for moving! c.add(player); timer.start(); addKeyListener( new KeyAdapter(){ public void keyPressed(KeyEvent e){ String key = e.getKeyText(e.getKeyCode()); if(key.equals("Down")) { What Do I put Here? }}}); } So every second, the sprite player will move like x+=5 and y+=5 While I am using public void paint(Graphics g) { super.paint(g); player.setBounds(x,y,100,400); } (I'm very sorry for I'm just a kid learning JAVA)
has answer: http://stackoverflow.com/a/24463780
tagged with: java
tagged with: sprite
type: Question
has comment: http://stackoverflow.com/comment/37859488
answer count: 2

http://stackoverflow.com/a/24559217
downvote count: 0
answers question: http://stackoverflow.com/q/24559149
has body: Just write the Expression Language directly in your JavaScript code: $("#textBoxInp").keyup(function() { var userId = '${userId}'; }); Note that this won't work if the JavaScript code is placed in a external file and is invoked in the JSP. In this case, you may refer to one of the four ways that BalusC explain here: Mixing JSF EL in a Javascript file (he explains five, but one of them is JSF specific).
score: 12
type: AcceptedAnswer
upvote count: 12
type: Answer
accepted answer of: http://stackoverflow.com/q/24559149

http://stackoverflow.com/a/54446121
upvote count: 1
answers question: http://stackoverflow.com/q/24547673
downvote count: 0
has body: If you want to maintain a more consistent type list and avoid using null there's one kooky alternative. You can store the value using an intersection of types. Coupled with a lambda, this allows something like: private final Supplier&lt;Optional&lt;Integer&gt;&gt; suppValue; .... List&lt;Integer&gt; temp = value .map(v -&gt; v.map(Arrays::asList).orElseGet(ArrayList::new)) .orElse(null); this.suppValue = (Supplier&lt;Optional&lt;Integer&gt;&gt; &amp; Serializable)() -&gt; temp==null ? Optional.empty() : temp.stream().findFirst(); Having the temp variable separate avoids closing over the owner of the value member and thus serialising too much.
score: 1
type: Answer

http://stackoverflow.com/a/32633081
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/24430121
has comment: http://stackoverflow.com/comment/53711254
has body: I ported the Android-Iconics library, developed by Mike Penz, to FX. Updates will follow soon (docs, as well).. The showcase.jar will give you an overview of the icons. Usage (Java 1.8 required): FxIconicsLabel labelTextDefault = (FxIconicsLabel) new FxIconicsLabel.Builder(FxFontGoogleMaterial.Icons.gmd_folder_special) .size(24) .text("Right (default)") .color(MaterialColor.ORANGE_500) .build(); (or see DialogPlayGround.java) FxIconics on GitHub
has comment: http://stackoverflow.com/comment/53711577
score: 6
downvote count: 0

http://stackoverflow.com/comment/107619746
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24500045
score: 3
has text: Difference between `toDays` and `toDaysPart`? Documentation is the same. Is it just because for other units like hours and minutes it make sense to have both methods, so they also added two methods for days with the same effect?

http://stackoverflow.com/q/24464279
has comment: http://stackoverflow.com/comment/37867263
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37861635
has answer: http://stackoverflow.com/a/28632989
has comment: http://stackoverflow.com/comment/37861679
has comment: http://stackoverflow.com/comment/37862200
tagged with: java
has comment: http://stackoverflow.com/comment/37861321
tagged with: set
has comment: http://stackoverflow.com/comment/37871802
has comment: http://stackoverflow.com/comment/37861424
has answer: http://stackoverflow.com/a/24464361
score: 15
has answer: http://stackoverflow.com/a/24464308
has answer: http://stackoverflow.com/a/24466555
has comment: http://stackoverflow.com/comment/37861567
has comment: http://stackoverflow.com/comment/37863612
type: Question
has comment: http://stackoverflow.com/comment/37861929
has comment: http://stackoverflow.com/comment/37862123
has comment: http://stackoverflow.com/comment/37861786
downvote count: 1
answer count: 7
upvote count: 16
has answer: http://stackoverflow.com/a/24467730
has comment: http://stackoverflow.com/comment/37861823
favorite count: 0
has comment: http://stackoverflow.com/comment/37861299
has comment: http://stackoverflow.com/comment/37861338
has comment: http://stackoverflow.com/comment/37861867
has comment: http://stackoverflow.com/comment/37862010
has body: More specifically: how to get the nth element of a LinkedHashSet (which has a predictable iteration order)? I want to retrieve the nth element inserted into this Set (which wasn't already present). Is it better to use a List: List&lt;T&gt; list = new ArrayList&lt;T&gt;(mySet); T value = list.get(x); // x &lt; mySet.size() or the toArray(T [] a) method: T [] array = mySet.toArray(new T[mySet.size()]); T value = array[y]; // y &lt; mySet.size() Other than the (likely slight) performance differences, anything to watch out for? Any clear winner? Edit 1 NB: It doesn't matter why I want the last-inserted element, all that matters is that I want it. LinkedHashSet was specifically chosen because it "defines the iteration ordering, which is the order in which elements were inserted into the set (insertion-order). Note that insertion order is not affected if an element is re-inserted into the set." Edit 2 This question seems to have devolved into a discussion of whether any Set implementation can ever preserve original insertion order. So I put up some simple test code at http://pastebin.com/KZJ3ETx9 to show that yes, LinkedHashSet does indeed preserve insertion order (the same as its iteration order) as its Javadoc claims. Edit 3 Modified the description of the problem so that everybody isn't too focused on retrieving the last element of the Set (I originally thought that the title of the question would be enough of a hint &mdash; obviously I was wrong).
has comment: http://stackoverflow.com/comment/37861371
has comment: http://stackoverflow.com/comment/37862325
has comment: http://stackoverflow.com/comment/37861808
has title: How to get nth element of a LinkedHashSet
has comment: http://stackoverflow.com/comment/37861706
has comment: http://stackoverflow.com/comment/37861524
has answer: http://stackoverflow.com/a/76461751
has comment: http://stackoverflow.com/comment/37861457
tagged with: linkedhashset
has comment: http://stackoverflow.com/comment/37862299
has comment: http://stackoverflow.com/comment/37871575
has comment: http://stackoverflow.com/comment/37861518
has comment: http://stackoverflow.com/comment/37861827
has comment: http://stackoverflow.com/comment/37861575
has comment: http://stackoverflow.com/comment/37865286
tagged with: collections
has comment: http://stackoverflow.com/comment/37861553
accepted answer: http://stackoverflow.com/a/24466555
has answer: http://stackoverflow.com/a/45783816
possible better answer: http://stackoverflow.com/a/24467730
has comment: http://stackoverflow.com/comment/37861846

http://stackoverflow.com/q/24538001
has body: I'm trying to figure out how to use the JClouds-Chef library to configure VMs. According to their Installation Guide I can just create a pom.xml that looks like: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 <jclouds.version>1.7.3</jclouds.version> com.mycompany.app my-app 1.0-SNAPSHOT org.apache.jclouds jclouds-all ${jclouds.version} And run mvn dependency:copy-dependencies and it should pull down all the JARs that JClouds-Chef requires. So I did this, and then added all the JARs (there were a lot) to my project's buildpath. I then tried to create ChefContext instance (like their tutorials show examples of): ChefContext context = null; And Eclipse can't resolve/find the ChefContext class. After scanning the JARs that Maven downloaded, sure enough, ChefContext doesn't appear anywhere! So I ask: **what are the exact steps I need to get all the JARs that comprise JClouds-Chef and all of its dependencies?*
has title: Maven not pulling down correct JClouds-Chef dependency tree
answer count: 2
tagged with: pom.xml
tagged with: jclouds
has answer: http://stackoverflow.com/a/24625964
type: UnansweredQuestion
tagged with: maven
tagged with: chef-infra
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24539828

http://stackoverflow.com/comment/42634472
score: 1
comment on: http://stackoverflow.com/a/25510659
type: AnswerComment
type: Comment
has text: @vbullinger We have had problems with me and my colleague running the Alpha channel mode and a new colleague running a Stable channel mode (in the Xamarin Studio > Help > Check for Updates). We ended up changing to Stable and installing Android 5.0 API 21. But you may have to play with it. I know that the Android L Preview API shows as "20, L", but can sometimes to labelled 21 in the actual SDK folder, which will conflict with the Android 5.0 API 21.

http://stackoverflow.com/q/24451317
tagged with: connection-pooling
linked to: http://stackoverflow.com/q/24487033
answer count: 0
has comment: http://stackoverflow.com/comment/38250168
type: UnansweredQuestion
has body: I develop an web application using Spring MVC + MySQL. To manage JDBC connection I used c3p0 for connection pooling. If I am using c3p0, What I suppose if, 5 connections are open in pool and all 5 connections are in sleep mode and if I request getConnection() from java then one of them should be returned as Connection. Am I correct? If Yes Then consider following load testing scenario where I am getting Exception Connections could not be acquired from the underlying database!. Using Jmeter I started load test for 250 users in 15 seconds. I m continuously observing DB connections using SHOE FULL PROCESSLIST for first some minutes all is going well but as all the 250 users thrown to web server connections count is reached to 500 which is our maxPoolSize. So after this we are getting Connections could not be acquired from the underlying database!. At this point if I execute SHOE FULL PROCESSLIST then I can see all 500 connections are in sleep mode If I am correct in above statement that any open connection that is in sleep mode will be returned by c3p0. Then why I am getting this exception.? Here is my c3p0 properties MINPOOLSIZE=10 ACQUIREINCREMENT=1 MAXPOOLSIZE=500 INITIALPOOLSIZE=10 NUMBERHELPERTHREAD=100 MAXIDLETIME=10 MAXSTATEMENT=20 MAXSTATEMENTPERCONNECTION=5 IDLECONNECTIONTESTPERIOD=120 ACQUIRERETRYATTEMPT=10 ACQUIRERETRYDELAY=100 AUTOCOMMITONCLOSE=false BREAKAFTERACQUIREFAILURE=false TESTCONNECTIONONCHECKOUT=true TESTCONNECTIONONCHECKIN=true Update I found this warning before Connections could not be acquired from the underlying database! Exception WARN : 30 Jun 2014 10:40:12.078 com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1839) - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@e49561 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (10). Last acquisition…
has comment: http://stackoverflow.com/comment/37838867
has comment: http://stackoverflow.com/comment/37839509
has comment: http://stackoverflow.com/comment/37839613
has comment: http://stackoverflow.com/comment/37839234
has comment: http://stackoverflow.com/comment/37906829
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37837232
type: Question
has comment: http://stackoverflow.com/comment/37839294
has title: Why sleep mode connections are not reused by c3p0?
has comment: http://stackoverflow.com/comment/37988928
tagged with: c3p0
has comment: http://stackoverflow.com/comment/37839090
has comment: http://stackoverflow.com/comment/37898068
score: 0
has comment: http://stackoverflow.com/comment/37838611
has comment: http://stackoverflow.com/comment/37837997
has comment: http://stackoverflow.com/comment/37839581
has comment: http://stackoverflow.com/comment/37838807
has comment: http://stackoverflow.com/comment/37839689

http://stackoverflow.com/a/24461657
upvote count: 16
has body: Why are they different? They're not, really. They're the same bits. It's just that Java doesn't have unsigned bytes - so any byte with the top bit set is negative. In every case like that, you'll see that Java result = Go result - 256. If you convert both byte arrays to hex or base64, you'll see same results.
type: Answer
downvote count: 0
score: 16
has comment: http://stackoverflow.com/comment/37862617
accepted answer of: http://stackoverflow.com/q/24461629
answers question: http://stackoverflow.com/q/24461629
type: AcceptedAnswer

http://stackoverflow.com/a/24439658
has comment: http://stackoverflow.com/comment/37844719
has comment: http://stackoverflow.com/comment/37880611
accepted answer of: http://stackoverflow.com/q/24438361
answers question: http://stackoverflow.com/q/24438361
score: 0
has comment: http://stackoverflow.com/comment/37873262
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37841333
has body: String path = "D:" + File.pathSeparator + fileSearched + ".txt"; File f = new File(path); if(f.exists()) { //do your stuff } //I dont know why would you like to search them as a list but anyways File dir = new File("D:"); dir.mkdir(); for(String s : dir.list()){ if(s.equalsIgnoreCase(fileSearched)){ //do your stuff } } Here's the documentation for the java.io.File class
type: Answer
has comment: http://stackoverflow.com/comment/37842379

http://stackoverflow.com/comment/37945621
has text: @Pshemo potentially if the core of the software changes, but for the moment I am working on the assumption it will not. If it does, i'll come back and change it, but not now
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24509627

http://stackoverflow.com/comment/38016942
score: 1
has text: @StefanManciu Well not strictly the fault of the algorithm - the images *were* statistically correlated, they just weren't the same images! This can happen sometimes if the images are noisy - you might get a "better" result if you perform low-pass filtering on both images first, or apply a window function (e.g. a Hanning window) to the template image to avoid edge effects in the frequency domain.
type: AnswerComment
comment on: http://stackoverflow.com/a/24540162
type: Comment

http://stackoverflow.com/q/24450296
type: Question
has answer: http://stackoverflow.com/a/24450459
tagged with: java
possible better answer: http://stackoverflow.com/a/24450459
has answer: http://stackoverflow.com/a/24450452
accepted answer: http://stackoverflow.com/a/24450452
answer count: 2
has title: detect if a market:// link is clicked in a webview
score: 0
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10922762
has body: I try to execute some code after a link is clicked in a webview. For normal links like http:// I managed this using the shouldOverrideUrlLoading method and view.loadUrl(url); But with links starting with market:// to redirect to the GooglePlay App, this doesn't work. loadURL("market://") throws a URL not found error. How can I detect if a market:// link is clicked in a webview ? My Code: wvinfo.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.startsWith("http")) { view.loadUrl(url); // WORKS return true; } else if (url.startsWith("market:")){ &lt;DO SOMETHING SPECIAL&gt; view.loadUrl(url); // DOESN'T WORK return true; } } });
tagged with: webview

http://stackoverflow.com/comment/37860469
type: QuestionComment
comment on: http://stackoverflow.com/q/24451430
type: Comment
has text: check my answer here http://stackoverflow.com/questions/19094787/map-not-getting-in-emulator-android-api-v2/19317114#19317114
score: 0

http://stackoverflow.com/q/24466173
has answer: http://stackoverflow.com/a/24466209
accepted answer: http://stackoverflow.com/a/24466209
answer count: 3
tagged with: string
favorite count: 0
tagged with: return
downvote count: 2
has title: returning ArrayList to String
has answer: http://stackoverflow.com/a/24466325
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24466325
has comment: http://stackoverflow.com/comment/37864754
score: -1
has body: I've manage to put ArrayList values into a String, when I printout the String in the console, everything works fine, it gets all the info, but when I return the String, it only displays the last element. e.g. There are 3 garages in the String BMW Garages Mercedes Garages Toyta Garages When I return it, it displays only the last one: Toyta Garages Here is the code that I am working with: private String arrayListToString() { NepGarazasCtr garCtr = new NepGarazasCtr(); ArrayList&lt;NepGarazas&gt; gautGar = garCtr.gautVisusGarazus(); String nepGar = ""; for(NepGarazas npGar: gautGar) { nepGar = npGar.getGarazoPav(); System.out.println(nepGar); //System.out.println(Arrays.toString(nepGar)); } return nepGar; } And this is where I put it: String[] array = { arrayListToString() }; So my question would be: How to return the whole String, not just the last element? Or it is not possible? I want to put the String in the JComboBox. Thank you.
has answer: http://stackoverflow.com/a/24466291
tagged with: arraylist

http://stackoverflow.com/comment/37816727
type: Comment
comment on: http://stackoverflow.com/a/24439898
has text: Indeed, it is important to realize that while anonymous sub-classes create a 'feel' of instance-level overriding, they don't really do that. Calling getClass() on the instance reveals a different class name!
score: 4
type: AnswerComment

http://stackoverflow.com/q/24460197
type: Question
answer count: 2
downvote count: 0
has title: Accessing Books API through AppEngine fails with error code 400
has answer: http://stackoverflow.com/a/24504130
favorite count: 0
tagged with: google-books
has body: I'm getting following error when accessing Google Books APIs from Google AppEngine Application. API key for server application is used. But if you run application locally in eclipse there is no problem. { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Cannot determine user location for geographically restricted operation.", "reason" : "unknownLocation" } ], "message" : "Cannot determine user location for geographically restricted operation." } There is not enough information on this error scenario. Any help is appreciated. Thanks.
tagged with: google-app-engine
possible better answer: http://stackoverflow.com/a/24460642
has answer: http://stackoverflow.com/a/24460642
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/24504130
upvote count: 1

http://stackoverflow.com/comment/37880824
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24465005
has text: @pctr Of course I can access content of an iframe, or whatever part of html (source page).

http://stackoverflow.com/a/24482073
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37895285
upvote count: 1
answers question: http://stackoverflow.com/q/24481929
has body: While exporting you can chose the File->Export->Runnable Jar Option . Then use the selection like below screen i.e Extract required libraries into generated jar
downvote count: 0
has comment: http://stackoverflow.com/comment/37895503

http://stackoverflow.com/q/24484118
tagged with: java
has title: hashing password using md5 and a control field
downvote count: 1
upvote count: 0
has body: I want to hash a password using MD5 and I have given a string named MD5ControlHash I found that I can hash a password in this way: public static void main(String[] args)throws Exception { String password = "123456"; MessageDigest md = MessageDigest.getInstance("MD5"); md.update(password.getBytes()); byte byteData[] = md.digest(); //convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i &lt; byteData.length; i++) { sb.append(Integer.toString((byteData[i] &amp; 0xff) + 0x100, 16).substring(1)); } System.out.println("Digest(in hex format):: " + sb.toString()); } However I don't know where should I use MD5ContolHash. Can anyone help me? Does this code work correctly? Thanks
has answer: http://stackoverflow.com/a/24484233
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37899010
score: -1
favorite count: 0
type: Question
tagged with: md5
tagged with: android
answer count: 1

junit
tags question: http://stackoverflow.com/q/24553068
type: Tag
tags question: http://stackoverflow.com/q/24447897
tags question: http://stackoverflow.com/q/24445391
tags question: http://stackoverflow.com/q/24507959
tags question: http://stackoverflow.com/q/24461687
tags question: http://stackoverflow.com/q/24568488
tags question: http://stackoverflow.com/q/24586549
tags question: http://stackoverflow.com/q/24431427
tags question: http://stackoverflow.com/q/24540683
tags question: http://stackoverflow.com/q/24513421
tags question: http://stackoverflow.com/q/24492365
tags question: http://stackoverflow.com/q/24444105
tags question: http://stackoverflow.com/q/24493838
tags question: http://stackoverflow.com/q/24537074
tags question: http://stackoverflow.com/q/24433270
tags question: http://stackoverflow.com/q/24427685
tags question: http://stackoverflow.com/q/24509754
tags question: http://stackoverflow.com/q/24559871
tag name: junit
tags question: http://stackoverflow.com/q/24439944
tags question: http://stackoverflow.com/q/24501308
tags question: http://stackoverflow.com/q/24435275
tags question: http://stackoverflow.com/q/24448366
tags question: http://stackoverflow.com/q/24487146
tags question: http://stackoverflow.com/q/24572550
tags question: http://stackoverflow.com/q/24491905
tags question: http://stackoverflow.com/q/24574648
tags question: http://stackoverflow.com/q/24568972
tags question: http://stackoverflow.com/q/24431148
tags question: http://stackoverflow.com/q/24490214
tags question: http://stackoverflow.com/q/24540951
tags question: http://stackoverflow.com/q/24446979
tags question: http://stackoverflow.com/q/24460360
tags question: http://stackoverflow.com/q/24575016
tags question: http://stackoverflow.com/q/24431889
tags question: http://stackoverflow.com/q/24441682
tags question: http://stackoverflow.com/q/24566104
tags question: http://stackoverflow.com/q/24454287
tags question: http://stackoverflow.com/q/24451563
tags question: http://stackoverflow.com/q/24512829
tags question: http://stackoverflow.com/q/24510742
tags question: http://stackoverflow.com/q/24516832
tags question: http://stackoverflow.com/q/24491397
tags question: http://stackoverflow.com/q/24551728
tags question: http://stackoverflow.com/q/24487153
tags question: http://stackoverflow.com/q/24463342
tags question: http://stackoverflow.com/q/24533208

http://stackoverflow.com/comment/37850035
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24458204
score: 0
has text: At first glance, it seems that the size of the `s1nInt` array is less than 2.

http://stackoverflow.com/comment/37993820
has text: yes, it shouldnt be very hard
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24454760
score: 1

http://stackoverflow.com/comment/37940837
type: AnswerComment
score: 0
type: Comment
has text: From App3, where you want to go? App1 or App2? This line `Intent intent = new Intent(App3Activity.this, App3Activity.class)` is wrong. Please check my answer. First parameter should be App2Activity
comment on: http://stackoverflow.com/a/24506151

eclipse
tags question: http://stackoverflow.com/q/24549944
tags question: http://stackoverflow.com/q/24574036
tags question: http://stackoverflow.com/q/24511684
tag name: eclipse
tags question: http://stackoverflow.com/q/24483233
tags question: http://stackoverflow.com/q/24564763
tags question: http://stackoverflow.com/q/24495023
tags question: http://stackoverflow.com/q/24441234
tags question: http://stackoverflow.com/q/24445855
tags question: http://stackoverflow.com/q/24557794
tags question: http://stackoverflow.com/q/24429232
tags question: http://stackoverflow.com/q/24461510
tags question: http://stackoverflow.com/q/24472935
tags question: http://stackoverflow.com/q/24504383
tags question: http://stackoverflow.com/q/24575637
tags question: http://stackoverflow.com/q/24563783
tags question: http://stackoverflow.com/q/24529834
tags question: http://stackoverflow.com/q/24444409
tags question: http://stackoverflow.com/q/24488075
tags question: http://stackoverflow.com/q/24507629
tags question: http://stackoverflow.com/q/24469444
tags question: http://stackoverflow.com/q/24503245
tags question: http://stackoverflow.com/q/24573504
tags question: http://stackoverflow.com/q/24577811
tags question: http://stackoverflow.com/q/24448372
tags question: http://stackoverflow.com/q/24458761
tags question: http://stackoverflow.com/q/24431445
tags question: http://stackoverflow.com/q/24528515
tags question: http://stackoverflow.com/q/24515208
tags question: http://stackoverflow.com/q/24498609
tags question: http://stackoverflow.com/q/24435791
tags question: http://stackoverflow.com/q/24459401
tags question: http://stackoverflow.com/q/24511197
tags question: http://stackoverflow.com/q/24468059
tags question: http://stackoverflow.com/q/24545699
tags question: http://stackoverflow.com/q/24570992
tags question: http://stackoverflow.com/q/24437351
tags question: http://stackoverflow.com/q/24474456
tags question: http://stackoverflow.com/q/24542005
tags question: http://stackoverflow.com/q/24449987
tags question: http://stackoverflow.com/q/24578034
tags question: http://stackoverflow.com/q/24491995
tags question: http://stackoverflow.com/q/24458873
tags question: http://stackoverflow.com/q/24472541
tags question: http://stackoverflow.com/q/24449406
tags question: http://stackoverflow.com/q/24503909
tags question: http://stackoverflow.com/q/24507104
tags question: http://stackoverflow.com/q/24553928
tags question: http://stackoverflow.com/q/24537074
tags question: http://stackoverflow.com/q/24549806
tags question: http://stackoverflow.com/q/24494074
tags question: http://stackoverflow.com/q/24469819
tags question: http://stackoverflow.com/q/24519063
tags question: http://stackoverflow.com/q/24569752
tags question: http://stackoverflow.com/q/24538894
tags question: http://stackoverflow.com/q/24569403
tags question: http://stackoverflow.com/q/24478186
tags question: http://stackoverflow.com/q/24582733
tags question: http://stackoverflow.com/q/24550234
tags question: http://stackoverflow.com/q/24565051
tags question: http://stackoverflow.com/q/24526296
tags question: http://stackoverflow.com/q/24478821
tags question: http://stackoverflow.com/q/24543529
tags question: http://stackoverflow.com/q/24533279
tags question: http://stackoverflow.com/q/24450929
tags question: http://stackoverflow.com/q/24532133
tags question: http://stackoverflow.com/q/24501042
tags question: http://stackoverflow.com/q/24521995
tags question: http://stackoverflow.com/q/24530251
tags question: http://stackoverflow.com/q/24491060
tags question: http://stackoverflow.com/q/24470596
tags question: http://stackoverflow.com/q/24575902
tags question: http://stackoverflow.com/q/24488584
tags question: http://stackoverflow.com/q/24585468
tags question: http://stackoverflow.com/q/24547213
tags question: http://stackoverflow.com/q/24533169
tags question: http://stackoverflow.com/q/24506774
tags question: http://stackoverflow.com/q/24430809
tags question: http://stackoverflow.com/q/24482259
tags question: http://stackoverflow.com/q/24499942

http://stackoverflow.com/a/24548217
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24548102
has body: Try to increase memory for your project - In Eclipse - Right click your project > Run As > Run Configurations > Argument tab > under VM arguments section > add -Xms512M -Xmx1024M or > Apply
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24548102
score: 2
has comment: http://stackoverflow.com/comment/38017553

http://stackoverflow.com/a/24524016
upvote count: 1
has body: Try this: Parse the hours by yourself (using substring from index 0 to first ":". Run above code (your code) Set the hours in object "date" to the number you parsed.
answers question: http://stackoverflow.com/q/24523627
downvote count: 0
has comment: http://stackoverflow.com/comment/37972106
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37972181
has comment: http://stackoverflow.com/comment/37972157

http://stackoverflow.com/comment/38024308
type: AnswerComment
comment on: http://stackoverflow.com/a/24551112
type: Comment
has text: Sorry I don't understand what you mean @FatihYakut, by running reduce, you'll end up with one `Rating` not an RDD with 1 `Rating`. Also what even is `Rating`? I don't know what the `union` method does. Provide more code, be more specific, clarify the problem and maybe someone can help.
score: 0

http://stackoverflow.com/q/24437847
has title: How to make a basic plugin system / modloader?
tagged with: java
has comment: http://stackoverflow.com/comment/37813139
type: Question
has comment: http://stackoverflow.com/comment/37821877
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24438663
has comment: http://stackoverflow.com/comment/37813907
has answer: http://stackoverflow.com/a/24438270
has body: So I'm trying to make a plugin system like the "Bukkit" plugin system. See right now on my project I have some classes extending my base class "Plugin" and then I add them to my list. How would I make it so I can make it so it automatically loads jars from a "mods" folder that are extending my "Plugin" class and automatically add them to the arraylist? Thank you VERY much for the help, I'm trying to make a mod loader.
has comment: http://stackoverflow.com/comment/37812838
tagged with: loader
type: UnansweredQuestion
tagged with: plugins

http://stackoverflow.com/comment/37901912
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24485605
has text: Try a text editor :-). Seriously dude, what you do is read what I wrote, and then read the javadocs for URLConnection and HttpURLConnection, then think, work out what the correct code should be and write / test it. We are not here to correct your code for you. That's *your* job ...

http://stackoverflow.com/a/24466039
has body: I had to add another property in my static block and that worked for me: props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
score: 0
has comment: http://stackoverflow.com/comment/37877020
type: Answer
answers question: http://stackoverflow.com/q/24465235
has comment: http://stackoverflow.com/comment/37871671

http://stackoverflow.com/a/24533715
has comment: http://stackoverflow.com/comment/38002049
has body: Maybe this is a universal solution to your problem: if (myString.contains(System.getProperty("line.separator"))) { //your code here } It uses the system properties to find the line separator used on the user's system.
score: -1
upvote count: 2
answers question: http://stackoverflow.com/q/24532489
has comment: http://stackoverflow.com/comment/37997031
has comment: http://stackoverflow.com/comment/37991937
type: Answer
has comment: http://stackoverflow.com/comment/37990245
downvote count: 3

http://stackoverflow.com/a/24578699
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24566687
upvote count: 3
has body: So it seems I missed to add this repositories { jcenter() mavenLocal() // Missed this } In the project (not the module) build.gradle file so it searchees in the local cache repo. What seems funny is then why it detected the classes within "classes.jar" but not in the other jars within "libs" folder of my AAR file. Interesting...

http://stackoverflow.com/q/24452509
answer count: 1
has comment: http://stackoverflow.com/comment/48739965
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/34129846
has comment: http://stackoverflow.com/comment/48823436
tagged with: android
linked to: http://stackoverflow.com/q/19001644
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/48750021
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/48733336
has title: how to have multiple application classes in separated jars in one application in android
tagged with: jar
has comment: http://stackoverflow.com/comment/37840301
has comment: http://stackoverflow.com/comment/37851854
score: 4
has comment: http://stackoverflow.com/comment/37841169
has comment: http://stackoverflow.com/comment/37842404
has body: I have a Appp class that extend from Application and call Appp in manifest. There is two another jar, that each author said call them in manifest as Application tag. According to how to handle multiple application classes in android question, to have multiple application classes that extend from Application, we should extend some application class from another application class, and call upper class in manifest. But in my case, i don't have sources, and just have jars. what can i do?!
has comment: http://stackoverflow.com/comment/48821046
has answer: http://stackoverflow.com/a/34129846

http://stackoverflow.com/q/24496642
has comment: http://stackoverflow.com/comment/37925262
downvote count: 0
answer count: 1
tagged with: antialiasing
has title: Howto force Java text antialiasing on?
favorite count: 0
has body: Running Xilinx Vivado FPGA design tool in Kubuntu 14.04 it uses antialiased fonts pnly in some parts of the UI making it even hard to use, not to say ugly looking. Others seem to have same issue. As it seems to be written at least partially in Java, I tried the suggested solutions found after some googling export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dsun.java2d.xrender=true" without any visual effect. A small test program below made it obvious that unless the font rendering hints are explicitly set (but not to RenderingHints.KEY_TEXT_ANTIALIASING) you will get non-antialiased text. This happens in both OpenJDK and Oracle JDK. import java.awt.*; import java.awt.event.*; // partially taken from http://stackoverflow.com/questions/2018102/java-font-rendering public class AwtAA extends Panel { private final Font font = new Font(Font.SANS_SERIF, Font.BOLD, 16); private final int line = 24; private final int medskip = 16; AwtAA() { setBackground(SystemColor.control); } public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; int py = 0; py = paintText(g2d, py, null, null); py += medskip; py = paintText(g2d, py, null, RenderingHints.VALUE_ANTIALIAS_DEFAULT); py = paintText(g2d, py, null, RenderingHints.VALUE_ANTIALIAS_ON); py += medskip; py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT, null); py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, null); py += medskip; py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT, RenderingHints.VALUE_ANTIALIAS_DEFAULT); py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, RenderingHints.VALUE_ANTIALIAS_DEFAULT); py += medskip; py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT, RenderingHints.VALUE_ANTIALIAS_ON); py = paintText(g2d, py, RenderingHints.VALUE_TEXT_ANTIALIAS_ON, RenderingHints.VALUE_ANTIALIAS_ON); } private int paintText(Graphics2D g2d, int py, Object text, Object aa) { Graphics2D dgc = g2d; Image img = null; …
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37954806
linked to: http://stackoverflow.com/q/2018102
tagged with: fonts
score: 7
tagged with: java
upvote count: 7
type: Question
tagged with: awt
has answer: http://stackoverflow.com/a/25341106

http://stackoverflow.com/comment/37888089
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24472730
has text: Thanks all works now didn't have it setup properly I would vote you up but don't have the rep yet:P

http://stackoverflow.com/q/24541206
has body: I am trying to setup Vibur DBCP to work against an Oracle 11g DB instance but I keep getting an Oracle exception. This is the URL = jdbc:oracle:thin:@//db.vonagenetworks.net/MY_SERVICE This URL works when I use it with our Tomcat Connection Pool. I get the following error…. org.vibur.dbcp.ViburDBCPException: java.sql.SQLException: Listener refused the connection with the following error: ORA-12516, TNS:listener could not find available handler with matching protocol stack at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:114) ~[vibur-dbcp-1.1.1.jar:?] at org.vibur.dbcp.pool.ConnectionFactory.create(ConnectionFactory.java:53) ~[vibur-dbcp-1.1.1.jar:?] at org.vibur.objectpool.ConcurrentLinkedPool.create(ConcurrentLinkedPool.java:119) ~[vibur-object-pool-2.0.0.jar:?] at org.vibur.objectpool.ConcurrentLinkedPool.&lt;init&gt;(ConcurrentLinkedPool.java:110) ~[vibur-object-pool-2.0.0.jar:?] at org.vibur.dbcp.pool.PoolOperations.&lt;init&gt;(PoolOperations.java:73) ~[vibur-dbcp-1.1.1.jar:?] at org.vibur.dbcp.ViburDBCPDataSource.start(ViburDBCPDataSource.java:196) ~[vibur-dbcp-1.1.1.jar:?] at contactmanager.dao.DataSourceInitializer.initializeDataSources(DataSourceInitializer.java:96) [DataSourceInitializer.class:?] at contactmanager.dao.DataSourceInitializer.init(DataSourceInitializer.java:49) [DataSourceInitializer.class:?] at javax.servlet.GenericServlet.init(GenericServlet.java:160) [servlet-api.jar:3.0.FR] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) [catalina.jar:7.0.47] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) [catalina.jar:7.0.47] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) [catalina.jar:7.0.47] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176) [catalina.jar:7.0.47] at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460) [catalina.jar:7.0.47] at org.apache.catalina.util.Lif…
downvote count: 0
accepted answer: http://stackoverflow.com/a/24542204
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: oracle11g
has title: Getting error while connecting Vibur DBCP to Oracle DB
type: Question
has answer: http://stackoverflow.com/a/24542204
tagged with: jdbc-pool
answer count: 1

http://stackoverflow.com/q/24495100
type: Question
tagged with: jakarta-ee
has title: Confused with private constructor
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24495244
has body: Studied in java that if a class have private constructor it cannot be inherited as super(), cannot be called,than why this code compiles, in case of inner class: public class TestMe2 { class Singleton { private Singleton() { } } class BB extends Singleton { } public void callMe(){ Singleton sing=new BB(); } }
has answer: http://stackoverflow.com/a/24495242
linked to: http://stackoverflow.com/q/663059
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37919503
has answer: http://stackoverflow.com/a/24495207
linked to: http://stackoverflow.com/q/5360851
tagged with: java

http://stackoverflow.com/q/24541325
upvote count: 4
has answer: http://stackoverflow.com/a/24543687
linked to: http://stackoverflow.com/q/1069066
has comment: http://stackoverflow.com/comment/38007112
tagged with: backtrace
has comment: http://stackoverflow.com/comment/38009308
has comment: http://stackoverflow.com/comment/38009892
tagged with: stack-trace
downvote count: 1
has body: I am trying to get the stack trace of the underlying C code that is called from the android Java app code and tried using dumpStack() and printStackTrace() without any success. Just was curious is there a difference between the two if any? Also is there a way to print a stack trace of the underlying C code the uses JNI to call the java functions on the android side?
has comment: http://stackoverflow.com/comment/38045931
tagged with: debugging
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/38005452
has title: Difference between dumpstack() and printStackTrace()
tagged with: java
has comment: http://stackoverflow.com/comment/38009685
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24544373
favorite count: 0
accepted answer: http://stackoverflow.com/a/24543687
has answer: http://stackoverflow.com/a/24544373
has comment: http://stackoverflow.com/comment/38010176
tagged with: android

http://stackoverflow.com/a/57643432
answers question: http://stackoverflow.com/q/24520602
has body: just updated the springboot version to 2.1.3 and it worked of me
score: 0
type: Answer

http://stackoverflow.com/comment/37951047
comment on: http://stackoverflow.com/q/24512662
has text: I've updated my post, you can see there full logcat. I do get a NPE.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37873275
score: 0
type: AnswerComment
has text: Thank you. Your edit 2 solved my problem. I just added return counter after each recursion statement
type: Comment
comment on: http://stackoverflow.com/a/24470456

http://stackoverflow.com/a/24449389
has comment: http://stackoverflow.com/comment/37833438
has comment: http://stackoverflow.com/comment/37836349
has comment: http://stackoverflow.com/comment/37833455
score: 0
has comment: http://stackoverflow.com/comment/37833991
answers question: http://stackoverflow.com/q/24448599
has body: You can use image scaling mechanism. Don't try to download every time. If once its downloaded then store into cache memory.
type: Answer

http://stackoverflow.com/a/24538010
answers question: http://stackoverflow.com/q/24537871
score: 0
has comment: http://stackoverflow.com/comment/37999903
has comment: http://stackoverflow.com/comment/38003637
type: Answer
has body: Make the findDistance method take two Positions as parameters double findDistance(Position buoypos, Position vehiclepos){ }

http://stackoverflow.com/comment/38059833
type: QuestionComment
has text: Post the bean definitions for `authorityBridgeTableCache` and `tenantService`. Looks some property needed for the beans cannot be resolved.
score: 0
comment on: http://stackoverflow.com/q/24570768
type: Comment

http://stackoverflow.com/comment/37847595
has text: thanks, i think that the design of the dto is bad, and your answer confirm it.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24456504

http://stackoverflow.com/comment/38031161
has text: @user3801948 Locking or immutability
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24555677

http://stackoverflow.com/q/24486638
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37903580
type: Question
has comment: http://stackoverflow.com/comment/37908241
tagged with: criteria
has title: Hibernate Criteria Pagination Error
score: 0
has comment: http://stackoverflow.com/comment/37907583
has comment: http://stackoverflow.com/comment/37907750
has comment: http://stackoverflow.com/comment/37907634
has comment: http://stackoverflow.com/comment/37903570
tagged with: sql-server-2008
has comment: http://stackoverflow.com/comment/37907237
type: UnansweredQuestion
has body: In the below code, I am able to retrieve all the desired data without any problem. List&lt;Message&gt; msgList = new ArrayList&lt;Message&gt;(); Criteria crit = sessionFactory.getCurrentSession().createCriteria(Message.class); crit.createAlias("processes", "process"); crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); Criterion c1; Criterion c2; Criterion c3; Criterion c4; Criterion c5; Criterion c6; Criterion c7; c1 = Restrictions.like("process.initiator", user.getUserOid()+"%"); c2 = Restrictions.like("process.firstApprover", user.getUserOid()+"%"); c3 = Restrictions.like("process.secondApprover", user.getUserOid()+"%"); c4 = Restrictions.like("process.thirdApprover", user.getUserOid()+"%"); c5 = Restrictions.like("process.finalizedBy", user.getUserOid()+"%"); c6 = Restrictions.or(Restrictions.eq("process.isFinalized", false), Restrictions.isNull("process.isFinalized")); c7 = Restrictions.eq("account.oid", acountId); crit.add(Restrictions.and(Restrictions.and(Restrictions.or(Restrictions.or(Restrictions.or(Restrictions.or(c1, c2), c3), c4), c5), c6),c7)); crit.addOrder(Order.desc("latestDate")); //crit.setFirstResult(first); //crit.setMaxResults(max); msgList = crit.list(); However, I cannot add pagination to the above data retrieval. When I uncomment the above firstResult and maxResult I encounter the following error: Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '.'. Below is the generated SQL: WITH query AS (select this_.oid as oid24_24_, this_.arsivmi as arsivmi24_24_, this_.arsivzamani as arsivzam3_24_24_, this_.baslik as baslik24_24_, this_.durum as durum24_24_, this_.gonderitipi as gonderit6_24_24_, this_.gonderilmezamani as gonderil7_24_24_, this_.gondermedelil_oid as gonderm22_24_24_, this_.hesap_oid as hesap23_24_24_, this_.hsgondermezamani as hsgonder8_24_24_, this_.ilgilikopya as ilgiliko9_24_24_, this_.kimden as kimden24_24_, this_.kime as kime24_24_, this_.mesajbody as mesajbody24_24_, this_.mesajboyut as me…

http://stackoverflow.com/comment/37947337
has text: Pshemo if this cannot be done via regex then I am open for anything else.
comment on: http://stackoverflow.com/q/24510420
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/82466028
has text: Downside is: you need to do that for any bean/pojo that uses optionals. But still, nice idea.
comment on: http://stackoverflow.com/a/24559389
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24555687
has answer: http://stackoverflow.com/a/24555816
type: Question
score: 3
has answer: http://stackoverflow.com/a/24556139
has comment: http://stackoverflow.com/comment/38032263
favorite count: 0
has body: Is there a method in java which round up double to Long in java? eg. double d=2394867326.23; I need to round this up to 2394867327. The result is not an integer, so I think cannot use Math.ceil. Do we have a method in java which return the Long instead of int?
tagged with: double
answer count: 2
has title: Round up double to long in Java
has comment: http://stackoverflow.com/comment/38032327
tagged with: rounding
has comment: http://stackoverflow.com/comment/38031407
tagged with: java
downvote count: 1
upvote count: 4
linked to: http://stackoverflow.com/q/321549
tagged with: long-integer
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/321549

http://stackoverflow.com/comment/38043882
type: Comment
has text: Good point. However, the loop could be re-worked such that it incrementally adds up to r. They were very specific that they couldnt use drawLine(), so my guess is it needs to be incremental
comment on: http://stackoverflow.com/a/24562160
type: AnswerComment
score: 0

http://stackoverflow.com/a/24461118
downvote count: 1
has body: If the path is valid, then at least one of the chain of parent files must exist. If no parent exists, then it must be invalid. public static boolean isValidPath(File file) throws IOException { file = file.getCanonicalFile(); while (file != null) { if (file.exists()) { return true; } file = file.getParentFile(); } return false; } System.out.println(isValidPath(new File("/Users/something"))); // true (OS X) System.out.println(isValidPath(new File("asfq34fawrf"))); // false
type: Answer
has comment: http://stackoverflow.com/comment/37855751
has comment: http://stackoverflow.com/comment/37855577
has comment: http://stackoverflow.com/comment/37855422
answers question: http://stackoverflow.com/q/24460982
score: 0
has comment: http://stackoverflow.com/comment/37855626
upvote count: 1

http://stackoverflow.com/q/24453858
has comment: http://stackoverflow.com/comment/37842021
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37842433
has comment: http://stackoverflow.com/comment/37945336
type: Question
has title: @Autowired can't find repository beans
tagged with: jpa
linked to: http://stackoverflow.com/q/13704572
has comment: http://stackoverflow.com/comment/37842685
has comment: http://stackoverflow.com/comment/37842548
has body: I'am a bit confused about Spring Data JPA repositories used in an "Annotation only" context. When starting a tomcat server on which I am deploying the application, I get the following Error: Grave: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dashboard]] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'archivingService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.dashboard.persistence.repository.RequestsRepository com.mycompany.dashboard.core.services.archiving.ArchivingServiceImplJPA.requestsRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.mycompany.dashboard.persistence.repository.RequestsRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.mycompany.dashboard.persistence.repository.RequestsRepository com.mycompany.dashboard.core.services.archiving.ArchivingServiceImplJPA.requestsRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.mycompany.dashboard.persistence.repository.RequestsRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.mycompany.dashboard.persistence.repository.RequestsRepository…
has comment: http://stackoverflow.com/comment/37842453
upvote count: 1
has comment: http://stackoverflow.com/comment/37946023
answer count: 1
has answer: http://stackoverflow.com/a/24510101
has comment: http://stackoverflow.com/comment/37842514
accepted answer: http://stackoverflow.com/a/24510101
tagged with: repository
favorite count: 0
tagged with: spring

http://stackoverflow.com/q/24518202
has body: I know that log4j2 is for logging information. I'm really confused about the log4jdbc appender. What does it actually do? I read the tutorials but I really don't understand it. Does it log the informations as you insert data into database via jdbc?? or does log4j2 logger actually ABLE to log into database? Regular jdbc can do things like: String query ="INSERT INTO 'table' ('blah' ..."; Statement st; st.executeUpdate(query); does log4j async logger actually have something equivalent to --> [st.executeUpdate(query);] which insert data a lot faster?? Thank you for your effort!!!
score: 0
answer count: 1
has title: Does log4j2 async logger actually insert data into MySQL?
accepted answer: http://stackoverflow.com/a/24518445
tagged with: jdbc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24518445
tagged with: java
tagged with: mysql
tagged with: log4j2
type: Question
tagged with: database

http://stackoverflow.com/comment/38074923
comment on: http://stackoverflow.com/q/24574456
type: Comment
score: 0
has text: It's not clear where you're stuck: accessing the database? creating the notification?
type: QuestionComment

http://stackoverflow.com/a/24599980
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24587720
type: Answer
accepted answer of: http://stackoverflow.com/q/24587720
has body: Finally fixed this frustrating problem. Used Google Chrome's "Inspect Element" feature to see exactly what was posted to the website when you click the button after checking/unchecking all checkboxes. Saw there was some extra data there that I wasn't posting, namely my username and other random information. Added that to my postData using a BasicNameValuePair, and it worked.

http://stackoverflow.com/comment/38034337
score: 0
has text: There was a problem in Boot 1.1.3 with the embedded servlet container being packaged in the wrong place in an executable jar: https://github.com/spring-projects/spring-boot/issues/1187. It's worth trying a 1.1.4 snapshot to eliminate that as a cause of your problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24538854

http://stackoverflow.com/comment/38015321
has text: Did you check [How to create splash screen in java](http://docs.oracle.com/javase/tutorial/uiswing/misc/splashscreen.html) ?
score: 2
type: Comment
comment on: http://stackoverflow.com/q/24546847
type: QuestionComment

http://stackoverflow.com/comment/37820173
type: QuestionComment
comment on: http://stackoverflow.com/q/24441868
has text: I don't. I'm just starting on Java @SamIam
score: 0
type: Comment

http://stackoverflow.com/q/24505355
type: UnansweredQuestion
has title: How to figure out what stored proceedure is being called through a executable file in MSSQL
tagged with: stored-procedures
has answer: http://stackoverflow.com/a/24521806
tagged with: java
has comment: http://stackoverflow.com/comment/37938939
type: Question
tagged with: dts
tagged with: sql-server
score: 0
has body: I'm a newbie into Java. And currrently i'm working on an enhancement project. I'm struck at a point in my analysis. I gotta figure out how the stored procs are being called and what all parameters are being passed. As of now I know that a process is executing an executable from a directory on the server. This executable Might(not sure- Assuming) be calling the stored proc. My doubt is how do I figure what this executable is doing? Process proc = Runtime.getRuntime().exec(exeString); exeString has the path where my Executable file resides. Not sure if the name of the executable holds any significance here, anyway its "SqlDMOCall".Along with the executable, there is a DLL file. I tried Decompiling it through ILSPY only to fail. Please let me know if any other information is needed.
answer count: 1

http://stackoverflow.com/q/24525174
tagged with: android-activity
has comment: http://stackoverflow.com/comment/37974634
tagged with: cordova
type: UnansweredQuestion
tagged with: android
has body: I want a way to update the html file after a function is called. public class MainActivity extends /* Activity */DroidGap { private Object request; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); appView.addJavascriptInterface(this, "MainActivity"); super.loadUrl("file:///android_asset/www/index.html"); } public void XXX(Dialog source, File file) { source.hide(); String filePath = file.getAbsolutePath(); String html_tag = " "; appView.loadData("javascript:appendText("+html_tag+")", "text/html", "utf-8"); } } This is a sample code but what happens is that I loose the entire data from index.html page. How do I append additional html content to the existing html page. I am developing this app using phonegap. Additional info: activity_main.xml file code is pasted below:
answer count: 0
tagged with: java
type: Question
tagged with: android-layout
has title: Append html content to html file in Android
has comment: http://stackoverflow.com/comment/37974295
score: 0
has comment: http://stackoverflow.com/comment/37974188

http://stackoverflow.com/q/24556259
accepted answer: http://stackoverflow.com/a/24557378
tagged with: email
favorite count: 0
tagged with: android
downvote count: 2
upvote count: 1
has title: Android send email
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24557378
tagged with: java
possible better answer: http://stackoverflow.com/a/24556379
linked to: http://stackoverflow.com/q/2020088
type: Question
has body: I try to send email with Intent. I wrote code witch can send email send.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[] { Email }); email.putExtra(Intent.EXTRA_SUBJECT,"subject"); email.putExtra(Intent.EXTRA_TEXT, "text1"); email.setType("message/rfc822"); startActivity(Intent.createChooser(email, "Choose an Email client :")); } }); I can send email, but when I choose email client then I can change subject text and extra text. How I can write code to use would not can change subject and extra texts when user would choose email client?
has answer: http://stackoverflow.com/a/24556379
has comment: http://stackoverflow.com/comment/38032143
answer count: 2
has comment: http://stackoverflow.com/comment/38032318
score: -1

http://stackoverflow.com/comment/37839364
comment on: http://stackoverflow.com/q/24446861
has text: GetWindowTextW giving only first letter of title and when I use GetWindowText , it is giving exception 'Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'GetWindowText': The specified procedure could not be found.'
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24570968
has body: I think you have to clean your project and rebuild it. because The temp values might have been available. When you clean it, this app will work and you can take build now
type: Answer
answers question: http://stackoverflow.com/q/24569403
score: 0

http://stackoverflow.com/q/24468875
tagged with: java
has comment: http://stackoverflow.com/comment/37870014
has answer: http://stackoverflow.com/a/24469083
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37869856
type: Question
tagged with: jakarta-ee
upvote count: 0
score: -2
has title: Using a java project in an other java project
has comment: http://stackoverflow.com/comment/37869911
has comment: http://stackoverflow.com/comment/37869847
has body: I have 2 java Projects, i want to use one in the other, i've tried to export the one which i want to use it as jar file and i've added it in the build path of the other , but when i excute ,this exception is raised "java.lang.NoClassDefFoundError" . help please (i WANT TO CONSERVE THIS 2 PROJECTS SEPARATE)!
answer count: 3
has comment: http://stackoverflow.com/comment/37869811
has comment: http://stackoverflow.com/comment/37870043
favorite count: 0
has answer: http://stackoverflow.com/a/24468914
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37870278
has answer: http://stackoverflow.com/a/24470422

http://stackoverflow.com/comment/38083239
type: QuestionComment
comment on: http://stackoverflow.com/q/24437564
has text: Google Bug tracker : http://code.google.com/p/android/issues/detail?id=72419#c12
score: 0
type: Comment

thread-sleep
tags question: http://stackoverflow.com/q/24444821
type: Tag
tag name: thread-sleep

http://stackoverflow.com/comment/37816965
type: Comment
has text: Does ~15-20 count as a lot of page/ fragments? All it's showing is some text. I doubt this is a memory-hog.
type: AnswerComment
comment on: http://stackoverflow.com/a/24439531
score: 0

http://stackoverflow.com/a/24522411
has body: Check which API level you're using for rendering the view. In my case it was API 20 (for Android Wear). I changed it to API 19 and the error is gone.
accepted answer of: http://stackoverflow.com/q/24522148
type: Answer
answers question: http://stackoverflow.com/q/24522148
upvote count: 25
score: 25
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24457180
score: -1
upvote count: 0
type: Answer
has body: use webjars for your unmodified static files like extJS, jQuery, Bootstrap or something else Here is the list of webjars http://www.webjars.org/documentation And sample http://www.webjars.org/documentation
has comment: http://stackoverflow.com/comment/37898190
answers question: http://stackoverflow.com/q/24448257
downvote count: 1

http://stackoverflow.com/comment/44955612
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24485899
has text: Same problem here. Why don't they include this in jar? googling just brings me back here.
score: 0

http://stackoverflow.com/a/24497923
upvote count: 3
score: 3
has body: It is the 30th of June today, and you never set the day of month in your code, so the 30th is assumed. Since February has fewer than 30 days, it overflows and you end up in March. Try the code below, and notice, that setting the day of month affects what is being displayed: calendarTemp.set(Calendar.MONTH, 1); calendarTemp.set(Calendar.DAY_OF_MONTH, 1); As a side note, it makes code more readable to use constants from the Calendar class, eg. Calendar.FEBRUARY instead of magic numbers, especially because months are 0-based...
downvote count: 0
answers question: http://stackoverflow.com/q/24497682
type: Answer

http://stackoverflow.com/a/24564424
score: 1
upvote count: 1
has body: This is the difference between accessing a field (no parentheses) and calling a method (requires parentheses, even if there are no arguments to the method). Historically, arrays could have had a method in addition to or instead of a field. Strings could have had a field in addition to a method. A field is simpler, which is probably why arrays use it, but there are at least two reasons why it's good for String to have a length method: String implements the CharSequence interface, which defines a length() method, so String has to have that method. (Defining fields isn't a feature of interfaces, except for static final constants.) String could have length as a method and a field but that would be distracting. Flexibility. String's internal implementation has changed over time: at one time it used an internal char array and separate offset and length fields which defined a region within the char array. That was done so that substrings could share the parent string's char array (with different offset and length) instead of copying the array. It was later found that that optimization was rarely beneficial, so now, String has only a char array of the correct size, and the length method reads the array's length field. String no longer has its own length field, not even a private one, but they couldn't have removed it if it were part of the class's public API, which would give less flexibility to experiment with internal implementations.
downvote count: 0
answers question: http://stackoverflow.com/q/24563975
type: Answer
has comment: http://stackoverflow.com/comment/38054899

web-services
tags question: http://stackoverflow.com/q/24567553
type: Tag
tags question: http://stackoverflow.com/q/24508753
tags question: http://stackoverflow.com/q/24429636
tags question: http://stackoverflow.com/q/24535411
tags question: http://stackoverflow.com/q/24428162
tags question: http://stackoverflow.com/q/24469891
tags question: http://stackoverflow.com/q/24583555
tags question: http://stackoverflow.com/q/24566909
tags question: http://stackoverflow.com/q/24448537
tags question: http://stackoverflow.com/q/24503909
tags question: http://stackoverflow.com/q/24573950
tags question: http://stackoverflow.com/q/24489464
tags question: http://stackoverflow.com/q/24439525
tags question: http://stackoverflow.com/q/24499293
tags question: http://stackoverflow.com/q/24456424
tags question: http://stackoverflow.com/q/24518033
tags question: http://stackoverflow.com/q/24577316
tags question: http://stackoverflow.com/q/24441730
tags question: http://stackoverflow.com/q/24582519
tags question: http://stackoverflow.com/q/24532963
tags question: http://stackoverflow.com/q/24444832
tags question: http://stackoverflow.com/q/24469256
tags question: http://stackoverflow.com/q/24505374
tags question: http://stackoverflow.com/q/24480078
tags question: http://stackoverflow.com/q/24484121
tags question: http://stackoverflow.com/q/24452367
tags question: http://stackoverflow.com/q/24428369
tags question: http://stackoverflow.com/q/24574648
tags question: http://stackoverflow.com/q/24566950
tags question: http://stackoverflow.com/q/24469456
tags question: http://stackoverflow.com/q/24435356
tags question: http://stackoverflow.com/q/24554709
tags question: http://stackoverflow.com/q/24451062
tags question: http://stackoverflow.com/q/24507163
tags question: http://stackoverflow.com/q/24574900
tags question: http://stackoverflow.com/q/24534287
tags question: http://stackoverflow.com/q/24452890
tags question: http://stackoverflow.com/q/24485993
tags question: http://stackoverflow.com/q/24484160
tags question: http://stackoverflow.com/q/24490074
tags question: http://stackoverflow.com/q/24490354
tags question: http://stackoverflow.com/q/24429207
tags question: http://stackoverflow.com/q/24568972
tags question: http://stackoverflow.com/q/24432851
tags question: http://stackoverflow.com/q/24447695
tags question: http://stackoverflow.com/q/24490373
tags question: http://stackoverflow.com/q/24497344
tags question: http://stackoverflow.com/q/24573640
tags question: http://stackoverflow.com/q/24519044
tag name: web-services
tags question: http://stackoverflow.com/q/24518150
tags question: http://stackoverflow.com/q/24430845
tags question: http://stackoverflow.com/q/24531565
tags question: http://stackoverflow.com/q/24447280
tags question: http://stackoverflow.com/q/24571990
tags question: http://stackoverflow.com/q/24496771
tags question: http://stackoverflow.com/q/24432897
tags question: http://stackoverflow.com/q/24530185
tags question: http://stackoverflow.com/q/24495579
tags question: http://stackoverflow.com/q/24433234

http://stackoverflow.com/comment/51294133
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [for loop using lambda expression in JAVA](http://stackoverflow.com/questions/24399181/for-loop-using-lambda-expression-in-java)
comment on: http://stackoverflow.com/q/24437954

http://stackoverflow.com/a/25542343
answers question: http://stackoverflow.com/q/24489019
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: Try the following sample code import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.apache.logging.log4j.core.config.AppenderRef; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.LoggerConfig; import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.spi.ExtendedLogger; import org.apache.logging.log4j.spi.LoggerContext; public class TestLog4j2 { public static void main(String[] args) { try { ConsoleAppender console = ConsoleAppender.createAppender(PatternLayout.createDefaultLayout(), null, "SYSTEM_OUT", "console", null, null); final LoggerContext ctx = (LoggerContext) new org.apache.logging.log4j.core.LoggerContext("console" ); final Configuration config = ((org.apache.logging.log4j.core.LoggerContext) ctx).getConfiguration(); console.start(); config.addAppender(console); AppenderRef ref = AppenderRef.createAppenderRef("console", null, null); AppenderRef[] refs = new AppenderRef[] {ref}; LoggerConfig loggerConfig = LoggerConfig.createLogger("false", Level.ALL, "org.apache.logging.log4j", "true", refs, null, config, null ); loggerConfig.addAppender(console, null, null); config.addLogger("org.apache.logging.log4j", loggerConfig); ((org.apache.logging.log4j.core.LoggerContext) ctx).updateLoggers(); ExtendedLogger logger = (ExtendedLogger) ctx.getLogger("console"); logger.error("abc"); } catch (Exception e) { e.printStackTrace(); } } }

http://stackoverflow.com/comment/37963807
type: AnswerComment
comment on: http://stackoverflow.com/a/24518458
has text: something like this..@syme
type: Comment
score: 0

http://stackoverflow.com/a/24581895
type: Answer
downvote count: 0
score: 1
has body: Consider the following code package test; public class BlockingTest { public static void main(String[] args) { Thread t = new Thread(new Sleeper()); t.start(); System.out.println("interrupting"); t.interrupt(); try { t.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static class Sleeper implements Runnable { private final Object lock = new Object(); @Override public void run() { try { for (int I = 0; I &lt; 120000; I++) { System.out.println(I); } System.out.println("Stopped counting, waiting"); synchronized (lock) { lock.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } } } } Here the thread running in Sleeper will throw an interrupted exception when it enters the monitor on the lock object. .interrupt() was called by the main thread long before it gets to that point. So calling interrupt on a thread prior to entering some blocking operation will throw an interrupted exception if the call to that threads interrupt was made prior to the blocking op. It is good to point out that a call to interrupted on Thread will clear the interruped flag, so if this happens: Thread.interrupt(); .... Thread.interrupted(); Thread.interrupted(); The second call to Thread.interrupted() will return false. Heres the doc: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#interrupted%28%29 I do remember hearing long ago that its not a good idea to rely on interrupts as exit conditions. Typically I will implement an exit() method which sets some exit flag, and calls interrupt on the thread in question. This makes sure that I either evaluate the exit flag and exit, or if the thread is waiting in a loop on a monitor someplace, that it will throw an IOException, and subsequently evaluate the exit flag and exit. But I can imagine situations where you want to set a flag, but not necessarily interrupt eg. ensuring that a thread doesnt abort a write operation and say, corrupt some persisted data its writin…
answers question: http://stackoverflow.com/q/24580769
upvote count: 1

http://stackoverflow.com/q/24574432
score: 4
has comment: http://stackoverflow.com/comment/38066461
tagged with: exception
linked to: http://stackoverflow.com/q/17168184
tagged with: android
tagged with: java-7
has body: I've got the following situation: try{ // Do some things that can cause the exceptions } catch(SomeException ex){ doSomething(); } catch(SomeOtherException ex){ doSomething(); } catch(AndYetAnotherException ex){ doSomething(); } catch(Exception ex){ // Do something else } In Java v7+ I could change this to: try{ // Do some things that can cause the exceptions } catch(SomeException | SomeOtherException | AndYetAnotherException ex){ doSomething(); } catch(Exception ex){ // Do something else } Since Android doesn't support Java 7+ yet, I can't use the above. What are the risks of doing the following instead: try{ // Do some things that can cause the exceptions } catch(Exception ex){ if(ex instanceof SomeException || ex instanceof SomeOtherException || ex instanceof AndYetAnotherException){ doSomething(); } else{ // Do something else } } I don't have enough experience or knowledge of instanceof, so I don't know the risks. Are there unexpected results that might occur? Are there performance changes during run-time and/or during compilation? etc. If there aren't any risks, high performance changes or unexpected results, then why not use the instanceof for a single catch? If there are however any risk whatsoever, I guess it's better to use multiple catches which is supported better by both Android/Java itself and the compilation behind the scenes.
answer count: 1
accepted answer: http://stackoverflow.com/a/24574892
has comment: http://stackoverflow.com/comment/38066495
has comment: http://stackoverflow.com/comment/38066335
favorite count: 0
has comment: http://stackoverflow.com/comment/38066214
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38066026
has answer: http://stackoverflow.com/a/24574892
has title: Android doesn't support Java v7+, so should I use multiple catches or one catch with instanceof checks?
type: Question
linked to: http://stackoverflow.com/q/7153989
upvote count: 4
tagged with: try-catch
downvote count: 0

http://stackoverflow.com/comment/38005844
type: Comment
has text: @jdevelop But as I explained, it doesn't cut things to 5 bits. you have `tArr[i] = (char) (tArr[i] ^ tArr[i * 123456 % 31] & 31)`, which to simplify we can write as `t[i]=t[i]^t[j]&31`. Since the AND is evaluated before the XOR, you are XORing t[i] with the low 5 bits of t[j]. That means that the top 3 bits of t[i] remain unchanged, and therefore they are not lost, and you only have to find the 5 lowest bits, and I showed how to do that.
comment on: http://stackoverflow.com/a/24540839
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37968804
comment on: http://stackoverflow.com/a/24522182
score: 0
type: Comment
has text: Follow up question: How can I make the list print every thing on it's own line?
type: AnswerComment

http://stackoverflow.com/a/24451742
downvote count: 0
answers question: http://stackoverflow.com/q/24451368
type: Answer
score: 1
upvote count: 1
has body: If you want to iterate through all elements of an array, these are the two ways : When you only need the element : for (int element : array) { ... } When you also need the index (i) : for (int i = 0; i &lt; array.length; i++) { int element = array[i]; ... } For the second loop, if your teacher wants you to declare everything at the top, you can do this : int element; for (int i = 0; i &lt; array.length; i++) { element = array[i]; ... }

http://stackoverflow.com/a/24504073
downvote count: 0
type: Answer
has body: The specific exception message is unclear to me, but here is one problem you definitely have: At the end of your init() method, you call glDisableVertexAttribArray() for your two vertex attributes. At this point, your VAO is bound. The attribute enable/disable state is part of the VAO state. So when you later call glBindVertexArray() in your display() method, the vertex attributes will be disabled, and you make your glDrawArraysInstanced() call without any enabled attributes. To fix this, you should make the glDisableVertexAttribArray() calls at the end of init() conditional: if (!useVao) { gl.glDisableVertexAttribArray(locPos); gl.glDisableVertexAttribArray(locCol); }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24487301

http://stackoverflow.com/comment/38075978
type: QuestionComment
has text: Thanks for your interest, the code doesn't throw any exception. in most of the tries it just get stuck while it is writing bytes in output stream.
comment on: http://stackoverflow.com/q/24578909
score: 0
type: Comment

http://stackoverflow.com/comment/38040580
has text: OK I think he is asking how to mock `method` so that its actual implementation is not called. It's a "how do I write this unit test?" question.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24560508
type: QuestionComment

http://stackoverflow.com/comment/37839579
type: Comment
has text: Hey! Many thanks. I had tried this but before it didn't worked, but I finally found where I have my mistake. It is not because of IF statement. I had put two comparisons in one for loop, because I need to compare both EditTexts and that's my mistake. It works only when both of ET's are equal and that also I want to prevent.
comment on: http://stackoverflow.com/a/24452271
score: 0
type: AnswerComment

http://stackoverflow.com/q/24557794
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24557893
tagged with: components
score: 1
has answer: http://stackoverflow.com/a/24613186
tagged with: java
duplicate of: http://stackoverflow.com/q/6533243
tagged with: installation-package
tagged with: eclipse
type: Question
has body: Everyone I recently installed java JDK. However, I am not able to program GUI applications. For instance when i want to program anything from "swing" components i cannot include Buttons, Labels, Text, etc. As a developing tool I am using Eclipse. Can someone tell me if I am missing something.
tagged with: runtime-error
upvote count: 3
downvote count: 2
answer count: 3
linked to: http://stackoverflow.com/q/6533243
linked to: http://stackoverflow.com/q/29426
has answer: http://stackoverflow.com/a/24557928
has title: Programming Java GUI with Eclipse

http://stackoverflow.com/q/24569881
score: 0
upvote count: 1
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24570043
has title: How to access multiple action properties in Strtus2 OGNL expression?
favorite count: 0
has body: In my jsp I have this code: &lt;s:property value="%{(getPage()-1)*getSearchMaxEntries()+1}"/&gt; This should access the properties of the action and show the result of the calculation. Unfortunately, this always equals to 1 regardless of the real values returned by the action. Any ideas what's wrong?
has answer: http://stackoverflow.com/a/24570043
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: expression
tagged with: ognl
tagged with: jsp
tagged with: struts2

http://stackoverflow.com/a/24450697
type: Answer
answers question: http://stackoverflow.com/q/24450478
has comment: http://stackoverflow.com/comment/37835987
upvote count: 4
has body: To create a String from part of a byte array, use the constructor String(byte[] bytes, int offset, int length, String charsetName). Example: // uses the first 10 bytes of b str = new String(b, 0, 10, "UTF-8"); Also, if you're compiling for Java 7 you might as well use StandardCharsets (from the java.nio.charset package), and avoid having to handle UnsupportedEncodingException. Example: str = new String(b, 0, 10, StandardCharsets.UTF_8);
downvote count: 0
score: 4

http://stackoverflow.com/a/24488223
score: 1
accepted answer of: http://stackoverflow.com/q/24488050
has body: You are on the right track. Just iterate with your loop 1000 times instead of up to n! And to get the first three elements of a list use the method subList(0, 3)
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24488050

http://stackoverflow.com/comment/38055876
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24568525
has text: sorry, i`m noob and if use @MadProgrammer solution is better for speed and memory i will use this
score: 0

http://stackoverflow.com/comment/37836632
has text: Similar question asked & have answer http://stackoverflow.com/questions/24445901/file-upload-services-using-jersey-in-tomcat-without-maven/24448770#24448770
score: 1
comment on: http://stackoverflow.com/q/24451062
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24506819
type: Answer
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/24506675
downvote count: 1
has body: if my Guess is Correct Jegy is the other table? in that case try this! String SQL="SELECT * FROM belepes A LEFT JOIN jegy B ON B.jegytipus = A.jegytipus WHERE vonalkod='"+vk+"'";

http://stackoverflow.com/a/24512276
answers question: http://stackoverflow.com/q/24511961
score: 0
type: Answer
has body: Here is your problem. Please take a look on digested version of your code with my comments. String h5Files[]; // here you define the variable. It still is not initialized. try{ .................. do { h5Files = new String[linereader]; // here you initialize the variable } while(i !=-1); // When i = -1 the end of the file has been reached .................. catch(IOException exc) { // if you are here the variable is still not initialized System.out.println("Error reading file."); } // you continue reading file even if exception was thrown while opening the file I think that now the problem is clearer. You try to open the file and count lines. If you succeed you create array. If not (i.e. when exception is thrown) you catch the exception but still continue reading the file. But in this case you array is not initialized. Now how to fix this? Actually if you failed to read the file first time you cannot continue. This may happen for example if file does not exist. So, you should either return when first exception is thrown or just do not catch it at all. Indeed there is nothing to do with the file if exception was thrown at any phase. Exception is not return code. This is the reason that exceptions exist. So, just do not catch exceptions at all. Declare your method as throws IOException and remove all try/catch blocks.

http://stackoverflow.com/a/24575518
has comment: http://stackoverflow.com/comment/38083258
upvote count: 2
has comment: http://stackoverflow.com/comment/38074477
has comment: http://stackoverflow.com/comment/38083479
has comment: http://stackoverflow.com/comment/38079237
has comment: http://stackoverflow.com/comment/38069740
has comment: http://stackoverflow.com/comment/38069017
has comment: http://stackoverflow.com/comment/38854202
downvote count: 0
has body: As you noted, Scala eventually compiles to JVM bytecode. An obvious instruction from the JVM instruction set, that has no equivalent in the Java language, is goto. A Scala compiler might use goto for instance to optimize loops or tail-recursive methods. In this case, in Java you would have to emulate the behavior of a goto. As Antimony hinted, a Turing complete language can at least emulate another Turing complete language. However the resulting program may be heavyweight and suboptimal. As a final note, decompilers may help. I'm not familiar with the intrinsics of decompilers, but I assume that they rely a lot on patterns. I mean, for example, Java source pattern f(x) compiles to Bytecode pattern f'(x), so with a lot of hard work and experience, some manage to decompile Bytecode f'(y) to Java source f(y). However, I've not heard of Scala decompilers yet (maybe someone's working on that). [EDIT] About what I originally meant by emulating the behavior of a goto: I had in mind switch/case statements inside a loop, and cdshines showed another way by using labeled break/continue in a loop (though I believe that using "disregarded and condemned" features is not standard). In either of these cases, in order to jump back to an earlier instruction, an idiomatic Java loop (for/while/do-while) is required (any other suggestion?). An endless loop makes it easy to implement, a conditional loop would require more work, but I assume this is doable. Also, goto isn't limited to loops. In order to jump forward, Java would require other contructs. A counterexample: in C, there are limitations but you don't have to go through such great lengths, because there's a goto instruction. As a related topic, if you're interested in non-idiomatic jumps in Scala, c.f. this old Q&amp;A of mine. My point being, not only a Scala compiler might emit goto in a way that's not natural in Java, but a developer can have a tight control on that with the help of Scala macros. LabelDef: A labelled expressi…
type: Answer
answers question: http://stackoverflow.com/q/24566566
score: 2
has comment: http://stackoverflow.com/comment/38069570

http://stackoverflow.com/q/24530222
score: 0
has comment: http://stackoverflow.com/comment/37983520
answer count: 1
has answer: http://stackoverflow.com/a/24530558
has comment: http://stackoverflow.com/comment/37985488
tagged with: collections
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24530558
tagged with: java
has comment: http://stackoverflow.com/comment/37983731
type: Question
has title: Returning a sorted Java list instead of sorting it in-place
tagged with: sorting
has body: The Java collections API has a sort method that sorts a list in-place. Is there such a method that doesn't change the given list but returns a sorted one?

http://stackoverflow.com/a/24490458
has comment: http://stackoverflow.com/comment/37911326
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/24490318
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24490318
has body: The problem is probably that the pom.xml of your X.jar is not properly installed in your repository. When you install a jar "by hand" in your repo :use the option -DpomFile="&lt;path_to_your_pom&gt;" . If you don't do that : maven will create (and install !!!) an ultra-simple pom.xml for you (and of course it don't contains any data about dependencies). More about installing a custom jar here
upvote count: 5
type: Answer

http://stackoverflow.com/a/24441324
score: 0
has body: Your buttons and textview are in fragment layout, not in activity layout so you have to move your code to onCreateView: public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } int counter=0; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); Button add = (Button) rootView.findViewById(R.id.bAdd); Button sub = (Button) rootView.findViewById(R.id.bSub); TextView display = (TextView) rootView.findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText("Counter equals" + counter); } }); return rootView; } } Also, you have to clear your onCreate, just leave: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starting_point); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24441154
accepted answer of: http://stackoverflow.com/q/24441154
has comment: http://stackoverflow.com/comment/37820150
has comment: http://stackoverflow.com/comment/37824388

http://stackoverflow.com/comment/37844604
type: QuestionComment
has text: I'm not sure, honestly. As long as I can receive a list on server side, I'm happy.
score: 0
comment on: http://stackoverflow.com/q/24453860
type: Comment

http://stackoverflow.com/a/24560648
type: Answer
has comment: http://stackoverflow.com/comment/38042115
upvote count: 3
answers question: http://stackoverflow.com/q/24560360
score: 3
has body: I don't think you can do this. fs module just a wrapper for native bindings built into node.js itself. There are some thoughts flying in the sky of node.js community about being able to use different JS engines inside node.js but I don't think we will see this in the near future.
downvote count: 0
has comment: http://stackoverflow.com/comment/38045382

http://stackoverflow.com/q/24539244
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24539420
accepted answer: http://stackoverflow.com/a/24539420
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38006680
has answer: http://stackoverflow.com/a/24539311
tagged with: java
possible better answer: http://stackoverflow.com/a/24539311
type: Question
has body: I'm studying the Java Tutorials on Generics and playing with the example on http://docs.oracle.com/javase/tutorial/java/generics/bridgeMethods.html in my own way. Two classes: public class Node&lt;T&gt; { private T data; public Node(T data) { this.data = data; } public void setData(T data) { this.data = data; } } public class MyNode extends Node&lt;Integer&gt; { public MyNode(Integer data) { super(data); } public void setData(Integer data) { super.setData(data); } } Due to type erasure, following code will compile: MyNode mn = new MyNode(5); // 1 Node n = mn; // 2 n.setData("Hello"); // 3 because line 3 is actually calling the type erased method Node.setData(Object). But a runtime ClassCastException will be thrown. Here is my experiment: I printed out the type of the field data. It was Object in both Node and MyNode. Here are my questions: Node has an Object type with no surprise due to type erasure. But how come MyNode also has an Object type for "data"? If MyNode's "data" has an Object type, how does the runtime type checking work? (The ClassCastException exception...) It seems to me the data type in MyNode has also been erased (my puzzle #1). Java version: HotSpot 1.8.0_05-b13
has title: Java generic type erasure: runtime type check on the field
score: 0
has comment: http://stackoverflow.com/comment/38000841
answer count: 2
upvote count: 1

vote
type: Tag
tag name: vote
tags question: http://stackoverflow.com/q/24587531

http://stackoverflow.com/a/24438323
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24437594
answers question: http://stackoverflow.com/q/24437594
has body: You can get the first value returned by the keySet().iterator().next() It is random but will be the same every time until the collection is changed. The only alternative is to use reflection to grab the underlying array and navigate it yourself. In short a HashMap is not designed for this purpose. If you need this, use another data structure.
type: Answer
downvote count: 0
score: 1

android-activity
tags question: http://stackoverflow.com/q/24480282
tags question: http://stackoverflow.com/q/24445855
tags question: http://stackoverflow.com/q/24519209
tags question: http://stackoverflow.com/q/24548153
tags question: http://stackoverflow.com/q/24485012
tags question: http://stackoverflow.com/q/24469819
tags question: http://stackoverflow.com/q/24485899
tags question: http://stackoverflow.com/q/24587146
tags question: http://stackoverflow.com/q/24531252
tags question: http://stackoverflow.com/q/24535610
tags question: http://stackoverflow.com/q/24443240
tags question: http://stackoverflow.com/q/24450817
tag name: android-activity
tags question: http://stackoverflow.com/q/24521902
tags question: http://stackoverflow.com/q/24570979
tags question: http://stackoverflow.com/q/24473006
tags question: http://stackoverflow.com/q/24525174
tags question: http://stackoverflow.com/q/24503545
tags question: http://stackoverflow.com/q/24429905
tags question: http://stackoverflow.com/q/24522148
tags question: http://stackoverflow.com/q/24546013
tags question: http://stackoverflow.com/q/24487067
tags question: http://stackoverflow.com/q/24530138
tags question: http://stackoverflow.com/q/24546333
tags question: http://stackoverflow.com/q/24544878
tags question: http://stackoverflow.com/q/24468205
tags question: http://stackoverflow.com/q/24543328
type: Tag
tags question: http://stackoverflow.com/q/24532002

http://stackoverflow.com/q/24491243
has comment: http://stackoverflow.com/comment/37917836
has title: Why can't I get a duration in minutes or hours in java.time?
has answer: http://stackoverflow.com/a/49117195
score: 95
has answer: http://stackoverflow.com/a/54631807
downvote count: 0
has answer: http://stackoverflow.com/a/24497375
tagged with: java-8
upvote count: 95
type: Question
has comment: http://stackoverflow.com/comment/37960238
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24491726
tagged with: java
tagged with: java-time
has answer: http://stackoverflow.com/a/24491726
answer count: 6
has comment: http://stackoverflow.com/comment/37918885
linked to: http://stackoverflow.com/q/20827047
has answer: http://stackoverflow.com/a/24500045
accepted answer: http://stackoverflow.com/a/24500045
has comment: http://stackoverflow.com/comment/37912661
has comment: http://stackoverflow.com/comment/37913075
has answer: http://stackoverflow.com/a/24494149
has body: Of the Duration class in the new JSR 310 date API (java.time package) available in Java 8 and later, the javadoc says : This class models a quantity or amount of time in terms of seconds and nanoseconds. It can be accessed using other duration-based units, such as minutes and hours.In addition, the DAYS unit can be used and is treated as exactly equal to 24 hours, thus ignoring daylight savings effects. So, why does the following code crash ? Duration duration = Duration.ofSeconds(3000); System.out.println(duration.get(ChronoUnit.MINUTES)); This raises an UnsupportedTemporalTypeException : java.time.temporal.UnsupportedTemporalTypeException: Unsupported unit: Minutes at java.time.Duration.get(Duration.java:537) So what is the recommended way to extract minutes and hours from a duration object ? Do we have to make the calculation ourselves from the number of seconds ? Why was it implemented that way ?
favorite count: 0

http://stackoverflow.com/comment/37851096
type: QuestionComment
has text: The only log statement I see is when you catch an Exception from trying to write to a file. Do you have other log statements elsewhere that I'm missing?
comment on: http://stackoverflow.com/q/24458806
score: 0
type: Comment

http://stackoverflow.com/comment/38051989
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24566278
has text: @AlexandreSantos *"from Windows console"*
score: 0

http://stackoverflow.com/a/24646540
score: 0
type: AcceptedAnswer
type: Answer
has body: You could import data using in-memory store and than copy it to disk. Also make sure that cache size is large. MapDB has Data Pump for fast BTreeMap import, HashMap will be supported in MapDB 1.4 eventually.
answers question: http://stackoverflow.com/q/24479954
accepted answer of: http://stackoverflow.com/q/24479954

http://stackoverflow.com/a/24462605
score: 29
has comment: http://stackoverflow.com/comment/86362224
has comment: http://stackoverflow.com/comment/86378946
has comment: http://stackoverflow.com/comment/37858320
downvote count: 0
answers question: http://stackoverflow.com/q/24462513
has comment: http://stackoverflow.com/comment/37858338
type: Answer
has body: The cost of a remove is O(n) as you have to shuffle the elements to the "right" of that point "left" by one: Delete D | V +-----+-----+-----+-----+-----+-----+-----+ | A | B | C | D | E | F | G | +-----+-----+-----+-----+-----+-----+-----+ <------------------ Move E, F, G left If your test code is giving you O(1) then I suspect you're not measuring it properly :-) The OpenJDK source, for example, has this: public E remove(int index) { rangeCheck(index); modCount++; E oldValue = elementData(index); int numMoved = size - index - 1; if (numMoved > 0) System.arraycopy(elementData, index+1, elementData, index, numMoved); elementData[--size] = null; // Let gc do its work return oldValue; } and the System.arraycopy is the O(n) cost for this function. In addition, I'm not sure you've thought this through very well: for (int i = 0; i < list.size() ; i++) list.remove(i); This is going to remove the following elements from the original list: 0, 2, 4, 8 and so on, because the act of removing element 0 shifts all other elements left - the item that was originally at offset 1 will be at offset 0 when you've deleted the original offset 0, and you then move on to delete offset 1.
upvote count: 29

http://stackoverflow.com/comment/108454005
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24626593
has text: Where do I get the app-name and module-name from? In admin console from Glassfish?

http://stackoverflow.com/q/24572214
has comment: http://stackoverflow.com/comment/38062440
answer count: 9
has comment: http://stackoverflow.com/comment/38099935
accepted answer: http://stackoverflow.com/a/24575207
has comment: http://stackoverflow.com/comment/38062264
has answer: http://stackoverflow.com/a/24627139
possible better answer: http://stackoverflow.com/a/24572966
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2467544
has answer: http://stackoverflow.com/a/24572523
has answer: http://stackoverflow.com/a/24572966
tagged with: java
has title: Java Name Hiding: The Hard Way
tagged with: member-hiding
has body: I have a problem with name hiding that is extremely hard to solve. Here is a simplified version that explains the problem: There is a class: org.A package org; public class A{ public class X{...} ... protected int net; } Then there is a class net.foo.X package net.foo; public class X{ public static void doSomething(); } And now, here is the problematic class which inherits from A and wants to call net.foo.X.doSomething() package com.bar; class B extends A { public void doSomething(){ net.foo.X.doSomething(); // doesn't work; package net is hidden by inherited field X.doSomething(); // doesn't work; type net.foo.X is hidden by inherited X } } As you see, this is not possible. I cannot use the simple name X because it is hidden by an inherited type. I cannot use the fully qualified name net.foo.X, because net is hidden by an inherited field. Only the class B is in my code base; the classes net.foo.X and org.A are library classes, so I cannot alter them! My only solution looks like this: I could call another class that in turn calls X.doSomething(); but this class would only exist because of the name clash, which seems very messy! Is there no solution in which I can directly call X.doSomething() from B.doSomething()? In a language that allows specifying the global namespace, e.g., global:: in C# or :: in C++, I could simply prefix net with this global prefix, but Java does not allow that.
type: Question
score: 97
has answer: http://stackoverflow.com/a/24588863
upvote count: 97
has answer: http://stackoverflow.com/a/24578283
tagged with: name-clash
has answer: http://stackoverflow.com/a/24575207
has comment: http://stackoverflow.com/comment/38067065
linked to: http://stackoverflow.com/q/3671649
has answer: http://stackoverflow.com/a/24756536
has answer: http://stackoverflow.com/a/24572520
downvote count: 0
has comment: http://stackoverflow.com/comment/38062574
linked to: http://stackoverflow.com/q/19455742
has answer: http://stackoverflow.com/a/24572793
favorite count: 0

http://stackoverflow.com/q/24452511
tagged with: java
has title: Java Play 2.3 Match any route which starts with certain string
type: Question
accepted answer: http://stackoverflow.com/a/24454692
tagged with: routes
has body: is there a way to match only a part from a route. I need a route definition which should match the following routes /route /route/part1 ... The part after "/route" is dynamic and variable. Every route which starts with "/route" should be matched. My try: GET /route/&lt;[a-z]+&gt; controllers.Assets.at(path="/public/web", file="static.html") Error: Action not found For request 'GET /route/home' GET /route/*file controllers.Assets.at(path="/public/web", file="static.html") Error: It is not allowed to specify a fixed or default value for parameter: 'file' extracted from the path
answer count: 1
has answer: http://stackoverflow.com/a/24454692
type: AnsweredQuestion
tagged with: playframework-2.0
score: 0

http://stackoverflow.com/comment/37819254
type: QuestionComment
has text: I added the a screenshot with package names..
comment on: http://stackoverflow.com/q/24441172
score: 0
type: Comment

http://stackoverflow.com/comment/37856592
has text: well, I want to only get the slice of the 2d array arr[3][6] and check whether it contains "example" without looping through the whole array
comment on: http://stackoverflow.com/q/24461735
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24468656
has comment: http://stackoverflow.com/comment/37870006
has comment: http://stackoverflow.com/comment/37869868
has title: Enums and how they work
type: Question
has comment: http://stackoverflow.com/comment/37870057
tagged with: enums
has comment: http://stackoverflow.com/comment/37870025
has body: I recently have looked at a tutorial on enums. First and foremost, the syntax goes way over my head. Past that, I do not seem to understand the topic and its specific uses either. The tutorial was vague and the commentator just seemed to write code and talk, not necisarrily explaining the code she was using. Please do not just down vote my question because you personally think it is an easy topic. I have already looked at tutorials and found them confusing. If you feel you can not answer my question a link to a website or a you tube video would be appreciated as well. Happy Coding!
has answer: http://stackoverflow.com/a/24468745
has comment: http://stackoverflow.com/comment/37869487
has comment: http://stackoverflow.com/comment/37870037
score: 0
has comment: http://stackoverflow.com/comment/37870222
has comment: http://stackoverflow.com/comment/37869502
answer count: 1
linked to: http://stackoverflow.com/q/4709175
has comment: http://stackoverflow.com/comment/37869714
accepted answer: http://stackoverflow.com/a/24468745
duplicate of: http://stackoverflow.com/q/4709175
has comment: http://stackoverflow.com/comment/37869959
has comment: http://stackoverflow.com/comment/37869518
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37870184
tagged with: java

jar
tags question: http://stackoverflow.com/q/24584621
tags question: http://stackoverflow.com/q/24502187
tags question: http://stackoverflow.com/q/24436201
tags question: http://stackoverflow.com/q/24499272
tags question: http://stackoverflow.com/q/24431445
tags question: http://stackoverflow.com/q/24573109
tags question: http://stackoverflow.com/q/24449987
tags question: http://stackoverflow.com/q/24526438
tags question: http://stackoverflow.com/q/24433805
tags question: http://stackoverflow.com/q/24579550
tags question: http://stackoverflow.com/q/24467860
tags question: http://stackoverflow.com/q/24451865
tags question: http://stackoverflow.com/q/24549083
type: Tag
tags question: http://stackoverflow.com/q/24530952
tags question: http://stackoverflow.com/q/24481929
tags question: http://stackoverflow.com/q/24546534
tags question: http://stackoverflow.com/q/24523927
tags question: http://stackoverflow.com/q/24490318
tags question: http://stackoverflow.com/q/24427816
tags question: http://stackoverflow.com/q/24440229
tags question: http://stackoverflow.com/q/24452509
tags question: http://stackoverflow.com/q/24528088
tags question: http://stackoverflow.com/q/24441002
tags question: http://stackoverflow.com/q/24489208
tags question: http://stackoverflow.com/q/24428314
tags question: http://stackoverflow.com/q/24571121
tag name: jar
tags question: http://stackoverflow.com/q/24575816
tags question: http://stackoverflow.com/q/24439580
tags question: http://stackoverflow.com/q/24497555
tags question: http://stackoverflow.com/q/24552246
tags question: http://stackoverflow.com/q/24489780
tags question: http://stackoverflow.com/q/24530539
tags question: http://stackoverflow.com/q/24586753
tags question: http://stackoverflow.com/q/24500845
tags question: http://stackoverflow.com/q/24578646
tags question: http://stackoverflow.com/q/24443219
tags question: http://stackoverflow.com/q/24438098
tags question: http://stackoverflow.com/q/24557111
tags question: http://stackoverflow.com/q/24430768
tags question: http://stackoverflow.com/q/24448821
tags question: http://stackoverflow.com/q/24435702
tags question: http://stackoverflow.com/q/24539573

http://stackoverflow.com/a/24552896
type: Answer
accepted answer of: http://stackoverflow.com/q/24543179
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: I learned that since the fragment lifecycle is tied to the activity onCreate creates both the activity and the fragment. onCreate is used to set activity layout where onCreateView sets the fragment layout. the reason headlinesFragment didn't have onCreateView is because since it's a list it has a predefined layout and thus doesn't need to be overridden.
answers question: http://stackoverflow.com/q/24543179

http://stackoverflow.com/comment/38089150
has text: As mentioned in this question: [link](http://stackoverflow.com/questions/6241927/why-are-custom-objects-not-equivalent-keys-for-a-hashmap) the problem was that I had to add `public boolean equals(Object other)` and `public int hashCode()` to make the hashmap.get() method work, now the total program (with the 49 loops) takes around 1 ms, which is fair enough :D Thanks for helping everyone !
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24586308

http://stackoverflow.com/comment/39124617
comment on: http://stackoverflow.com/a/25038161
has text: Back in J2EE days when I was developing an app running on JBoss, there used to be a specific ejb xml descriptor where the transaction properties could be overridden for each EJB method. Alternatively, you could use BMT and set: connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); before starting a transaction and reset it back to the previous value right before existing.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38022179
type: QuestionComment
has text: Any logcat error? if don't can you try placing some log lines to find where does it stop parsing ?
score: 0
comment on: http://stackoverflow.com/q/24550603
type: Comment

http://stackoverflow.com/q/24513576
has comment: http://stackoverflow.com/comment/37955410
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has title: Opening database connection with the SQLITE_OPEN_NOMUTEX flag in Java
has answer: http://stackoverflow.com/a/24536144
type: Question
has body: After reading the Sqlite documentation I wanted to make sure that by run-time the connection to the database is in the correct mode. Class.forName("org.sqlite.JDBC"); Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:"); I'm using the Sqlite JDBC driver. How can I add the SQLITE_OPEN_NOMUTEX flag?
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37952421
tagged with: jdbc
linked to: http://stackoverflow.com/q/7801361

http://stackoverflow.com/a/24429708
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24429677
has body: In your constructor, you declared a new local variable: public PrepaidCard(String id, int token) {// My Second Constructor String cardID = id; //This should be cardID = id; tokenBalance = token; } Depending on your IDE, you may enable warnings that could tell you about uninitialized private members.
answers question: http://stackoverflow.com/q/24429677

http://stackoverflow.com/comment/37916742
type: QuestionComment
comment on: http://stackoverflow.com/q/24493627
score: 0
has text: Could you post some code?
type: Comment

http://stackoverflow.com/q/24581662
has comment: http://stackoverflow.com/comment/38079933
has answer: http://stackoverflow.com/a/24581740
favorite count: 0
has comment: http://stackoverflow.com/comment/38079829
type: Question
downvote count: 2
has comment: http://stackoverflow.com/comment/38079923
score: -2
answer count: 1
tagged with: java
has title: ArrayList size returns 0
has body: In my populateArrayEnemy method i populate array with 20 objects and at the end print them all. But in my paint and update methods enemyShip.size returns 0. Where did I go wrong? Update: My main method is below. public class ActionEnemyShip { EnemyShip es; public ArrayList&lt;EnemyShip&gt; enemyShip = new ArrayList&lt;EnemyShip&gt;(); // Updating coordinates method ////////////// public void populateArrayEnemy(MainClass mc){ int Min = 0, Max=800, result; for (int i =0; i &lt;=20; i++){ x = Min + (int)(Math.random() * ((Max - Min) + 1)); y = 0 + (int)(Math.random() * ((600 - 0) + 1)); EnemyShip es = new EnemyShip(x,y); enemyShip.add(es); } System.out.println(enemyShip); } public void update(MainClass mc, Player p){ for (int i = 0; i &lt; enemyShip.size(); i++ ) { EnemyShip es = new EnemyShip(); es = enemyShip.get(i); es.setX(es.getX()+ENEMY_SHIP_SPEED); enemyShip.set(i, es); } } // Paint method ////////////////////// public void paint(Graphics g, MainClass mc) { url = mc.getDocumentBase(); enemyShipImg = mc.getImage(url, "craft.png"); System.out.println(" paint "+enemyShip.size()); for (int i = 0; i &lt; this.enemyShip.size(); i++){ EnemyShip es = new EnemyShip(); es = this.enemyShip.get(i); g.drawImage(enemyShipImg, es.getX(), es.getY(), mc); } Here's my main method public void init() { setSize(800, 600); es = new EnemyShip(); as = new ActionEnemyShip(); //as.populateArrayEnemy(mc); } public void start() {thread.start();} public void destroy() {running = false;} public void stop() {running = false;} public void run() { while(running) { as.update(this, p); } public void paint(Graphics g){ as.paint(g, this); }
accepted answer: http://stackoverflow.com/a/24581740
has comment: http://stackoverflow.com/comment/38079913
has comment: http://stackoverflow.com/comment/38079851
has comment: http://stackoverflow.com/comment/38079936
upvote count: 0
has comment: http://stackoverflow.com/comment/38079852
has comment: http://stackoverflow.com/comment/38079903
tagged with: arraylist
type: AnsweredQuestion
tagged with: applet

http://stackoverflow.com/comment/38025897
comment on: http://stackoverflow.com/a/24547493
score: 0
type: Comment
has text: I do not know if a `PropertySourcesPlaceholderConfigurer` can be configured outside of the `ApplicationContext` I always have them declared in the xml file as ` <property name="locations" value="classpath:config"/> `
type: AnswerComment

http://stackoverflow.com/a/24478153
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24448850
score: 0
has body: You can consider replacing your enum type with a actual class type leveraging the Jackson's polymorphic deserialization. In this case Jackson will create an instance of a certain type depending on the value of the type property. Here is an example: public class JacksonPolymorphic { public static String JSON = "{\n" + " \"facility-no\": \"2011\",\n" + " \"standard-counter\": [\n" + " {\n" + " \"id\": \"0\",\n" + " \"type\": \"0\",\n" + " \"text\": \"Gebucht\",\n" + " \"free\": \"0\",\n" + " \"present\": \"0\",\n" + " \"percent\": \"100\",\n" + " \"max\": \"0\",\n" + " \"status\": \"Frei\",\n" + " \"status-value\": \"0\"\n" + " }\n" + "]\n" + "}"; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public static abstract class Counter { private final String id; public Counter(String id) { this.id = id; } } public static class Counters { private final String facilityId; private final List&lt;Counter&gt; counters; public Counters(@JsonProperty("facility-no") String facilityId, @JsonProperty("standard-counter") List&lt;Counter&gt; counters) { this.facilityId = facilityId; this.counters = counters; } @Override public String toString() { return "Counters{" + "facilityId='" + facilityId + '\'' + ", counters=" + counters + '}'; } } @JsonTypeName("0") public static class XCounter extends Counter { private final String text; private final int free; private final int present; private final float percent; private final int max; private final String status; private final int statusValue; public XCounter(@JsonProperty("id") String id, @JsonProperty("text") String text, @JsonProperty("free") int free, @JsonProperty("present") int present, @JsonProperty("percent") float percent, @JsonProperty("max") int max, @JsonProperty("status") String status, @JsonProperty("status-value") int statusValue) { super(id); this.text = text; this.free = free; this.present = present; this.percent = percent; this.max = max; this.status = status; this.statusValue = statusValue; } @Override publi…
type: Answer
answers question: http://stackoverflow.com/q/24448850

http://stackoverflow.com/a/24580380
has comment: http://stackoverflow.com/comment/38077449
type: Answer
answers question: http://stackoverflow.com/q/24579288
score: 0
has body: A great solution to this problem would be using the Observer pattern. With this pattern you have Observers and Observables. Observers can observe Observables (hence the name). The Obervable does not care if any Observer is observing him. The solution I have made has two classes, the Main class (Observer) and the Chronometer class (Observable). The Main class adds itself as an Observer to the Chronometer object and the method void update(Observable, Object) will be ran when the Observerable has something to notify. The Chronometer is not using a Timer anymore. Instead it is using a Thread which will sleep for 10 seconds, after which it sets the state to modified and it notifies all Observers, thus calling the void update(Observable, Object). With this implementation, the Chronometer will notify every Observer when it's done. This will allow you to know when the View has to be updated. EDIT: I have changed the implementation of the run and update methods so the Observer is notified every second. Main class: public class Main implements Observer{ public static void main(String[] args) { Main m = new Main(); Chronometer c = new Chronometer(2014, 7, 4, 13, 46, 21, (byte) 0); c.addObserver(m); c.run(); try { Thread.sleep(200000); } catch (InterruptedException e) { e.printStackTrace(); } } @Override public void update(Observable arg0, Object arg1) { int time = (int)arg1; if(time &gt; 0){ System.out.println("Time left: " + time); } else { System.out.println("The time's over!"); //Update View } } } Chronometer: public class Chronometer extends Observable implements Runnable{ private DateFormat format = new SimpleDateFormat("ss"); private Calendar calendar = Calendar.getInstance(); private final byte countType; public static final byte PROGRESSIVE = 1; public static final byte REGRESSIVE = -1; public Chronometer(int years, int months, int days, int hours, int minutes, int seconds, byte countType) { calendar.set(years, months, days, hours, minutes, seconds); this.countType = c…

http://stackoverflow.com/q/24571354
answer count: 1
tagged with: data-structures
score: 0
has comment: http://stackoverflow.com/comment/38060894
has comment: http://stackoverflow.com/comment/38060733
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24571618
has title: appropriate data structure, in time effiency and less storage concern?
has comment: http://stackoverflow.com/comment/38060744
tagged with: java
has body: I will probably have keyword,value pair shown at below in my code. Keyword will be unique words, and value will likely be hash table. For this configurarion, what should be appropriate data structure, in time effiency and less storage concern ? keyword(String) value(HashMap&lt;int, object of (String, float, ...)&gt;) stat -----&gt; hash table 1 hash table 2 hash table 3 goog -----&gt; hash table ... yand -----&gt; hash table 1 hash table 2
type: Question

http://stackoverflow.com/comment/37897240
type: QuestionComment
has text: Can you see the connection between `ccc LLL/yyyy` & `Sun Jan/2015`? Check out [the docs](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html).
comment on: http://stackoverflow.com/q/24483172
score: 0
type: Comment

http://stackoverflow.com/comment/37930224
type: Comment
type: QuestionComment
has text: Tried this for(List<String> ls2d : ls) but eclipse error. keeps asking me to change ls2d to string for(String ls2d : ls)
comment on: http://stackoverflow.com/q/24500962
score: 0

http://stackoverflow.com/comment/37814402
type: AnswerComment
has text: The "package Controller;" line at the top of the class should put the class into the Controller package, so it would be in a separate file than the other class.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24437944

http://stackoverflow.com/comment/38217298
has text: It partially helped, in the end I dropped out the WS2007HttpBinding with secure conversation hosted on http for a custom binding with security conversation disabled and hosted it on https to ensure confidentiality. Then I've bumped into problems with parsing binding from wsdl and upgrading CXF finally made it working. I've upgraded it from 2.6.1 to 2.6.14.
type: AnswerComment
comment on: http://stackoverflow.com/a/24536930
score: 0
type: Comment

abstract-class
tags question: http://stackoverflow.com/q/24567632
type: Tag
tags question: http://stackoverflow.com/q/24575618
tags question: http://stackoverflow.com/q/24445247
tags question: http://stackoverflow.com/q/24431409
tag name: abstract-class
tags question: http://stackoverflow.com/q/24443977

http://stackoverflow.com/comment/37950580
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24512068
has text: My last bullet would be to check if you really have value for middleName in the form used by the `jsp`. For sure the problem isn't in the code you posted.

http://stackoverflow.com/comment/37876440
type: AnswerComment
has text: To clarify, I do want the welcome page to be authenticated. Right now it is my only page. When I access /welcome, it redirects me to /login, and I get the login page generated by spring security. Ive tried a invalid and valid username and it works correctly. When I put in the correct credentials, It goes back to /welcome and then I get a 404 error and it is not invoking the controllers. It seems like spring security is working correctly, but it broke the mvc part of the application.
type: Comment
comment on: http://stackoverflow.com/a/24470952
score: 0

http://stackoverflow.com/comment/38070070
comment on: http://stackoverflow.com/a/24575822
has text: Not expert on Sardine, but if you look on Sardine source on GitHub (SardineImpl.java) you will see what exactly they are doing with HttpClient they obtain via HttpClientBuilder. So you can modify behaviour by decorating this class if there is no other public API in Sardine itself.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37908182
has text: I have changed all of my onAreaTouched methods and I applyForceToCenter instead of setting velocity directly and it worked. Thanks for your help
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24477585

http://stackoverflow.com/a/36843366
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24446783
type: AcceptedAnswer
downvote count: 0
has body: Ok I figured out that the problem was not that the JSESSIONID wasn't sent correctly. But my login was incorrect and my query to get the user from database. The correct login-post ClientHttpResponse response = restTemplate.execute( "http://localhost:8080/messenger-webapp/login", HttpMethod.POST, new RequestCallback() { @Override public void doWithRequest(ClientHttpRequest request) throws IOException { request.getBody().write(("username=" + user + "&amp;password=" + pw).getBytes()); } }, new ResponseExtractor&lt;ClientHttpResponse&gt;() { @Override public ClientHttpResponse extractData(ClientHttpResponse response) throws IOException { return response; } }); The correct query String authQuery = "select u.userid, r.role_name from user u, role r, user_role a where u.dbid = a.user_id and r.dbid = a.role_id and u.userid = ?"; I hope this will help other people. If anyone has an alternative please let me know.
type: Answer
answers question: http://stackoverflow.com/q/24446783

http://stackoverflow.com/q/24463140
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37859476
type: Question
has comment: http://stackoverflow.com/comment/37859223
has comment: http://stackoverflow.com/comment/37859238
has comment: http://stackoverflow.com/comment/37859287
has comment: http://stackoverflow.com/comment/37859272
has comment: http://stackoverflow.com/comment/37859275
has answer: http://stackoverflow.com/a/24463169
accepted answer: http://stackoverflow.com/a/24463308
answer count: 3
has comment: http://stackoverflow.com/comment/37859231
has comment: http://stackoverflow.com/comment/37859445
has body: I'm facing a problem that i really don't understand. I designed my program to read info from files and then generate reports about it. At the first time, I open all the files that I need: clientesarq = new File(args[1]); fornecedoresarq = new File(args[3]); produtosarq = new File(args[5]); then I use a java.util.Scanner to loop through them: leitor = new Scanner(clientesarq); leitor.nextLine(); /* leitura e armazenamento dos clientes em mapa */ while(leitor.hasNextLine()) { Cliente c = pd.novoCliente(leitor); clientes.addCliente(c); } leitor = new Scanner(fornecedoresarq); leitor.nextLine(); /* leitura e arazenaento dos fornecedores em mapa */ while(leitor.hasNextLine()) { Fornecedor f = pd.novoFornecedor(leitor); fornecedores.addFornecedor(f); } when my program reaches this part of the code, the JVM throws to me NoSuchElementException. leitor = new Scanner(produtosarq); leitor.nextLine(); /* EXCEPTION HERE */ /* leitura e armazenamento dos produtos em mapa */ while(leitor.hasNextLine()) { Produto p = pd.novoProduto(leitor); produtos.addProduto(p); } I really want to know why the hell I am getting this excpetion, as you can see, the code is exactly the same as the other ones. Any? You can get all needed files here: https://www.dropbox.com/sh/c48roudfwuj7qzu/AAAMn_OFGXJFHEjVJyZ7piCPa
has comment: http://stackoverflow.com/comment/37859439
has title: jvm throwing NoSuchElementException when using Scanner
has comment: http://stackoverflow.com/comment/37859228
favorite count: 0
has comment: http://stackoverflow.com/comment/37859251
has comment: http://stackoverflow.com/comment/37859257
has comment: http://stackoverflow.com/comment/37859295
has comment: http://stackoverflow.com/comment/37859268
possible better answer: http://stackoverflow.com/a/24464369
has comment: http://stackoverflow.com/comment/37859253
linked to: http://stackoverflow.com/q/20311266
score: -1
linked to: http://stackoverflow.com/q/11871520
has answer: http://stackoverflow.com/a/24464369
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24463308
has comment: http://stackoverflow.com/comment/37859345
tagged with: java

http://stackoverflow.com/a/24441977
type: Answer
has comment: http://stackoverflow.com/comment/37864387
answers question: http://stackoverflow.com/q/24441831
score: 0
has body: Just as Edward said below, switch statements don't work with regular (?) objects. They only work with int, short, char, and byte types. They also work with enums. Here's my suggestion - use a if/else if statement and add action listeners to all of the buttons, so they link to the actionPerformed method: @Override public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if(o.equals(b1)) display.setText(display.getText()+"1"); else if(o.equals(b1)) display.setText(display.getText()+"1"); else if(o.equals(b2)) display.setText(display.getText()+"2"); else if(o.equals(b3)) display.setText(display.getText()+"3"); else if(o.equals(b4)) display.setText(display.getText()+"4"); else if(o.equals(b5)) display.setText(display.getText()+"5"); else if(o.equals(b6)) display.setText(display.getText()+"6"); else if(o.equals(b7)) display.setText(display.getText()+"7"); else if(o.equals(b8)) display.setText(display.getText()+"8"); else if(o.equals(b9)) display.setText(display.getText()+"9"); else if(o.equals(b10)) display.setText(display.getText()+"*"); else if(o.equals(b11)) display.setText(display.getText()+"0"); else if(o.equals(b12)) display.setText(display.getText()+"#"); }

http://stackoverflow.com/comment/38047142
has text: Ya compare and see if they are equal like Registered,UnRegistered etc as the devices in both the list are same.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24563891

http://stackoverflow.com/a/24526176
type: Answer
answers question: http://stackoverflow.com/q/24526019
has body: Also consider Table collection provided by Google Guava library. ArrayTable is an implementation based on 2D array.
score: 0

http://stackoverflow.com/comment/37831722
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24448292
has text: You can try `Java reflection`!
score: 0

http://stackoverflow.com/comment/38121444
comment on: http://stackoverflow.com/q/24530714
type: QuestionComment
type: Comment
has text: Can you describe the specific error that you're getting better? Have you got logcat entries corresponding to these operations?
score: 0

http://stackoverflow.com/a/24524833
type: Answer
upvote count: 6
has body: Object x = new String(); // pointing to a String and saying - Hey, Look there! Its an Object String x = new String();// pointing to a String and saying - Hey, Look there! Its a String More importantly : The methods of String that can be accessed depend on the reference. For example : public static void main(String[] args) { Object o = new String(); String s = new String(); o.split("\\."); // compile time error s.split("\\."); // works fine }
score: 6
answers question: http://stackoverflow.com/q/24524811
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24524811

http://stackoverflow.com/a/47776145
downvote count: 0
type: Answer
upvote count: 2
has body: You can achieve this by not adding the comment node to your document, but instead partially transforming your document. First transform your own XML processing instruction and comment separately, and then the rest of document: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new FileInputStream(new File("abc.xml"))); Result output = new StreamResult(new File("abc.xml")); Source input = new DOMSource(doc); // xml processing instruction and comment node ProcessingInstruction xmlpi = doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\""); Comment comment = doc.createComment("DO NOT EDIT THIS FILE"); // first transform the processing instruction and comment transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(new DOMSource(xmlpi), output); transformer.transform(new DOMSource(comment), output); // then the document transformer.transform(input, output);
answers question: http://stackoverflow.com/q/24551962
score: 2
has comment: http://stackoverflow.com/comment/121590518

http://stackoverflow.com/q/24475044
upvote count: 1
tagged with: android
answer count: 1
has body: Unable to retrieve data in listview form SQLite .When I run the app my app is crashes. I don't know where is the actual problems. Can someone help me out how to retrieve all the data in listview. Thanks in Advance. Here is my Adapter code. public class EmployeeList_Adapter extends BaseAdapter { Context context; ArrayList&lt;Employee&gt; Employee_List; public EmployeeList_Adapter(Context context, ArrayList&lt;Employee&gt; employee_List) { super(); this.context = context; Employee_List = employee_List; } @Override public int getCount() { // TODO Auto-generated method stub return Employee_List.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return Employee_List.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup arg2) { // TODO Auto-generated method stub Employee EmployeeListItems = Employee_List.get(position); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.staff_employee_list_item, null); } TextView tvEmpId = (TextView) convertView.findViewById(R.id.textViewStaff_emp_Id); tvEmpId.setText(EmployeeListItems.getEmployeeId()); TextView tvName = (TextView) convertView.findViewById(R.id.textViewStaff_Emp_ame); tvName.setText(EmployeeListItems.getName()); TextView tvDepartment = (TextView) convertView.findViewById(R.id.textViewStaff_Emp_Department); tvDepartment.setText(EmployeeListItems.getDepartment()); TextView tvDesignation = (TextView) convertView.findViewById(R.id.textViewStaff_Emp_Designation); tvDesignation.setText(EmployeeListItems.getDesignation()); return convertView; } } Here is my Activity code public class Employee_List extends Activity { DatabaseHelper databaseHelper = new DatabaseHelper(this); Context mContext; Employee emp; protected SQLiteDatabase db; prot…
has answer: http://stackoverflow.com/a/24475112
favorite count: 0
tagged with: android-sqlite
type: AnsweredQuestion
has title: Resource NotFound Exception of TextView in Android
score: 1
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/24475112

http://stackoverflow.com/comment/52333112
type: QuestionComment
has text: Update: This issue was fixed in version 4.2.0 as per github.com/ebean-orm/avaje-ebeanorm/issues/158
comment on: http://stackoverflow.com/q/24552966
score: 0
type: Comment

http://stackoverflow.com/comment/38058792
score: 0
type: Comment
type: QuestionComment
has text: I found the answer. You can use method CrawlController.setCustomData(Object customData) to store data and than you can fetch your data from crawler by using WebCrawler.getMyController().getCustomData()
comment on: http://stackoverflow.com/q/24569689

http://stackoverflow.com/a/24626593
has comment: http://stackoverflow.com/comment/38579344
has comment: http://stackoverflow.com/comment/38183404
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/108473650
downvote count: 0
has comment: http://stackoverflow.com/comment/108454005
accepted answer of: http://stackoverflow.com/q/24582575
answers question: http://stackoverflow.com/q/24582575
has body: I have implemented a similar standalone client using Netbeans and GlassFish for a Java EE workshop and used the following code for it: InitialContext ctx = new InitialContext(); GreetingBeanRemote ref = (GreetingBeanRemote) ctx.lookup("java:global/JWS2_JEE5_Server/JWS2_JEE5_Server-ejb/GreetingBean"); String result = ref.greet("Hello"); Note the JNDI name, which uses the format java:global/&lt;app-name&gt;/&lt;module-name&gt;/&lt;bean-name&gt;, which might help you using the correct name, if that ist the problem. Another thing to try in this regard is using the mappedName attribute int the @Stateless annotation (e.g. @Stateless(mappedName="MySessionBean")), which works for GlassFish. Concerning your exception, it suggests that the naming itself is not the problem, but more the classpath or the artefact you deployed. My setup in Netbeans is as follows: Client project, containing the standalone client Server project, containing the EJB implementation Lib project, containing the EJB remote interface Client project is referencing the lib project Lib project is referencing the javaee-api jar Maybe the information helps in setting it up correctly. EDIT 14/07/11: Here's a step-by-step tutorial on how to create the above scenario with Netbeans (8): Requirements: Netbeans EE edition (8) with GlassFish 4 installed, JDK 1.7 or above New project/Java EE/Enterprise Application: "MyEnterpriseApplication", create EJB module, Java EE 6, GlassFish 4 New project/Java/Java Class Library: "MyJavaLibrary" New project/Java/Java Application: "MyJavaApplication" in MyJavaApplication: Properties/Libraries/Add project: MyJavaLibrary, Add JAR: gf-client.jar from GlassFish installation lib folder in MyEnterpriseApplication-ejb: New SessionBean "HelloBean", create remote interface, select project MyJavaLibrary in MyJavaLibrary: edit "HelloBeanRemote", add [1] in MyEnterpriseApplication-ejb:edit "HelloBean", add [2] in MyJavaApplication: edit "MyJavaApplication", add [3] in main run MyEnterpriseA…
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38190897

http://stackoverflow.com/a/25212793
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24437564
has body: I did this to solve the same issue (in OS X): Help > Install New Software > Add or select this repository "http://download.eclipse.org/eclipse/updates/4.3" Under "Eclipse platform" select the newest version of Eclipse. The installer will ask if you want to uninstall the ADT, click finish. Restart Eclipse and install ONLY the ADT 23 using this repository: https://dl-ssl.google.com/android/eclipse. Restart Eclipse and install DDMS, Hierarchy Viewer, Trace View etc. Restart Eclipse again. Hope it helps.

http://stackoverflow.com/comment/37936170
comment on: http://stackoverflow.com/q/24504298
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Is there a max size for POST parameter content?](http://stackoverflow.com/questions/2943477/is-there-a-max-size-for-post-parameter-content)

http://stackoverflow.com/a/24673424
type: Answer
answers question: http://stackoverflow.com/q/24488455
score: 0
has body: Try experiment with hibernate.default_batch_fetch_size property. By default it's set to 1. This will load only first entity from your collection. Increasing it to ~size of the collection might help.

http://stackoverflow.com/comment/38006040
comment on: http://stackoverflow.com/q/24541672
has text: @user3580294, not true! LinkedBlockingQueue doesn't use two locks because one is insufficient: One lock can provide sufficient _safety_, but two can (in _that_ algorithm) provide the same level of safety with a better level of performance.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37800514
type: QuestionComment
score: 2
has text: Have a look: https://code.google.com/p/junitparams/wiki/MergingWithOtherRunners
comment on: http://stackoverflow.com/q/24431427
type: Comment

http://stackoverflow.com/a/24602591
has comment: http://stackoverflow.com/comment/46206535
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24520773
has comment: http://stackoverflow.com/comment/45972389
has comment: http://stackoverflow.com/comment/46250800
answers question: http://stackoverflow.com/q/24520773
upvote count: 1
type: AcceptedAnswer
has body: Actually I Found the way of detecting POS terminal transaction. The NFC API, TRANSACTION_DETECTED is hidden. When transaction is there, TagDetectedActivity will launch. &lt;activity android:name=".TagDetectedActivity" android:launchMode="singleTask"&gt; &lt;intent-filter&gt; &lt;action android:name="android.nfc.action.TRANSACTION_DETECTED" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:scheme="nfc" android:host="secure" android:port="0" android:pathPrefix="/axxxxx" /&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="com.gsma.services.nfc.action.TRANSACTION_EVENT" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:scheme="nfc" android:host="secure" android:port="0" android:pathPattern="/.*/axxxxx.*" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt;
type: Answer

http://stackoverflow.com/comment/37885175
score: 0
comment on: http://stackoverflow.com/q/24476878
type: QuestionComment
type: Comment
has text: `a little messy in height ` what does it means ?

http://stackoverflow.com/comment/37958595
score: 0
has text: I think one of the reasons is, so that one cannot unregister all registered observers. I also think its "nobody elses businness" who is listening to changes. I cannot think of another one but I'm sure there are some more.
type: Comment
comment on: http://stackoverflow.com/q/24515257
type: QuestionComment

http://stackoverflow.com/comment/37984786
type: Comment
comment on: http://stackoverflow.com/a/24510124
has text: That work around looks excellent. I thought you meant some other workaround for it. If so, Please share an example. It would be helpful to others as well.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24541603
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/38006773
has title: Calling functions from runnable
has comment: http://stackoverflow.com/comment/38006803
has comment: http://stackoverflow.com/comment/38006015
has comment: http://stackoverflow.com/comment/38006317
upvote count: 2
type: UnansweredQuestion
has body: I have a piece of code in an Android application, that is an implementation of Runnable. in my implementation of the method void run() I've called a function within the Activity itself, outside the Runnable implementation. The code looks as follows: Message msg = Message.obtain(null, Communicator.MSG_REFRESH_ASSIGNED_LOCATIONS, new Runnable() { @Override public void run() { Cursor assignedLocations = getAssignedLocations(); assignedLocations.moveToFirst(); //EXCEPTION HERE! NULL POINTER EXCEPTION!! if(!assignedLocations.isAfterLast()) { //some code } else { //some code } } }); The function is getAssignedLocations() and it returns a Cursor from a query to the sqlite. The getAssignedLocations() function works and does not return null when called from outside the implementation of Runnable (meaning from onResume or onCreate). Here is the code for getAssignedLocations(): /** * returns a cursor for all assigned locations in the local database * @return */ protected Cursor getAssignedLocations() { return getAssignedLocations(null); } /** * returns a cursor from the database with only one entry of which the loc_id is specificLoaction * if specificLocation is null, returns all assigned locations from the database * @param specificLocation * @return */ private Cursor getAssignedLocations(String specificLocation) { SQLiteDatabase db = personalLocations.getReadableDatabase(); String[] projection = { FeedEntry.COLUMN_NAME_LOC_ID, FeedEntry.COLUMN_NAME_LOC_NAME }; String orderBy = FeedEntry.COLUMN_NAME_LOC_NAME + " DESC"; if(specificLocation == null) { Cursor c = db.query(FeedEntry.TABLE_NAME, projection, null, null, null, null, orderBy); return c; } String[] arguments = {specificLocation}; Cursor c = db.query(FeedEntry.TABLE_NAME, projection, FeedEntry.COLUMN_NAME_LOC_ID + "=?", arguments, null, null, orderBy); return c; } Can anyone explain why I'm getting a null pointer exception? Is passing a non static function to the Runnable interface does not suppose to work?
has comment: http://stackoverflow.com/comment/38006160
has comment: http://stackoverflow.com/comment/38006653
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38005874
has answer: http://stackoverflow.com/a/24563589
score: 2
has comment: http://stackoverflow.com/comment/38005654
has comment: http://stackoverflow.com/comment/38006903
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38005776
favorite count: 0
has comment: http://stackoverflow.com/comment/38006183
has comment: http://stackoverflow.com/comment/38006382

http://stackoverflow.com/q/24509725
linked to: http://stackoverflow.com/q/438146
favorite count: 0
accepted answer: http://stackoverflow.com/a/24509765
answer count: 3
upvote count: 1
has body: Using hibernate4 SessionFactory factory = new Configuration().configure() .buildSessionFactory(); Session session = factory.openSession(); session.beginTransaction(); //do some task session.getTransaction().commit(); session.close(); factory.close(); Using auto generated proprty create-drop as you can see I am closing my session factory it drops all my tables after this code completed as I see on console. Is it the default behaviour
possible better answer: http://stackoverflow.com/a/24509775
type: Question
has answer: http://stackoverflow.com/a/24511392
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24509775
has answer: http://stackoverflow.com/a/24509765
score: 1
tagged with: java
tagged with: hibernate
has title: Hibernate session factory close drops all auto generated tables
downvote count: 0

http://stackoverflow.com/comment/37866607
score: 0
type: Comment
has text: I can't open eclipse, I was following a proccess of an stackoverflow user in order to repair an error. I uninstalled "Developer Tools" and then I couldn't open Eclipse, so I need other way. Thanks @Robert Rowntree
comment on: http://stackoverflow.com/a/24466915
type: AnswerComment

http://stackoverflow.com/q/24455809
downvote count: 1
type: Question
has title: Analyzing Java code across Eclipse projects
has answer: http://stackoverflow.com/a/24479372
has comment: http://stackoverflow.com/comment/37846558
tagged with: eclipse
has body: We want to use Rascal to find all unused public methods in a collection of Java projects in an Eclipse workspace. I have just learned how to create a model of a Java project in Eclipse using createM3FromEclipseProject and navigate that. But this takes only one project into account. How do I perform this analysis across all Java projects in my workspace?
score: 0
answer count: 2
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: rascal
has answer: http://stackoverflow.com/a/24493855
tagged with: java

http://stackoverflow.com/a/24524036
has body: You are not clear about where to show it! But if you want to show a Toast, you can try this: Toast.makeText(getApplicationContext(), edtText.getText.toString(), Toast.LENGTH_SHORT).show(); If you want to show in logcat, you can try this: System.out.println("you entered: "+edtText.getText.toString());
type: Answer
accepted answer of: http://stackoverflow.com/q/24523994
answers question: http://stackoverflow.com/q/24523994
has comment: http://stackoverflow.com/comment/37972270
has comment: http://stackoverflow.com/comment/37972311
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24603174
downvote count: 0
has body: You can't use the support library with rs_graphics.rsh. It doesn't support objects like rs_mesh, rs_font, or rs_program*. The support library is only for accessing RenderScript compute.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24560313
has comment: http://stackoverflow.com/comment/38121174
accepted answer of: http://stackoverflow.com/q/24560313
type: AcceptedAnswer

http://stackoverflow.com/q/24433335
tagged with: puppet
linked to: http://stackoverflow.com/q/24467249
tagged with: maven
has body: I have the following two manifests: class profile::maven inherits profile::base { # Hiera $version = hiera('profile::maven::version', '3.2.1') $settings = hiera_hash('profile::maven::settings', undef) $environments = hiera_hash('profile::maven::environments', undef) # Dependencies require '::profile::java' # Modules class { '::maven::maven': version =&gt; $version, } if ($settings) { create_resources('::maven::settings', $settings) } if ($environments) { create_resources('::maven::environments', $environments) } } and class profile::java inherits profile::base { # Hiera $distribution = hiera('profile::java::distribution', 'jdk') $version = hiera('profile::java::version', 'present') # Modules class { '::java': distribution =&gt; $distribution, version =&gt; $version, } # Parameters $java_home = $::java::java_home file { 'profile-script:java.sh': ensure =&gt; present, path =&gt; '/etc/profile.d/java.sh', content =&gt; template('profile/java.sh.erb'), } } I want that profile::java has completely finished before profile::maven is executed. The site.pplooks as follows and should not be modified in order to comply with puppet's role-profile approach later (work in progress): node 'gamma.localdomain' { include 'profile::java' include 'profile::maven' } After compilation the scripts starts with downloading the maven archive. Why does require '::profile::java' not ensure the execution order? Has someone an idea how to achieve the desired behavior?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24436746
tagged with: java
type: Question
answer count: 2
has title: Puppet "require" not working as expected
has answer: http://stackoverflow.com/a/36588359
score: 0
possible better answer: http://stackoverflow.com/a/36588359
has answer: http://stackoverflow.com/a/24436746

http://stackoverflow.com/a/24552056
type: Answer
answers question: http://stackoverflow.com/q/24551915
score: 10
upvote count: 10
has body: I,ve just found a solution @RequestMapping(value="/create", method=RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public String createRole(HttpServletRequest request) { Map&lt;String, String[]&gt; parameterMap = request.getParameterMap(); ... } this way i have a map of submitted parameters.
downvote count: 0

http://stackoverflow.com/comment/37853592
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24440060
score: 0
has text: You can create the main application as standard java application and let it start an embedded framework. It can then access services of the OSGi framework. In this case only the extensions would need to be bundles. See this for details http://stackoverflow.com/questions/24411334/how-do-you-call-an-osgi-application-from-a-non-osgi-application-and-vice-versa/24416516#24416516

http://stackoverflow.com/q/24448481
has comment: http://stackoverflow.com/comment/37832529
has answer: http://stackoverflow.com/a/24449039
has answer: http://stackoverflow.com/a/24448970
has body: My Android app fails to display the shared preferences that I set in a different class. Am I missing something in my code? I save them fine but they don't display in my main Activity. All I see is the default text when I run the app. I have tried all I can to no avail. I can't figure out where the problem is. Below are my code files: 1. MnsEditor.java public class MnsEditor extends Activity { private MsItem mnses; private Button saveBtn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mns_editor); Intent intent = this.getIntent(); mnses = new MsItem(); mnses.setStartKey(intent.getStringExtra("startKey")); mnses.setStartDate(intent.getStringExtra("StartDate")); mnses.setShiftKey(intent.getStringExtra("ShiftKey")); mnses.setShift(intent.getStringExtra("Shift")); mnses.setBKey(intent.getStringExtra("BKey")); mnses.setB(intent.getStringExtra("B")); mnses.setGKey(intent.getStringExtra("GKey")); mnses.setG(intent.getStringExtra("G")); mnses.setNxtKey(intent.getStringExtra("NxtKey")); mnses.setNxt(intent.getStringExtra("Nxt")); EditText ms = (EditText) findViewById(R.id.sdate); ms.setText(mnses.getStartDate()); EditText sh = (EditText) findViewById(R.id.sDay); sh.setText(mnses.getShift()); EditText bb = (EditText) findViewById(R.id.bB); bb.setText(mnses.getB()); EditText bg = (EditText) findViewById(R.id.bG); bg.setText(mnses.getG()); EditText nm = (EditText) findViewById(R.id.Nxt); nm.setText(mnses.getNxt()); saveBtn = (Button) findViewById(R.id.savePrefs); saveBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { saveAndFinish(); } }); } private void saveAndFinish() { EditText mst = (EditText) findViewById(R.id.stDay); String mnsesStart = mst.getText().toString(); EditText shi = (EditText) findViewById(R.id.ShiftDay); String shift = shi.getText().toString(); EditText bb = (EditText) findViewById(R.id.bbB); String bbb = b.getText().toString(); EditText gg = (EditTex…
has title: Android Shared Preferences using getter/setter methods fail to display
tagged with: java
has comment: http://stackoverflow.com/comment/37844429
tagged with: sharedpreferences
type: Question
has comment: http://stackoverflow.com/comment/37835197
tagged with: getter-setter
answer count: 3
tagged with: android
tagged with: findall
has answer: http://stackoverflow.com/a/24448996
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37866957
comment on: http://stackoverflow.com/q/24466801
has text: Post VendorDetailsActivity.java code. line 94
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38074793
has text: Possibly it's not working because: "initialValue: the choice that is initially selected; if null, then nothing will be initially selected; **only meaningful if options is used**" as per `JOptionPane` Javadoc
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24577674
type: Comment

http://stackoverflow.com/a/24563370
has body: You're not wrapping your &lt;dependency&gt; tags inside a single &lt;dependencies&gt; node.
type: Answer
answers question: http://stackoverflow.com/q/24563321
has comment: http://stackoverflow.com/comment/38046067
score: 0

ebean
tags question: http://stackoverflow.com/q/24452870
tags question: http://stackoverflow.com/q/24464812
tags question: http://stackoverflow.com/q/24552966
type: Tag
tag name: ebean

http://stackoverflow.com/a/24554970
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24554931
has body: you need to do javac first.. javac generates a .class file. And try using the full (absolute) path when using java command.
upvote count: 1
type: Answer

http://stackoverflow.com/q/24490918
tagged with: byte
has body: I have a Java app sending coordinates to a c# game in Unity. My data checks out with the exception of the negative values. I instead only get 63 or 250 something. Depending on the encoding. Here is my Java client app: @Override public void run() { //Keep in a loop as long as the running variable is true while(running) { //Try catch block to catch exceptions for the networking code try{ data1[0]=currentPlayer; // These are integers ..... data1[8]=sendPause; for(int i=0; i&lt;=9;i++){ buf1[i]=(byte)data1[i]; //Casting to byte array //System.out.println(buf1[i]); } //socket is created in "onCreate" earlier socket.setTcpNoDelay(true); out = socket.getOutputStream(); dos = new DataOutputStream(out); dos.write(buf1, 0, buf1.length); dos.flush(); synchronized(this){ this.wait(30); } //This is to minimize the frequency }catch(Exception e) { Log.e("TCP", "Error",e); } } } This is my method for receiving in the C# server. private void HandleClient(TcpClient client){ try{ byte[] bytes = new byte[256]; String data = null; while(true) { data = null; NetworkStream stream = client.GetStream(); int i; while((i = stream.Read(bytes, 0, bytes.Length))!=0) { data = System.Text.Encoding.ASCII.GetString(bytes, 0, i); byte[] msg = System.Text.Encoding.UTF8.GetBytes(data); /*sbyte[] sbytes = new sbyte[msg.Length]; for (int j = 0; j &lt; msg.Length; j++) sbytes[j] = (sbyte)msg[j]; Debug.Log(sbytes[2]+" "+sbytes[3]);*/ packetID=msg[0]; switch(packetID){ case 1: p1.joyLx = msg[1]; .... p1.pause = msg[8]; p1.active=true; break; .... case 4: p4.joyLx = msg[1]; .... p4.active=true; break; } } client.Close(); } } catch(SocketException e) { Debug.Log("SocketException:"+e); } } I've been looking into the whole signed/unsigned byte ordeal but I'm worried that upon saving it into a byte array beforehand is erasing this data. P.S. this is my first visit here and I'm not really a programmer so I've probably missed something obvious. So sorry if I'm not accustomed... Got it working! Thanks for the help …
type: AnsweredQuestion
tagged with: tcp
tagged with: java
type: Question
tagged with: c#
tagged with: network-programming
has comment: http://stackoverflow.com/comment/37911622
has title: Java Client to C# server. Not receiving negative numbers
score: 0
has answer: http://stackoverflow.com/a/24491123
accepted answer: http://stackoverflow.com/a/24491123
answer count: 1
has comment: http://stackoverflow.com/comment/37913676
has comment: http://stackoverflow.com/comment/37911860

http://stackoverflow.com/comment/38030577
type: Comment
comment on: http://stackoverflow.com/a/24553313
has text: my method is `public void selectDepartment(Department dep)..`.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37842131
comment on: http://stackoverflow.com/a/24453927
score: 0
type: Comment
has text: no, in Swing you shouldn't go so low-level :-) Instead use a DocumentFilter.
type: AnswerComment

http://stackoverflow.com/comment/37962362
score: 0
comment on: http://stackoverflow.com/q/24511769
type: Comment
type: QuestionComment
has text: I don't disagree, I'm just saying that in practice, you often need more than what TCP offers, which is probably what @ShaneWealti was also probably alluding to.

http://stackoverflow.com/a/24531340
has comment: http://stackoverflow.com/comment/37992546
answers question: http://stackoverflow.com/q/24530719
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37985760
downvote count: 0
score: 1
has body: You can try the spring:eval tag &lt;jsp:directive.attribute name="object" type="java.lang.Object" required="true" description="The form backing object" /&gt; &lt;jsp:directive.attribute name="field" type="java.lang.String" required="true" description="The field name" /&gt; &lt;spring:eval expression="object[field]" /&gt;
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37992467
has comment: http://stackoverflow.com/comment/37991975
accepted answer of: http://stackoverflow.com/q/24530719

http://stackoverflow.com/q/24492182
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
has title: Is using a 'Data Class' a bad idea in this scenario?
tagged with: java
has comment: http://stackoverflow.com/comment/37914172
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24492268
tagged with: anti-patterns
possible better answer: http://stackoverflow.com/a/24492418
has body: I'm currently working with what you could call legacy code at work. I basically have a class that deals with the workflow and is only instantiated once every time the machine is booted up. Each time a new user uses this machines and logs onto it, a new "session" is started, but we keep the same instance of this class. To keep things simple lets say this machine is a self service machine. This basically means every time a new user session starts, we need to reset all the flow variables back to their default values. So normally I would have instance/member variables such as: boolean didUserPressYes; boolean didUserTakeHisReceipt; int numberOfInsertedItems; and then a resetVars() method that is called at the start of the flow/user session: public void resetVars() { didUserPressYes = false; didUserTakeHisReceipt = false; numberOfInsertedItems = 0; } Normally I would just reinstantiate this class and avoid having this resetVars() method. Unfortunately, we are tied to a framework that does not allow us to do this and we must keep the same instance of the class. In our actual code we have about 12 of these variables, and will almost certainly add more in the future. I can see great potential for bugs where these variables are not properly reset to their default value when each user session starts - especially if someone new comes onto the project and forgets to add his new variables into this resetVars() method. To work around this issue I have made a WorkflowVariables class that contains these variables and has getters and setters where appropiate, and a couple of small utility methods. At the start of each user session we simply reinstantiate this WorkflowVariables class and can now know for a fact that all the variables have been put back to their default values. No need to worry about certain instance variables not being reset, as we just have one: private WorkFlowVariables workFlowVariables; public void resetVars() { workFlowVariables = new WorkFlowVariables(); } Howe…
has answer: http://stackoverflow.com/a/24492418
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24492268

http://stackoverflow.com/a/24433881
type: Answer
score: 1
upvote count: 1
has body: I think the problem might be in the writing to the parcel : dest.writeList(backup_contacts); should be dest.writeStringList(backup_contacts); public final void writeStringList (List val) Added in API level 1 Flatten a List containing String objects into the parcel, at the current dataPosition() and growing dataCapacity() if needed. They can later be retrieved with createStringArrayList() or readStringList(List).
answers question: http://stackoverflow.com/q/24433603
downvote count: 0

http://stackoverflow.com/a/53519564
type: Answer
has comment: http://stackoverflow.com/comment/94185362
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24474838
has body: For non-infinite streams, if you have access to the source, its straight forward: @Test public void testName() throws Exception { List&lt;Integer&gt; integers = Arrays.asList(1, 2, 4, 5, 6, 7, 8, 9, 10); Stream&lt;Integer&gt; stream1 = integers.stream(); Stream&lt;Integer&gt; stream2 = integers.stream(); stream1.forEach(System.out::println); stream2.forEach(System.out::println); } prints 1 2 4 5 6 7 8 9 10 1 2 4 5 6 7 8 9 10 For your case: Stream originalStream = IntStream.range(1, 100).filter(n -&gt; n % 2 == 0) List&lt;Integer&gt; listOf = originalStream.collect(Collectors.toList()) Stream stream14 = listOf.stream().filter(n -&gt; n % 7 == 0); Stream stream10 = listOf.stream().filter(n -&gt; n % 5 == 0); For performance etc, read someone else's answer ;)
upvote count: 1

http://stackoverflow.com/comment/37835367
type: Comment
comment on: http://stackoverflow.com/a/24448970
has text: Let me try your suggestion. Please check the updated code files; I have added **4. MsItem.java** as you said. Yeah, I am saving the data and trying to retrieve it at the same time.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37823295
type: QuestionComment
comment on: http://stackoverflow.com/q/24443601
score: 0
has text: If `ID` is the primary key, you can just over write the records with new values in DB. For the null/blank value you might need a separate check if you want to delete the record itself.
type: Comment

http://stackoverflow.com/comment/37812586
type: QuestionComment
has text: You have written `compareAndSet(/* expected */ true` how is the value going to be `true`?
comment on: http://stackoverflow.com/q/24437784
score: 0
type: Comment

http://stackoverflow.com/a/24556829
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24556487
has body: It doesn't throw a ConcurrentModificationException because, as vandale said, the iterator only checks for comodification on next(). Here's a portion of the Iterator instance returned by an ArrayList: public boolean hasNext() { return cursor != size; } @SuppressWarnings("unchecked") public E next() { checkForComodification(); int i = cursor; if (i &gt;= size) throw new NoSuchElementException(); Object[] elementData = ArrayList.this.elementData; if (i &gt;= elementData.length) throw new ConcurrentModificationException(); cursor = i + 1; return (E) elementData[lastRet = i]; } hasNext() simply looks to see if the cursor is pointing at the last index of the list. It doesn't check to see if the list was modified. Because of this you don't get an ConcurrentModificationException, it just stops iterating.
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/37910339
has text: Try to notify or reinitialize ur listview in onResume().
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24489107

future
tags question: http://stackoverflow.com/q/24529070
type: Tag
tag name: future

http://stackoverflow.com/q/24528068
tagged with: javascript
has comment: http://stackoverflow.com/comment/37979658
has comment: http://stackoverflow.com/comment/37979922
score: 0
has comment: http://stackoverflow.com/comment/37979611
answer count: 2
has answer: http://stackoverflow.com/a/24532410
has comment: http://stackoverflow.com/comment/37979918
has comment: http://stackoverflow.com/comment/37979973
possible better answer: http://stackoverflow.com/a/24529342
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/24529342
has comment: http://stackoverflow.com/comment/37979825
has comment: http://stackoverflow.com/comment/37979729
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24532410
has body: I have to get data from the file to my text box. I have tried a lot in Java Script but no solution can some one help me out. I get output as [object HTMLInputElement] always when i try to get data from the file. If i give fileinput.value then it shows File Name. If i add fileinput it shows [object HTMLInputElement] &lt;html&gt; &lt;body&gt; &lt;script language='JavaScript' type='text/javascript'&gt; function BrowseButtonAction() { var fileinput = document.getElementById('browse'); fileinput.click(); } function ChangeBrowseButton() { var fileinput = document.getElementById('browse'); var textinput = document.getElementById('filename'); textinput.value = fileinput.value; } &lt;/script&gt; &lt;input type='text' id='filename' name='filename'/&gt; &lt;input type='File' id='browse' name='fileupload' style='display: none' onChange='ChangeBrowseButton();'/&gt; &lt;input type='button' value='File You need' id='fakeBrowse' onclick='BrowseButtonAction();'/&gt; &lt;/body&gt; &lt;/html&gt;
has comment: http://stackoverflow.com/comment/37979684
has comment: http://stackoverflow.com/comment/37979863
type: Question
has title: Get File Data To the Text Box in HTML
has comment: http://stackoverflow.com/comment/37979760
tagged with: java

http://stackoverflow.com/comment/38086586
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24573688
has text: http://stackoverflow.com/a/22617924/573032
score: 0

http://stackoverflow.com/comment/37852104
type: Comment
type: QuestionComment
has text: The output does not come from what you posted. Please provide a minimal, runnable demonstration of the problem, and the output from *that* code.
comment on: http://stackoverflow.com/q/24456605
score: 0

http://stackoverflow.com/comment/37895425
score: 0
comment on: http://stackoverflow.com/q/24473035
type: QuestionComment
type: Comment
has text: Camel doesn't suppose to copy the properties in default aggregater, as it is hard to tell which property need to be copy if the exchanges use different properties. If you want to set the FILE_NAME, you can just put the custom process jut before the setHeader DSL.

http://stackoverflow.com/q/24579849
has comment: http://stackoverflow.com/comment/38092030
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/38076382
has comment: http://stackoverflow.com/comment/38076506
tagged with: collections
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24579898
tagged with: methods
has answer: http://stackoverflow.com/a/24579898
has body: I have an ArrayList item that holds Objects ArrayList&lt;Object&gt; nodeList; I fill it with records I retrieve form database like this //start loop nodeList.add(getResultSet().getString(i).trim()); //end loop Now, I want to get those results, so I create a "getter" method public Object getResults(){ for(int i = 0; i &lt; nodeList.size(); i++){ return nodeList.get(i); } } Netbeans tells me that return statement is missing, although I return every single object of the arrayList inside loop. How am I supposed to fix it? I tried to return an Array of Objects but it didn't work either. It's still in a loop an it wants to return something outside loop. Thank you in advance.
type: Question
has title: Get data from ArrayList inside method
answer count: 2
has comment: http://stackoverflow.com/comment/38076410
tagged with: arrays
has comment: http://stackoverflow.com/comment/38088062
has comment: http://stackoverflow.com/comment/38076620
has answer: http://stackoverflow.com/a/24579900
accepted answer: http://stackoverflow.com/a/24579900
has comment: http://stackoverflow.com/comment/38076650

http://stackoverflow.com/q/24510420
answer count: 2
has comment: http://stackoverflow.com/comment/37947013
has comment: http://stackoverflow.com/comment/37946923
has answer: http://stackoverflow.com/a/24510817
accepted answer: http://stackoverflow.com/a/24510817
has comment: http://stackoverflow.com/comment/37946641
has body: I want to match certain group of characters in a String independent of their order in the String using regex fucntion. However, the only requirement is that they all must be there. I have tried String elD = "15672"; String t = "12"; if ((elD.matches(".*[" + t + "].*"))) { System.out.println(elD); } This one checks whether any of the characters are present. But I want all of them to be there. Also I tried String elD = "15672"; String t = "12"; if ((elD.matches(".*(" + t + ").*"))) { System.out.println(elD); } This does not work as well. I have searched quite a while but I could not find an example when all of the characters from the pattern must be present in the String independent of their order. Thanks
tagged with: regex
has comment: http://stackoverflow.com/comment/37946679
has comment: http://stackoverflow.com/comment/37947090
possible better answer: http://stackoverflow.com/a/24510926
has comment: http://stackoverflow.com/comment/37946758
tagged with: java
has answer: http://stackoverflow.com/a/24510926
has title: match all characters in a string independent of their order in the sequence
type: Question
has comment: http://stackoverflow.com/comment/37946983
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37947337
score: 0

http://stackoverflow.com/comment/37965523
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24520439
has text: If you browsed over the tutorial you would see we are dynamically creating this class with strings, so I could not put a string object into a cast.

http://stackoverflow.com/q/24444361
has answer: http://stackoverflow.com/a/24444449
has answer: http://stackoverflow.com/a/24444631
accepted answer: http://stackoverflow.com/a/24444380
duplicate of: http://stackoverflow.com/q/21661251
has comment: http://stackoverflow.com/comment/37824513
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37824545
favorite count: 0
has answer: http://stackoverflow.com/a/24444469
has answer: http://stackoverflow.com/a/24444457
has answer: http://stackoverflow.com/a/24444476
possible better answer: http://stackoverflow.com/a/24444417
linked to: http://stackoverflow.com/q/12850676
linked to: http://stackoverflow.com/q/9440844
has answer: http://stackoverflow.com/a/24444417
has body: What does this do? int x = 1; int y = 2; int z = 3; x = y = z; I have come across multiple of this type of thing in a few open source projects and have always been confused by them. By them I mean the = operator being used twice on three integers i.e. x = y = z;. I need to understand this. Thanks!
linked to: http://stackoverflow.com/q/21661251
upvote count: 3
has answer: http://stackoverflow.com/a/24444422
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/37824524
answer count: 8
has answer: http://stackoverflow.com/a/24444380
has title: What does the = operator do when used twice on three integers?
score: 2

http://stackoverflow.com/q/24435711
has body: It is asked in an interview to write the code in Java to display the string which doesn't have consecutive repeated characters. E.g.: Google, Apple, Amazon; It should display "Amazon" I wrote code to find continues repeating char. Is there any algorithm or efficient way to find it?
tagged with: string
favorite count: 0
tagged with: character
type: Question
has title: Check a string for consecutive repeated characters
has comment: http://stackoverflow.com/comment/37810632
has comment: http://stackoverflow.com/comment/37808470
has answer: http://stackoverflow.com/a/24435995
has comment: http://stackoverflow.com/comment/37808371
upvote count: 2
score: 0
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/24435995
answer count: 1
has comment: http://stackoverflow.com/comment/37808753
has comment: http://stackoverflow.com/comment/37808410
has comment: http://stackoverflow.com/comment/37808488
type: AnsweredQuestion

http://stackoverflow.com/comment/37905733
type: Comment
type: AnswerComment
has text: either that or use instanceof and cast. (which wouldnt be typesafe x.x)
score: 0
comment on: http://stackoverflow.com/a/24487827

http://stackoverflow.com/a/24430711
score: 1
has body: Try this way,hope this will help you to solve your problem. TextView textview = (TextView) findViewById(R.id.textview); Intent in = getIntent(); String cuisine = in.getStringExtra("TAG_CUISINE_NAME"); String priceCategory = in.getStringExtra("TAG_PRICE_CATEGORY"); textview.setText(cuisine+","+priceCategory);
has comment: http://stackoverflow.com/comment/37799051
has comment: http://stackoverflow.com/comment/37799383
has comment: http://stackoverflow.com/comment/37800392
has comment: http://stackoverflow.com/comment/37800708
has comment: http://stackoverflow.com/comment/37801303
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37799381
has comment: http://stackoverflow.com/comment/37800904
accepted answer of: http://stackoverflow.com/q/24430656
has comment: http://stackoverflow.com/comment/37800147
type: Answer
answers question: http://stackoverflow.com/q/24430656
has comment: http://stackoverflow.com/comment/37800588
downvote count: 0

http://stackoverflow.com/a/24489578
has comment: http://stackoverflow.com/comment/37911603
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37912213
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37911121
has body: It probably happens because you are passing a request scoped bean to the other page. Once the request is finished, the bean exists no more. Try to use a larger scope like view to your bean. It should work fine. @ManagedBean @ViewScoped public class Block1Bean { } Otherwise, you will have to extend the request scope by using a feature such as keepAlive.
answers question: http://stackoverflow.com/q/24486010

http://stackoverflow.com/q/24503245
has body: I'm creating an eclipse plugin which will make a maven java project. I have included maven natures as I want it to be a maven project with pom.xml. IProjectDescription description = project.getDescription(); description.setNatureIds(new String[] { "org.eclipse.jem.workbench.JavaEMFNature", "org.eclipse.wst.common.modulecore.ModuleCoreNature", "org.eclipse.jdt.core.javanature", "org.eclipse.m2e.core.maven2Nature", "org.eclipse.wst.common.project.facet.core.nature"}); project.setDescription(description, monitor); But it doesn't create any pom file instead I'm seeing the following lines in log: 16:50:00.271 [Worker-2] DEBUG o.e.m.c.i.builder.MavenBuilder - Building project AA 16:50:00.271 [Worker-2] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshing: [L/AA/pom.xml] 16:50:00.286 [Worker-2] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshed: [L/AA/pom.xml] 16:50:00.770 [Worker-0] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshing: [L/AA/pom.xml] 16:50:00.770 [Worker-0] DEBUG o.e.m.c.i.p.r.ProjectRegistryManager - Refreshed: [L/AA/pom.xml] Any help?
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/37934203
has comment: http://stackoverflow.com/comment/37934793
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has comment: http://stackoverflow.com/comment/37940512
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/37934549
has title: How to create maven project with pom file programmatically while creating eclipse plugin project
type: Question
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37934890
score: 0

http://stackoverflow.com/a/26459384
answers question: http://stackoverflow.com/q/24482138
downvote count: 0
has comment: http://stackoverflow.com/comment/41558828
type: Answer
upvote count: 6
has body: For Windows: osgi&gt; install file:///d://dir1//dir2//file.jar For Linux: You must first check if the jar file is set to the appropriate access permission. osgi&gt; install file:///home//user//osgi//plugin.jar
score: 6

http://stackoverflow.com/q/24554753
tagged with: netbeans-plugins
has answer: http://stackoverflow.com/a/25918810
has body: I try to create a new language support for NetBeans 7.4 and higher. When files are being saved locally I need to deploy them to a server. So I need to handle the save event. I did this implementing Savable: public class VFDataObject extends MultiDataObject implements Savable { ....... @Override public void save() throws IOException { ....... } } And it worked perfectly for the Save event. But then I realized I need to extend HtmlDataObject instead of MultiDataObject: public class VFDataObject extends HtmlDataObject implements Savable { ....... @Override public void save() throws IOException { ....... } } And now the save() doesn't get executed. Why? Since HtmlDataObject extends MultiDataObject. What should be done to make that work? Also is there a way to catch Save All event in NetBeans as well? Do you have any info on if anything changed in 8.0 in this regards? Thanks a lot.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans-platform
type: AnsweredQuestion
tagged with: netbeans
score: 3
accepted answer: http://stackoverflow.com/a/25918810
upvote count: 3
tagged with: java
type: Question
has title: How do I handle file saves properly in NetBeans platform project (plugin)

http://stackoverflow.com/comment/38075345
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24579288
has text: http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
type: Comment

inheritance
tags question: http://stackoverflow.com/q/24442646
tags question: http://stackoverflow.com/q/24568408
tags question: http://stackoverflow.com/q/24472237
tags question: http://stackoverflow.com/q/24514081
tags question: http://stackoverflow.com/q/24505409
tags question: http://stackoverflow.com/q/24429905
tag name: inheritance
tags question: http://stackoverflow.com/q/24436466
tags question: http://stackoverflow.com/q/24503082
tags question: http://stackoverflow.com/q/24519889
tags question: http://stackoverflow.com/q/24477684
tags question: http://stackoverflow.com/q/24572715
type: Tag
tags question: http://stackoverflow.com/q/24538386
tags question: http://stackoverflow.com/q/24470491
tags question: http://stackoverflow.com/q/24575618
tags question: http://stackoverflow.com/q/24464947
tags question: http://stackoverflow.com/q/24567632
tags question: http://stackoverflow.com/q/24488455
tags question: http://stackoverflow.com/q/24434788
tags question: http://stackoverflow.com/q/24555352
tags question: http://stackoverflow.com/q/24552319
tags question: http://stackoverflow.com/q/24431409

http://stackoverflow.com/q/24537059
accepted answer: http://stackoverflow.com/a/25510659
tagged with: android
has title: missing android.jar in visual studio 2013
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27088880
answer count: 4
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/64217120
has answer: http://stackoverflow.com/a/25510659
has answer: http://stackoverflow.com/a/35477498
tagged with: java
possible better answer: http://stackoverflow.com/a/27088880
type: Question
downvote count: 0
has body: I'm trying to use mono for android in vs.net 2013. when running the project, it says: Error 1 Could not find android.jar for API Level 8. This means the Android SDK platform for API Level 8 is not installed. Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed. (C:\Users\M.K_Soft\AppData\Local\Android\android-sdk\platforms\android-8\android.jar missing.)

http://stackoverflow.com/comment/38076893
score: 0
comment on: http://stackoverflow.com/q/24579236
type: Comment
type: QuestionComment
has text: Very interesting: if I do `mvn dependency:tree` it shows the dep as `compile`, but if I do `mvn -Dverbose dependency:tree` the dep becomes `test`. I am now pretty sure it is a bug somewhere in the maven. As a workaround I declared the `xml-apis` dependency in my pom explicitly, seems it works now.

http://stackoverflow.com/a/24450385
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24450300
has body: The most common cause for this problem is the assumption that all sk5 variables are the same. If you have multiple variables, or multiple instances, you actually have multiple fields/variables with the same name. The simplest way to check this is to look at what your code is doing when you step thorugh it in your debugger. You can see in the following example, you have three variables called sk5 with three different values. class MyClass { int sk5; public static void main(String... s) { MyClass a = new MyClass(), b = new MyClass(); a.sk5 = 1; b.sk5 = 2; int sk5 = 3; System.out.println(a.sk5+" " + b.sk5 + " " + sk5); } } prints 1 2 3
downvote count: 0
score: 1

http://stackoverflow.com/q/24493603
type: Question
has body: I have used the HSQLDB for storing the data in my app. I make 15 Web service call one by one. and store the data in DB. It's working fine for medimum amount of data. I got the OME(Out of memory error) for large data. I mean, suppose I am having like 20k records for web service method.So we are getting the OME while storing the data into the DB. I tried with profiler feature also but I am unable to find which object was consumed more heap memory. So I struck here. I need the somebody help to solve this. Code try { JSONObject jSONObject = getJSONData(clientId, ApplicationConstants.REST_METHOD_GET_ALL_CATEGORIES_LIST_BY_CLIENT_ID); if (jSONObject != null) { JSONArray jSONArray = jSONObject.getJSONArray(ApplicationConstants.JSON_OBJECT_RESPONSE); Integer length = jSONArray.length(); if (length == 0) { if (_logger.isInfoEnabled()) { _logger.info("Categories not found for client {}", clientId); } } else { if (_logger.isInfoEnabled()) { _logger.info("{} Categories found for client {}", length, clientId); } SyncDao synDao = (SyncDao) getDAO(ApplicationConstants.REST_SYNC_DAO); for (int i = 0; i &lt; length; i++) { JSONObject jSONObj = jSONArray.getJSONObject(i); ProjectMenu projectMenu = new ProjectMenu(); projectMenu.setClientId(clientId); projectMenu.setCategory(ApplicationConstants.PROJECT_MENU_CATEGORY_SUB_MENU); projectMenu.setCategoryType(ApplicationConstants.CATEGORY_TYPE_CATEGORY); projectMenu.setCreatedDate(jSONObj.getString(ApplicationConstants.REST_CATEGORY_CREATED_DATE)); projectMenu.setElementId(jSONObj.getString(ApplicationConstants.REST_CATEGORY_ID)); projectMenu.setIsLeaf(Boolean.FALSE); projectMenu.setLabel(jSONObj.getString(ApplicationConstants.REST_CATEGORY_NUMBER)); projectMenu.setLevel(new Integer(4)); projectMenu.setSortOrder(jSONObj.getInt(ApplicationConstants.REST_CATEGORY_SORT_ORDER)); // Getting parent menu details ProjectMenu parentProjectMenu = synDao.getProjectMenu(clientId, jSONObj.getString(ApplicationConstants.REST_CATEGORY_PROJECT_COMPONENT_…
has title: JavaFX - OME while storing data in HSQLDB from JSON data
tagged with: hsqldb
tagged with: javafx-2
score: 0
has answer: http://stackoverflow.com/a/24609956
has comment: http://stackoverflow.com/comment/37916826
answer count: 1
has comment: http://stackoverflow.com/comment/37917010
tagged with: performance
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/24475286
score: 1
has comment: http://stackoverflow.com/comment/37882007
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24475366
favorite count: 0
tagged with: objectoutputstream
has title: Saving Class objects to a Text File in Java
type: Question
upvote count: 2
has body: Beginner in Java, Making a program of student Management in which there is class student, I wanted to save the data of students , as an object to a text File .I tried using Objectoutputstream ,but the contents in the File are shown in some awkward form .Any Help would be greatly Appreciated.
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/24475366
tagged with: java

http://stackoverflow.com/comment/37833119
type: QuestionComment
type: Comment
has text: @Holger ok. thanks. Now I know that this code is correct.
score: 0
comment on: http://stackoverflow.com/q/24449024

http://stackoverflow.com/comment/37911231
score: 0
type: Comment
type: QuestionComment
has text: Search on google there are lots of tutorials available....http://www.kpbird.com/2012/12/youtube-android-player-api-tutorial.html
comment on: http://stackoverflow.com/q/24490554

http://stackoverflow.com/q/24586109
linked to: http://stackoverflow.com/q/20673625
favorite count: 0
has answer: http://stackoverflow.com/a/24589713
accepted answer: http://stackoverflow.com/a/24589713
tagged with: android
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: zxing
has comment: http://stackoverflow.com/comment/38087760
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38116519
has title: QRCode Scanner in Android Studio
tagged with: qr-code
upvote count: 2
has body: I want to make QRCode Scanner Application in Android Studio. I found many solutions about this, but all of them open another app (like zxing). I want to make own layout and camera preview be in my layout. So I don't want to see another layout in my app (like zxing capture.xml) I imported project zxing to my Android Studio Project. But I always get this error com.zxing.... does not exist Can anybody help me? EDİT... The list of what I did.. 1 - open a new android studio project 2 - open module settings 3 - import module and locate zxing-2.0 dir. 4 - add the dependencies (:zxing20 and core.jar) 5 - :app module Compile SDK Version 19, BuildTools Versin 19.1.0, minsdk 8, target sdk 19 6 - :zxing20 module Compile SDK Version 10, BuildTools Versin 19.1.0, minsdk 7, target sdk 7 errors: Error:(7, 39) error: package com.google.zxing.client.android does not exist Error:(9, 33) error: cannot find symbol class CaptureActivity Error:(11, 5) error: method does not override or implement a method from a supertype Error:(13, 9) error: cannot find symbol variable super Error:(14, 9) error: cannot find symbol method setContentView(int)
answer count: 1

http://stackoverflow.com/a/24448709
has comment: http://stackoverflow.com/comment/38977468
score: 52
has comment: http://stackoverflow.com/comment/40220996
answers question: http://stackoverflow.com/q/24437564
type: Answer
has comment: http://stackoverflow.com/comment/37980027
upvote count: 73
has body: NOTE: Use this approach with caution because this might break your Eclipse installation (see comments). This might help you if you installed the ADT plugin manually. But if you are using the version of Eclipse from the Eclipse ADT Bundle the below steps could break your Eclipse installation, and you may not be able to use Eclipse again! Go to Menu Help → About Eclipse SDK → Installation Details. Now you will see all 22.0 versions and then click Uninstall button at bottom. After uninstallation goto: Menu Help → Install New Software → enter http://dl-ssl.google.com/android/eclipse/ Then install all the things, and now it is ready.
downvote count: 21
has comment: http://stackoverflow.com/comment/44050035
has comment: http://stackoverflow.com/comment/37891052
has comment: http://stackoverflow.com/comment/39450015
has comment: http://stackoverflow.com/comment/41888119
has comment: http://stackoverflow.com/comment/38014375
has comment: http://stackoverflow.com/comment/44050222
has comment: http://stackoverflow.com/comment/49562058
has comment: http://stackoverflow.com/comment/39726389
has comment: http://stackoverflow.com/comment/38828142

http://stackoverflow.com/comment/38028529
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24546803
has text: FYI we found a way to avoid hitting the exception. By starting the program in same folder as where the `UMS.jar` file exist. So `CWD=/usr/local/share/universal-media-server`. Many thanks.
score: 0

http://stackoverflow.com/q/24530589
has body: I prepared some tables with cassandra using CQL. In fact, I tried to apply aggregation queries on my data (sum, avg, etc..). So, I used presto-cassandra with java. I have configured presto as follows: Config.properties: coordinator=true node-scheduler.include-coordinator=true http-server.http.port=8080 task.max-memory=1GB discovery-server.enabled=true discovery.uri= `http://localhost:8080` JVM.properties: -server -Xmx16G -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:+CMSClassUnloadingEnabled -XX:+AggressiveOpts -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError=kill -9 %p -XX:PermSize=150M -XX:MaxPermSize=150M -XX:ReservedCodeCacheSize=150M -Xbootclasspath/p:C:/Presto/lib/floatingdecimal-0.1.jar log.properties: com.facebook.presto=INFO node.properties: node.environment=production node.id=ffffffff-ffff-ffff-ffff-ffffffffffff node.data-dir=C:/Presto/data cassandra.properties: connector.name=cassandra cassandra.contact-points=localhost cassandra.native-protocol-port=9142 cassandra.thrift-port=9160 Then, I've been trying to connect to presto and run some queries through jdbc, but I keep getting errors. The code is : public static void connect() throws ClassNotFoundException, SQLException{ Class.forName("com.facebook.presto.jdbc.PrestoDriver"); PrestoConnection connection = (PrestoConnection) DriverManager.getConnection("jdbc:presto://localhost:8080/cassandra/premierkeys", "test",""); PrestoStatement statement = (PrestoStatement) connection.createStatement(); ResultSet rs = statement.executeQuery("select * from client"); while(rs.next()) { System.out.println(rs.getString(1)); } } public static void main(String[] args) throws ClassNotFoundException, SQLException { // TODO Auto-generated method stub connect(); } Also, the maven dependency looks like this: com.facebook.presto presto-cassandra 0.72 zip com.facebook.presto presto-jdbc 0.72 ` But when I run this code I get: ***juil. 02, 2014 11:32:57 AM com.facebook.presto.jdbc.internal.jetty.util.log.JavaUt…
has answer: http://stackoverflow.com/a/24612867
type: Question
has title: java.sql.SQLException from cassandra connection and querying with presto
tagged with: cassandra
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37984418
tagged with: presto
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/24572738
type: Answer
has comment: http://stackoverflow.com/comment/38063045
accepted answer of: http://stackoverflow.com/q/24572620
has body: You are not using Element e. Change data[count][0]=descs.attr("href"); data[count][1]=descs.attr("title"); to data[count][0]=e.attr("href"); data[count][1]=e.attr("title"); and add as last line of the for loop: if ( count == spaceCount ) break;
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24572620
has comment: http://stackoverflow.com/comment/38063097
has comment: http://stackoverflow.com/comment/38063199
score: 0

http://stackoverflow.com/q/24486681
tagged with: java
has title: java smack facebook get unseen messages
type: Question
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/48703296
tagged with: xmpp
has body: I would like to receive messages from the offline(unseen) facebook. but I am getting this error. facebook does not support this feature? feature-not-implemented(501)at org.jivesoftware.smackx.OfflineMessageManager.getMessages(OfflineMessageManager.java:210) at ktg_msn.test.main(test.java:58) my code try { ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222, "chat.facebook.com"); config.setSendPresence(false); XMPPConnection connection = new XMPPConnection(config); connection.connect(); connection.login("userrr", "passs"); OfflineMessageManager offlineManager = new OfflineMessageManager(connection); System.out.println(offlineManager.getMessageCount()); Iterator&lt;Message&gt; it = offlineManager.getMessages(); while (it.hasNext()) { Message m = it.next(); String fromName = m.getFrom(); Date currentDate = new Date(); String text = m.getBody() + " (offline)"; System.out.println(text); } } catch (XMPPException ex) { Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex); }
tagged with: smack
answer count: 0
type: UnansweredQuestion
tagged with: facebook
downvote count: 0
score: 1

http://stackoverflow.com/a/24558646
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/38037239
downvote count: 1
has body: Unfortunately, Java does not let you supply an external "equality comparer": when you use strings, HashSet uses only built-in hashCode and equals. You can work around this problem by populating an auxiliary HashSet&lt;String&gt; with strings converted to a specific (i.e. upper or lower) case, and then checking the equality on it, like this: boolean eq = set1.size() == set2.size(); if (eq) { Set&lt;String&gt; aux = new HashSet&lt;String&gt;(); for (String s : set1) { aux.add(s.toUpperCase()); } for (String s : set2) { if (!aux.contains(s.toUpperCase())) { eq = false; break; } } } if (eq) { // The sets are equal ignoring the case }
score: 7
answers question: http://stackoverflow.com/q/24558456

http://stackoverflow.com/a/24566563
has comment: http://stackoverflow.com/comment/74751386
type: Answer
has comment: http://stackoverflow.com/comment/74763753
has comment: http://stackoverflow.com/comment/74777183
has comment: http://stackoverflow.com/comment/74705563
has comment: http://stackoverflow.com/comment/74769819
has comment: http://stackoverflow.com/comment/38157808
has comment: http://stackoverflow.com/comment/74763862
answers question: http://stackoverflow.com/q/24553348
upvote count: 7
has body: Log4j2's PatternLayout also supports the header and footer attributes: %d %p [%t] %c %m%n This is a header (c) 1999-2014 I think attributes work too: This is not documented correctly, thanks for pointing this out.
has comment: http://stackoverflow.com/comment/74746649
has comment: http://stackoverflow.com/comment/38137720
score: 7
has comment: http://stackoverflow.com/comment/58274084
has comment: http://stackoverflow.com/comment/58259282
has comment: http://stackoverflow.com/comment/38162660
downvote count: 0
has comment: http://stackoverflow.com/comment/74698062

http://stackoverflow.com/q/24429677
favorite count: 0
tagged with: return
has title: Methods need to return string from user.Need troubleshoot only
has body: I'm a beginner in Java programming, I tried everything I could but I cant seems to troubleshoot my problem. The problem Im facing is the getCardID() methods keep returning null value, the getTokenBalance() seems to work fine, or do i need special code to return a string value from getCardID()? Any help is very much appreciate. This is Prepaidcard.java class: class PrepaidCard { private String cardID; private int tokenBalance; public PrepaidCard(String id) { // My First Constructor String cardID = id ; } public PrepaidCard(String id, int token) { // My Second Constructor String cardID = id; tokenBalance = token; } public void addToken(int token) { // Methods tokenBalance =token+tokenBalance; } public void deductToken(int token) { // Methods tokenBalance=tokenBalance-token; } public int getTokenBalance() { // Methods return tokenBalance; } public String getCardID() { // Why does this method keep returning null value? return cardID; } } This is the class use to test prepaidcard.java import java.util.*; class testprepaid { public static void main(String [] args) { Scanner sc = new Scanner(System.in); System.out.print("Insert card1 id : "); String newid = sc.nextLine(); // my scanner class that read user input in String System.out.print("Insert card2 id : "); String newid2 = sc.nextLine(); // my scanner class that read user input in String System.out.print("Enter Card2 initial token : "); int itoken = sc.nextInt(); PrepaidCard card1 = new PrepaidCard(newid); // object created base on 1st &amp; 2nd Constructor PrepaidCard card2 = new PrepaidCard(newid2,itoken); System.out.println("Card1 ID: " + card1.getCardID()); // the method return null when called System.out.println("Card1 token balance : " + card1.getTokenBalance()); System.out.println("Card2 ID: " + card2.getCardID()); // and this System.out.println("Card2 token balance : " + card2.getTokenBalance()); And other line contains no error so I didn't add them. You can see my runtime error here.
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24429708
answer count: 2
downvote count: 0
tagged with: string
score: 4
possible better answer: http://stackoverflow.com/a/24429738
has comment: http://stackoverflow.com/comment/37797186
has answer: http://stackoverflow.com/a/24429738
accepted answer: http://stackoverflow.com/a/24429708

http://stackoverflow.com/a/24466418
has body: Firstly, the JVM doesn't resolve overloads - the compiler does. (Whereas the JVM decided which overridden method to execute, for example.) As for why the method call becomes ambiguous - the compiler is looking for a single method where every conversion from the method argument type (int for both arguments) to the method parameter type (int, long or double) is at least as specific as the corresponding conversion in other candidate methods. The conversion from int to int is more specific than the conversion from int to double, so your second overload "wins" in both cases. For the second parameter, in your original code it's a conversion from int to long for both overloads, so that means the second overload "wins" overall. In your modified code, the conversion from int to int is more specific than the conversion from int to long, so the first overload "wins" for this parameter. So each overload is better than the other for one parameter, and the invocation is ambiguous. See JLS section 15.12.2 (and the sections it refers to and contains, particularly 15.12.2.5) for all the gory details.
downvote count: 0
answers question: http://stackoverflow.com/q/24466365
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/24466365
type: Answer
upvote count: 4

http://stackoverflow.com/q/24529600
answer count: 2
has answer: http://stackoverflow.com/a/24531228
has title: How to go about creating a new class of BufferedImage with a file as argument
tagged with: constructor
has answer: http://stackoverflow.com/a/24530371
has comment: http://stackoverflow.com/comment/37984726
type: AnsweredQuestion
has body: I want to create a new class ,because I want to make some new methods, which extends BufferedImage and takes a file ,a bmp picture, as an argument. Like what happens here: BufferedImage image = ImageIO.read(new File(dir + "coffeecup.png")); Looking through the documentation I found that the class BufferedImage has two constructors: public BufferedImage(ColorModel cm,WritableRaster raster, boolean isRasterPremultiplied, Hashtable properties) public BufferedImage(int width, int height, int imageType) Going through the documentation of all the arguments I failed to notice which argument refers to a file ,if any. So how would I need to go about in creating a new BufferedImage class but with a file as one of the arguments?
tagged with: java
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/37984925
has comment: http://stackoverflow.com/comment/37985164
accepted answer: http://stackoverflow.com/a/24530371
possible better answer: http://stackoverflow.com/a/24531228
score: 0

http://stackoverflow.com/a/64436644
upvote count: 2
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/119559953
score: 1
answers question: http://stackoverflow.com/q/24563694
has body: I started getting this error: SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target completely out nowhere back in August 2020 on 2 of my Jenkins build servers running on windows server. It prevented updates of Jenkins core and all plug-ins. Getting some clues from others here and I decided to install the latest version of JRE (v1.8.0_261 in my case) with the hope that the cacerts would be updated. Installing the latest JRE created a new folder here: C:\Program Files (x86)\Java\jre1.8.0_261 Jenkins is pointing to a folder: C:\Program Files (x86)\Jenkins\jre. First I stopped Jenkins service. Second, I backed up and then deleted that C:\Program Files (x86)\Jenkins\jre folder and copied the C:\Program Files (x86)\Java\jre1.8.0_261 to C:\Program Files (x86)\Jenkins\jre. This may not be best practice but it solved my error.

http://stackoverflow.com/q/24479815
answer count: 1
score: -6
has comment: http://stackoverflow.com/comment/37890756
favorite count: 0
linked to: http://stackoverflow.com/q/1881922
has answer: http://stackoverflow.com/a/24479929
type: UnansweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37890797
type: Question
has body: if you write String s = new String ("abc"); two objects get created on is in non pool (heap) area and one is in common String pool (if it not exists. ) Suppose it creates two objects. Now when I create String literal String s1 ="abc"; Now according to me in string pool there is one string "abc" and has two reference s1 and s. so System.out.println(s==s1) it should give true but its giving false.. why??
has comment: http://stackoverflow.com/comment/37890781
has title: Same value at two different memory references
duplicate of: http://stackoverflow.com/q/513832
downvote count: 6
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37890851
duplicate of: http://stackoverflow.com/q/1881922

http://stackoverflow.com/comment/37879557
score: 0
type: AnswerComment
type: Comment
has text: I don't think making the variable volatile is sufficient. The volatile keyword will flush the value to main memory for visibility in other threads; however, I don't think it guarantees synchronization with updates to other variables. The value of 'updated' can still get flushed first, with the result that the main() method can still see `b` updated when the value of `data` has not yet been flushed and is not yet visible.
comment on: http://stackoverflow.com/a/24469354

http://stackoverflow.com/comment/38017658
score: 0
has text: I am sorry, @RichardTingle, but you are wrong. Attempt to change final field using reflection even if `setAccessible(true)` is called causes exception like this: ` java.lang.IllegalAccessException: Can not set static final java.lang.String field org.svidaid.TryInst.s to java.lang.String`. I was actually sure that it happens but tried it again now just for you. :)
comment on: http://stackoverflow.com/a/24545589
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38062430
has text: Creating a JAX-RS resource class that delegates to the JAX-WS service might work.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24571990

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/24446849

http://stackoverflow.com/q/24520280
type: UnansweredQuestion
has title: No suitable driver found on glassfish4
has comment: http://stackoverflow.com/comment/37975643
has body: I am having a no suitable driver found issue on Ubuntu + Glassfish 4. I am trying to connect to a Postgres instance on Amazon RDS. Except I have added the required driver to everywhere I know: -Domain1 lib -glassfish lib -java-7-oracle lib Please help me. I have no idea why this is not working. Thanks in advance...
upvote count: 0
tagged with: glassfish
favorite count: 0
tagged with: postgresql
type: Question
score: -1
has answer: http://stackoverflow.com/a/24528836
answer count: 1
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/38069618
type: QuestionComment
has text: @Zhuinden yes. And to all people, pls kindly stop down voting. I am leaving this question in SO, so that it can possibly benefit other new Java learners in future.
type: Comment
comment on: http://stackoverflow.com/q/24576028
score: 0

http://stackoverflow.com/comment/50499359
has text: Good site about this issue -> http://tools.android.com/tech-docs/configuration/osx-jdk
type: Comment
comment on: http://stackoverflow.com/a/24680375
score: 0
type: AnswerComment

http://stackoverflow.com/q/24508281
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
has title: Mojarra 2.2.6 and EL 3.0: Wrong number of arguments in h:commandButton action attribute
linked to: http://stackoverflow.com/q/15560508
score: 1
tagged with: java
type: Question
tagged with: jsf-2
accepted answer: http://stackoverflow.com/a/24509347
has comment: http://stackoverflow.com/comment/37944228
has answer: http://stackoverflow.com/a/24509347
tagged with: osgi
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2333605
has body: I'm trying to invoke bean method from JSF command button, but I keep getting an error javax.faces.FacesException: wrong number of arguments This is the code in my page: <?xml version="1.0" encoding="UTF-8"?> TODO supply a title <ui:composition> <h:form> <h:panelGroup> <h:outputText value="Hello, DEMUX JSF!" style="color: #{dmxAdapter.model.get('testData') ? 'green' : 'red' }" /> <h:commandButton value="Click me" action="#{dmxAdapter.invokeController('com.vektorsoft.demux.samples.hello.HelloController')}" /> </h:panelGroup> </h:form> </ui:composition> If I change action attribute to call method without parameters, everything works fine. I'm running this in Jetty inside OSGI container. JSF version is Mojarra 2.2.6 and EL 3.0. I've read multiple answers mentioning that EL 2.2 and above is required for this to work,a nd I think EL 3.0 should work also. This is added as Maven dependency: org.glassfish javax.el 3.0.0 Can anybody shed any light on what might be wrong here?
has comment: http://stackoverflow.com/comment/37943539

http://stackoverflow.com/q/24510145
type: UnansweredQuestion
tagged with: java
has body: I have an application where occasionally Spring throws the error: org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'action' is not present Naturally you would expect the action param to be missing, however it is definitely being POSTed by the browser. I've even gone as far as watching the network traffic with Wireshark, and it is there! Here is an example of the raw post taken from Chromes dev tools - Note the &amp;action=accept is there: imageId=1445&amp;customReason=&amp;action=accept&amp;image=iVBORw0K... The &amp;image is a base64 encoded image (taken from a canvas element), and the whole POST is approx 4Mb. This is running inside Tomcat 6.0 with Spring 3.2.8. The Spring MVC controller that is throwing this is: public String saveApprove( HttpServletRequest request, Model model, @RequestParam(value="action", required=true) String action, @RequestParam("imageId") int imageId, @RequestParam(value="image", required=false) String imageBase64Encoded, @RequestParam(value="rejectReasons", required=false) String rejectReasons[], @RequestParam(value="customReason", required=false) String customReason ) What could be causing this? Most photos are OK, but approx 10% throw this error. It's reproducible for a photo that throws it. Is this a bug in Spring?
type: Question
has answer: http://stackoverflow.com/a/77993712
answer count: 2
has title: Spring MissingServletRequestParameterException error despite parameters being in the POST
has comment: http://stackoverflow.com/comment/137549714
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/137510049
upvote count: 8
linked to: http://stackoverflow.com/q/2947683
has answer: http://stackoverflow.com/a/78012743
tagged with: spring
has comment: http://stackoverflow.com/comment/37951722
score: 8
tagged with: spring-mvc

http://stackoverflow.com/comment/37861997
has text: Please correct me if I am wrong, you have PATH variable set properly and javac is available to execute from any folder and you get the error that javac is not found when you try to exec javac via PowerShell. Am I right?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24464490

http://stackoverflow.com/q/24496270
type: AnsweredQuestion
has title: Spring REST call displays JSON in the browser -- is there a way I can also allow the user to download the file?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24496404
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: rest
linked to: http://stackoverflow.com/q/1012437
accepted answer: http://stackoverflow.com/a/24496404
has body: I have a basic REST call /** * REST CALL * @return */ @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List&lt;Template&gt; getTemplatesJson(){ logger.info("GET all computers- /computers/ -- content type = application/json"); return computerService.retrieveAllComputers(); } When I go to the URL I see the JSON in the browser. We also would like our users to be able to download the JSON as a file (used for importing later on). Is there an easy way I can do that with this endpoint or do I need to create a brand new endpoint?
upvote count: 1
tagged with: spring
type: Question

elasticsearch
tags question: http://stackoverflow.com/q/24455509
tags question: http://stackoverflow.com/q/24492351
tags question: http://stackoverflow.com/q/24440847
tags question: http://stackoverflow.com/q/24544558
tags question: http://stackoverflow.com/q/24543787
tags question: http://stackoverflow.com/q/24510940
tags question: http://stackoverflow.com/q/24492893
type: Tag
tags question: http://stackoverflow.com/q/24525438
tags question: http://stackoverflow.com/q/24562875
tags question: http://stackoverflow.com/q/24546595
tags question: http://stackoverflow.com/q/24437535
tags question: http://stackoverflow.com/q/24540318
tags question: http://stackoverflow.com/q/24574739
tag name: elasticsearch
tags question: http://stackoverflow.com/q/24448080
tags question: http://stackoverflow.com/q/24508191

http://stackoverflow.com/a/24516251
answers question: http://stackoverflow.com/q/24515318
score: 0
has body: I'd go with option 2, because it's a cleaner and more intuitive implementation. We should try to design a function's signature (name + parameters) in a way that it is self-explanatory and clearly indicates what it does. One principle we should follow to achieve such clarity is to make a function DO JUST ONE THING. That is: if the function returns a value without any side effect, make the returned value single purpose. If there is any side effect, make it one side effect only. Based on the reasoning above, option 2 is a clear winner. append(A, B) has a single side effect, and can be reused in a much wider context. append(boolean) requires the caller to decide just one thing: the appending order.
type: Answer

http://stackoverflow.com/a/24657777
has body: Sorry, the project was recently created at eclipse. Hudson is populating the maven repository now.
type: Answer
answers question: http://stackoverflow.com/q/24435918
score: 0

http://stackoverflow.com/comment/37979397
has text: Can you please share a simple code snippet on how to limit things making them all implement the same interface/abstract class.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24510124

jakarta-ee
tags question: http://stackoverflow.com/q/24440547
tags question: http://stackoverflow.com/q/24537175
tags question: http://stackoverflow.com/q/24485365
tags question: http://stackoverflow.com/q/24433078
tags question: http://stackoverflow.com/q/24429349
tags question: http://stackoverflow.com/q/24491029
type: Tag
tags question: http://stackoverflow.com/q/24519368
tags question: http://stackoverflow.com/q/24503054
tags question: http://stackoverflow.com/q/24539038
tags question: http://stackoverflow.com/q/24530952
tags question: http://stackoverflow.com/q/24577690
tags question: http://stackoverflow.com/q/24586957
tags question: http://stackoverflow.com/q/24531366
tags question: http://stackoverflow.com/q/24495100
tags question: http://stackoverflow.com/q/24532102
tags question: http://stackoverflow.com/q/24428077
tags question: http://stackoverflow.com/q/24571215
tags question: http://stackoverflow.com/q/24510468
tags question: http://stackoverflow.com/q/24485657
tags question: http://stackoverflow.com/q/24493900
tags question: http://stackoverflow.com/q/24531225
tags question: http://stackoverflow.com/q/24519063
tags question: http://stackoverflow.com/q/24534298
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/24489601
tags question: http://stackoverflow.com/q/24576250
tags question: http://stackoverflow.com/q/24581106
tags question: http://stackoverflow.com/q/24522090
tags question: http://stackoverflow.com/q/24473470
tags question: http://stackoverflow.com/q/24548137
tags question: http://stackoverflow.com/q/24479276
tags question: http://stackoverflow.com/q/24563742
tags question: http://stackoverflow.com/q/24518607
tags question: http://stackoverflow.com/q/24468875
tags question: http://stackoverflow.com/q/24571656
tags question: http://stackoverflow.com/q/24435126
tags question: http://stackoverflow.com/q/24546440
tags question: http://stackoverflow.com/q/24585795
tags question: http://stackoverflow.com/q/24490853
tags question: http://stackoverflow.com/q/24547679
tags question: http://stackoverflow.com/q/24471935
tags question: http://stackoverflow.com/q/24530663
tags question: http://stackoverflow.com/q/24497164
tags question: http://stackoverflow.com/q/24436932
tags question: http://stackoverflow.com/q/24489161
tags question: http://stackoverflow.com/q/24586307
tags question: http://stackoverflow.com/q/24519849
tags question: http://stackoverflow.com/q/24488528
tags question: http://stackoverflow.com/q/24497270
tags question: http://stackoverflow.com/q/24563533
tags question: http://stackoverflow.com/q/24505006
tags question: http://stackoverflow.com/q/24548412
tags question: http://stackoverflow.com/q/24490129
tags question: http://stackoverflow.com/q/24429556
tags question: http://stackoverflow.com/q/24582575
tags question: http://stackoverflow.com/q/24555765
tags question: http://stackoverflow.com/q/24438925
tags question: http://stackoverflow.com/q/24550641
tags question: http://stackoverflow.com/q/24519449
tags question: http://stackoverflow.com/q/24578438
tags question: http://stackoverflow.com/q/24448492
tags question: http://stackoverflow.com/q/24541106
tags question: http://stackoverflow.com/q/24575255
tags question: http://stackoverflow.com/q/24481871
tags question: http://stackoverflow.com/q/24446080
tags question: http://stackoverflow.com/q/24473136

http://stackoverflow.com/q/24575902
has body: So, I know that Many other people have asked this question, but I couldn't find the answer I needed. So, I'm a beginner in Android, and am learning. I'm using Intellij and most tutorials online use eclipes. So in the tutorials Eclipse auto creates the MyActivity.java with stuff like onOptionmenus and other stuff But when I copy the code into Intellij, R.menu.main and other stuff related to the R file contains Errors, Obviously since I didn't create anything for Intellij to recognize. Its just that intellij didn't do what Eclipse did so I tried to copy it. So This is my question.. Do I not have to write the onOptionmenu or onOptionsItemsSelected and stuff on the MyActiity.java, or MainActivity.java in Eclipse, for Intellij? Also, is there a way to make Intellij show the actual R file? I heard that if I go into the C:\Users\Myname.IntelliJIdea13\system\compiler\appname.integers\ and into some other folders inside, but I am unable to find annything in the folders and search I cannot find the R file. so, is there a way to make Intellij show it?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24584987
upvote count: 1
type: Question
has title: Intellij Empty R file
tagged with: intellij-idea
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24584987

http://stackoverflow.com/comment/38078779
type: QuestionComment
type: Comment
has text: Rewrite a self-contained example, that we can simply copy and paste, compile and run. And make sure this example uses correct naming. You have three variables called CARS, cars and Cars. Have you thought adding one named cArs and one named CaRs?
score: 0
comment on: http://stackoverflow.com/q/24580952

http://stackoverflow.com/a/24550745
score: 4
has comment: http://stackoverflow.com/comment/38022268
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/38023072
upvote count: 4
has comment: http://stackoverflow.com/comment/38022094
downvote count: 0
has body: That happens because you didn't cleanup your graphics settings after painting border. Basically Swing uses the same graphics which you have received into paintBorder method is used to paint whatever lies on the panel. So if you set the stroke, composite, font, color etc - make sure to return previously used settings after, otherwise you might see such unexpected behavior. You can't predict whether or not components painted after yours will setup their own stroke/composite/whatever else, so you have to restore default graphics settings after you finish painting your own stuff. Well, actually you can skip restoring color since almost every component uses its own while painting so its not that critical to keep the default intact. But only color, all the other settings should be restored unless your component doesn't have any childs or you are 100% sure that child components redefine some specific properties (I doubt you can be sure about it anyhow). Here is the simple fix: public class Box extends JPanel { public Box () { super (); DashedBorder dashedBorder = new DashedBorder (); this.setBorder ( new TitledBorder ( dashedBorder, "title", TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION ) ); this.setLayout ( new GridLayout ( 5, 1 ) ); for ( int i = 1; i &lt;= 15; i++ ) { this.add ( new JCheckBox ( "" + i ) ); } } class DashedBorder extends AbstractBorder { @Override public void paintBorder ( Component comp, Graphics g, int x, int y, int w, int h ) { Graphics2D g2d = ( Graphics2D ) g; g2d.setColor ( Color.black ); final Stroke os = g2d.getStroke (); g2d.setStroke ( new BasicStroke ( 1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{ 5 }, 0 ) ); g2d.drawRect ( x, y, w - 1, h - 1 ); g2d.setStroke ( os ); } } public static void main ( String[] args ) { JFrame frame = new JFrame (); JPanel p = new JPanel (); p.setLayout ( new BorderLayout () ); Box box = new Box (); frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ); frame.setSize ( 400, 400 ); frame.set…
accepted answer of: http://stackoverflow.com/q/24550104
answers question: http://stackoverflow.com/q/24550104

http://stackoverflow.com/q/24504655
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/24504976
has answer: http://stackoverflow.com/a/66397947
has answer: http://stackoverflow.com/a/24505270
tagged with: java
linked to: http://stackoverflow.com/q/5982675
tagged with: eclipse
has answer: http://stackoverflow.com/a/24778403
linked to: http://stackoverflow.com/q/23558568
score: 2
downvote count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/37936808
has answer: http://stackoverflow.com/a/41875529
tagged with: postgresql
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37936673
has comment: http://stackoverflow.com/comment/37937114
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/24778403
has answer: http://stackoverflow.com/a/24504976
has title: How to place PostgreSQL driver jar file on class path in eclipse?
favorite count: 0
has body: While trying out JDBC program to connect to PostgreSQL database using eclipse it flagged an error saying java.sql.SQLException: No suitable driver found It was suggested to place the PostgreSQL driver jar file on the class path. Now my question is, how to place the file on the classpath?. I am new to eclipse so it would be better for a detailed explanation.

http://stackoverflow.com/comment/37810933
has text: There's also a Clonable interface you can use.
type: Comment
comment on: http://stackoverflow.com/q/24437131
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37906851
type: Comment
comment on: http://stackoverflow.com/a/24487499
has text: So why would you close it?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/139229457
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/30395096
type: Comment
has text: by 2024, you must change to implementation 'commons-io:commons-io:2.13.0'

http://stackoverflow.com/q/24451402
accepted answer: http://stackoverflow.com/a/24451474
tagged with: http-post
answer count: 1
downvote count: 1
favorite count: 0
tagged with: android
tagged with: php
type: AnsweredQuestion
upvote count: 0
has title: How to properly perform HttpPost on onPageFinished in Android
has body: In my app I have a WebView. If this WebView loads, I want to perform a HttpPost to fetch a variable from a script. However I keep getting Exception errors, which tell me I need to perform the HttpPost in AsyncTask. I don't know how to do this, since I'm good enough in Android developing yet. This is the HttpPost I wrote: HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new; HttpPost("myscript.php"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("website", "google.com")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); // writing response to log Log.d("Http Response:", response.toString()); } catch (ClientProtocolException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } This is my onPageFinished method: myWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView myWebView, String url) { myWebView.loadUrl("javascript:(function() { " + "var tetsttest = document.getElementById('menu-toggle'); tetsttest.style.display = 'none'; tetsttest.style.display = 'none'; tetsttest.style.display = 'none';" + "})()"); // when a page has finished loading dismiss any progress dialog if (progressDialog != null &amp;&amp; progressDialog.isShowing()) { progressDialog.dismiss(); } } }); And this is the php file: &lt;?php $website = $_POST['website']; $conn = mysql_connect("localhost", "username", "password") or die("err"); $db = mysql_select_db('database') or die("err"); $sql = "SELECT color FROM colors WHERE website='$website'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); $color = $row['color']; print "$color"; ?&gt;
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/24451474

http://stackoverflow.com/a/68126716
score: 0
has body: Use jmockit: Code: // Mocking time as 9am final String mockTime = "09:00:00" new MockUp<LocalTime>() { @Mock public LocalTime now() { return LocalTime.parse(mockTime); } }; Imports: import mockit.MockUp; import mockit.Mock; Dependency: org.jmockit jmockit 1.41
type: Answer
answers question: http://stackoverflow.com/q/24491260

http://stackoverflow.com/q/24478376
answer count: 1
has answer: http://stackoverflow.com/a/29273480
accepted answer: http://stackoverflow.com/a/29273480
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37888996
has comment: http://stackoverflow.com/comment/37888004
has comment: http://stackoverflow.com/comment/37888137
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37887887
tagged with: adt
has title: Eclipse , ADT , SDK , JDK
has comment: http://stackoverflow.com/comment/37887861
has comment: http://stackoverflow.com/comment/37889830
has comment: http://stackoverflow.com/comment/37887953
score: 0
has body: I tried to use the new android L theme , therefore I updated the sdk, and then I came with an error that my ADT isn't matching to the SDK , tried to update but I got an error, so now im without Eclipse, without ADT , without SDK and without JDK, trying to install the ADT 23 bundle and its seems not to work.. Can someone guide me how to install the Eclipse? I don't know what to install first, what after, and I don't know how to download the files also.. I got Windows 7, 64 BIT.. I read about it a little bit trying to fix it.. someone said to me the problem is in the new sdk update, so I downloaded the old one : android-sdk_r22.6.2-windows... how can I install it with Eclipse and Jdk? ty
tagged with: sdk

http://stackoverflow.com/comment/37943655
type: QuestionComment
has text: You can swap the just-selected number with the one at the end, and pretend that on the next step you will be selecting from an array that is one element shorter.
comment on: http://stackoverflow.com/q/24508742
score: 1
type: Comment

http://stackoverflow.com/comment/38083420
type: QuestionComment
comment on: http://stackoverflow.com/q/24583364
has text: As far as I can tell, the sort in the second example is working fine. The three lines that start with `results beginResults` aren't all legal, so I can't tell what code you're actually using to print the results.
score: 0
type: Comment

http://stackoverflow.com/q/24572715
tagged with: overriding
tagged with: inheritance
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24573662
has body: Consider the following classes: public class Base { protected int i = 0; public Base(int i) { this.i = i; } public Base(Base b) { this(b.i); } public Base foo() { return new Base(this); } } public class Sub extends Base { public Sub(int i) { super(i); } public Sub(Sub s) { super(s.i * 2); } public Base foo() { return this; } @Override public boolean equals(Object o) { return ((Sub) o).i == this.i; } public static void main(String[] args) { Base b1 = new Base(1); Base b2 = b1; Base b3 = b2.foo(); Base b4 = new Sub(1); Base b5 = b4.foo(); System.out.println(b1.equals(b3)); } } The printed result is false. I've noticed the overridden method equals(Object o) never get caught and I suspect of course that this is the problem (Otherwise it would have printed true). Why is that?
type: Question
has answer: http://stackoverflow.com/a/24573662
has title: overridden equals method doesn't get called
has answer: http://stackoverflow.com/a/24572735
tagged with: java
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/24572735
tagged with: oop

http://stackoverflow.com/comment/37942874
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24508191
has text: Why wouldn't GEORGE be returned? What is your query? This question needs more details to be useful (and answereable)
score: 0

http://stackoverflow.com/a/24480516
has comment: http://stackoverflow.com/comment/37892282
answers question: http://stackoverflow.com/q/24480328
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24480328
type: AcceptedAnswer
has body: As noted in my comment, the problem is that you're creating an instance of UserManager bean manually and CDI cannot inject the variables. This is noted here: @Named("subBean") @RequestScoped public class UserBean implements Serializable{ //variable is just declared... private UserManager vm; public UserBean() { //and here you're initializing it manually... vm = new UserManager(); } //rest of your code... } Let CDI do its work by injecting the variable: @Named("subBean") @RequestScoped public class UserBean implements Serializable{ //variable is just declared //and notify CDI it should inject an instance when creating an instance of the client class @Inject private UserManager vm; public UserBean() { //no need to initialize it ever //vm = new UserManager(); } //rest of your code... } By doing this, you won't need to create any field that should be injected in your other bean either, which means you don't need to initialize emf field manually: //this line should be commented as well... //emf = Persistence.createEntityManagerFactory("main");
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/24549458
has body: As i read in the documentation: // (i.e. not include in JSON output; or being set even if they were included) \@JsonIgnoreProperties({ "internalId", "secretKey" }) // To ignore any unknown properties in JSON input without exception: \@JsonIgnoreProperties(ignoreUnknown=true) but how can I ingore both unknown AND given
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/38019743
downvote count: 0
has comment: http://stackoverflow.com/comment/38020014
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/38019905
answer count: 1
has title: Ignore fields in jackson I/O serialization and also ignore unknown fields
score: 1
has answer: http://stackoverflow.com/a/24549643
upvote count: 1
has comment: http://stackoverflow.com/comment/38020107
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24549643

http://stackoverflow.com/a/24558172
has body: Found solution here: java equivalent to php&#39;s hmac-SHA1 The problem was in BASE64Encoder. Use for (byte b : digest) { System.out.format("%02x", b); } System.out.println(); or new BigInteger(digest).toString(16); instead.
score: 0
answers question: http://stackoverflow.com/q/24557854
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24557854
type: Answer

http://stackoverflow.com/q/24552847
tagged with: http-post
has body: I want to post my data to the php server. But it doesn't work when I click the button. I`ve added Internet permission in Manifest.xml. What is problem in my code ? public class MainActivity extends Activity { Button sendButton; EditText msgTextField, msgTextField2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); msgTextField = (EditText) findViewById(R.id.msgTextField); msgTextField2 = (EditText) findViewById(R.id.msgTextField2); sendButton = (Button) findViewById(R.id.send);} public void send(View v) { //View v ? String msg = msgTextField.getText().toString(); String msg2 = msgTextField2.getText().toString(); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://blahblah.com/myphppage"); try { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2); nameValuePairs.add(new BasicNameValuePair("frm_ad", msg)); nameValuePairs.add(new BasicNameValuePair("frm_nomre", msg2)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); httpclient.execute(httppost); HttpResponse response = httpclient.execute(httppost); msgTextField.setText(""); msgTextField2.setText(""); } catch (ClientProtocolException e) { } catch (IOException e) { } } }
tagged with: url
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/38026354
type: UnansweredQuestion
tagged with: android
tagged with: android-manifest
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24553132
has title: Post data to php server in android
has answer: http://stackoverflow.com/a/24552998
score: 0
answer count: 2

generics
tags question: http://stackoverflow.com/q/24470607
tags question: http://stackoverflow.com/q/24512578
tags question: http://stackoverflow.com/q/24440728
tags question: http://stackoverflow.com/q/24489759
tags question: http://stackoverflow.com/q/24482592
tags question: http://stackoverflow.com/q/24574478
tags question: http://stackoverflow.com/q/24520409
tags question: http://stackoverflow.com/q/24505314
tags question: http://stackoverflow.com/q/24499690
tags question: http://stackoverflow.com/q/24455650
tags question: http://stackoverflow.com/q/24433591
tags question: http://stackoverflow.com/q/24519923
type: Tag
tags question: http://stackoverflow.com/q/24447233
tags question: http://stackoverflow.com/q/24437419
tags question: http://stackoverflow.com/q/24563349
tags question: http://stackoverflow.com/q/24516990
tags question: http://stackoverflow.com/q/24572092
tags question: http://stackoverflow.com/q/24511789
tags question: http://stackoverflow.com/q/24565278
tags question: http://stackoverflow.com/q/24507248
tags question: http://stackoverflow.com/q/24510035
tags question: http://stackoverflow.com/q/24545372
tags question: http://stackoverflow.com/q/24433853
tags question: http://stackoverflow.com/q/24469345
tags question: http://stackoverflow.com/q/24533518
tags question: http://stackoverflow.com/q/24489192
tags question: http://stackoverflow.com/q/24518024
tags question: http://stackoverflow.com/q/24427466
tag name: generics
tags question: http://stackoverflow.com/q/24530393
tags question: http://stackoverflow.com/q/24586840
tags question: http://stackoverflow.com/q/24552389
tags question: http://stackoverflow.com/q/24480430

http://stackoverflow.com/comment/37878137
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24472244
has text: I don't think there is a direct way out there. You may want to put the id value in another hidden input as a 'value'.

http://stackoverflow.com/a/24581764
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/38082209
answers question: http://stackoverflow.com/q/24580927
downvote count: 0
has body: You can almost treat this like going to 0 to N (where N is the total number of occurrences of the char you are looking for) in binary, e.g. 00000 to 11111. That is (2^N) - 1 combinations, so brute force search and replace won't work so nicely. Well we can use this to our advantage. First let's make an array with all the locations of the char we would like to remove. static List&lt;Integer&gt; location = new ArrayList&lt;Integer&gt;(); static String word = "kiraiki"; static String remove = "i"; int index = word.indexOf(remove); while (index &gt;= 0) { location.add(index); index = word.indexOf(remove, index + 1); } Now we have a N i.e. location.size(); locations of remove that we need to replace. Let's go through all the binary combinations from 0 to N and replace the corresponding char location in location.get(i). public static void binaryReplace(int value){ for (int i = 0; i &lt; Math.pow(2, value); i++) { StringBuilder binary = new StringBuilder(Integer.toBinaryString(i)); // Add Leading '0's for(int j = binary.length(); j &lt; value; j++) { binary.insert( 0, '0' ); } // Create a temp with the original word. StringBuilder tmp = new StringBuilder(word); // Look for where all the '1's (trues) are in the binary number for (int k = -1; (k = binary.indexOf("1", k + 1)) != -1; ) { // I'm using spaces here so has to not have indexing issues with '' chars. tmp.setCharAt(location.get(k), ' '); } // Now let's just replace these spaces so we can get the print out we want. System.out.println(tmp.toString().replaceAll("\\s", "")); } } The binaryReplace function can be significantly improved (you can remove a few binary combinations that produce the same result, there's a lot of searching, etc.) but this should get you started.

http://stackoverflow.com/q/24548479
tagged with: java
has answer: http://stackoverflow.com/a/24550597
has comment: http://stackoverflow.com/comment/38029169
has body: I have a crawler program that should run multiple threads each with a different IP address, about 10 threads simultaneously. Is it possible to assign each thread a different IP address on a machine running Windows VII? With a Java program? If so, can this be achieved by utilizing a machine that has multiple NICs? I want to interface with these different IP addresses at the program level, is this feasible?
has title: Multiple IP addresses on the same computer, initiated by one program, two NICs?
answer count: 2
accepted answer: http://stackoverflow.com/a/24550597
upvote count: 0
tagged with: nic
has comment: http://stackoverflow.com/comment/38018264
favorite count: 0
has comment: http://stackoverflow.com/comment/39309447
has comment: http://stackoverflow.com/comment/38020482
tagged with: windows
type: AnsweredQuestion
downvote count: 2
tagged with: ip
type: Question
possible better answer: http://stackoverflow.com/a/24548793
tagged with: network-programming
score: -2
has answer: http://stackoverflow.com/a/24548793
has comment: http://stackoverflow.com/comment/38020447

http://stackoverflow.com/q/24584380
has body: Below is my spring batch configuration: I am using mutiresourcepartitioner for partitioning 10 files. <handler grid-size="3" task-executor="taskExecutor" /> <property name="resources" value="file:#{jobParameters[fileDirectory]}/*" /> <property name="corePoolSize" value="10" /> <property name="maxPoolSize" value="30" /> <property name="resources" value="#{stepExecutionContext['fileResource']}" /> <property name="delegate" ref="flatFileItemReader" /> But i am frequently gettting NonTransientFlatFileException : unable to read resource . On seeing the logs came to know that One thread is probably trying to read its next item from file 1 while another thread is closing the current completed input file 1 leading to I/o Exception. We also tried to retry if this exception occurs but since it a nontransient exception we cant able to retry . Is there any solution to overcome this exception in spring batch. Also this exception would have been faced by many people who are using partioning with multiresourceItemPartioner ? Does grid size makes any impact in partioning ? Are any other configuration causing this problem to happen again ansd again?
has comment: http://stackoverflow.com/comment/38092641
tagged with: java
has comment: http://stackoverflow.com/comment/38110355
type: Question
has comment: http://stackoverflow.com/comment/38093763
upvote count: 1
downvote count: 0
favorite count: 0
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/38093256
has comment: http://stackoverflow.com/comment/38089287
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/38108300
has title: Frequent occurence of NonTransientFlatItemException Spring batch
has comment: http://stackoverflow.com/comment/38093341
answer count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38107728
has comment: http://stackoverflow.com/comment/38108268

http://stackoverflow.com/q/24465225
has comment: http://stackoverflow.com/comment/37863051
has body: What is the reason why that the following Java procedure causes a InputMismatchException error? import java.util.Scanner; public class Main { public static void main(String[] args) { String input = "hello 12345\n"; Scanner s = new Scanner(input); s.next("hello "); } } Thank you
type: AnsweredQuestion
tagged with: java.util.scanner
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37863029
has title: Java InputMismatchException error. What causes it?
accepted answer: http://stackoverflow.com/a/24465300
tagged with: java
has comment: http://stackoverflow.com/comment/37863081
tagged with: inputmismatchexception
score: 0
has answer: http://stackoverflow.com/a/24465300
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24499111
possible better answer: http://stackoverflow.com/a/33516538
has title: Android: On Item Click Listener for List View Base Adapter implementation
has answer: http://stackoverflow.com/a/33516538
has answer: http://stackoverflow.com/a/24499226
accepted answer: http://stackoverflow.com/a/24499226
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/50777669
has body: Can someone point give me an example of a On item click listener used for a list view with base adapter? My list view contains two text views and a check box. I want to create an on item click listener so that when a item (or row) is pressed, it ticks the corresponding row check box. I tried to Google it but could not find any examples of it Thank you
favorite count: 0
tagged with: android
answer count: 4
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/55507290

http://stackoverflow.com/comment/37994646
comment on: http://stackoverflow.com/q/24536006
score: 0
type: Comment
type: QuestionComment
has text: If you have control over it, you're probably better off doing the serialization to a language neutral format, like say xml or json

http://stackoverflow.com/comment/38168233
type: Comment
comment on: http://stackoverflow.com/a/24626349
has text: int totaInteger.parseInt(properties.getProperty("total_ids")); it is showing null java.lang.NumberFormatException: null
type: AnswerComment
score: 0

http://stackoverflow.com/q/24522762
score: -2
has comment: http://stackoverflow.com/comment/37970203
tagged with: ace-editor
downvote count: 3
upvote count: 1
answer count: 1
has body: I am using ace editor as text editor . I have an issue whenever i save the code(java) from editor it appears to be saved as a single line .It kind of ignores the enter key press.How to fix the problem?
has answer: http://stackoverflow.com/a/24531049
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18202540
tagged with: javascript
favorite count: 0
has title: How to format code in ace editor?
type: Question

http://stackoverflow.com/comment/37826047
type: Comment
has text: Well Well Well... I guess there's the possible answer to her question... Thanks for the answer mate :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24445171

http://stackoverflow.com/q/24570588
has comment: http://stackoverflow.com/comment/38060861
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/38059536
has title: Create a wrapper for HttpClient
tagged with: apache
has body: So im pretty new to programming so bear with me, So i've made a simple program that sends a HttpGet and get the respons from the server and some other stuff. But now I want to implement in a wrapper or something ,so that I can call apon an httpclient with my extra code so I can reuse that code when I need it So could someone give me an example on how too do it ?
has comment: http://stackoverflow.com/comment/38060413
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
answer count: 0
tagged with: java

lucene
tags question: http://stackoverflow.com/q/24456655
tags question: http://stackoverflow.com/q/24497874
tags question: http://stackoverflow.com/q/24444875
tags question: http://stackoverflow.com/q/24585283
tags question: http://stackoverflow.com/q/24447193
tags question: http://stackoverflow.com/q/24575010
tags question: http://stackoverflow.com/q/24440847
tags question: http://stackoverflow.com/q/24512121
tags question: http://stackoverflow.com/q/24534085
type: Tag
tags question: http://stackoverflow.com/q/24436916
tag name: lucene
tags question: http://stackoverflow.com/q/24519254
tags question: http://stackoverflow.com/q/24494968
tags question: http://stackoverflow.com/q/24488462
tags question: http://stackoverflow.com/q/24466779

http://stackoverflow.com/q/24472071
has title: How to draw a line on a shapefile using Geotools
answer count: 1
upvote count: 4
favorite count: 0
has body: I have a shapefile that is opened and looks as such: Now I am attempting to draw a line from two points I click on that map; however the code they give for the QuickStart.java example is exceptionally vague. Here is their code: package org.geotools.tutorial; import java.io.File; import org.geotools.data.FileDataStore; import org.geotools.data.FileDataStoreFinder; import org.geotools.data.simple.SimpleFeatureSource; import org.geotools.map.FeatureLayer; import org.geotools.map.Layer; import org.geotools.map.MapContent; import org.geotools.styling.SLD; import org.geotools.styling.Style; import org.geotools.swing.JMapFrame; import org.geotools.swing.data.JFileDataStoreChooser; import org.geotools.geometry.jts.JTSFactoryFinder; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.LineString; /** * Prompts the user for a shapefile and displays the contents on the screen in a map frame. * &lt;p&gt; * This is the GeoTools Quickstart application used in documentationa and tutorials. * */ public class Quickstart { /** * GeoTools Quickstart demo application. Prompts the user for a shapefile and displays its * contents on the screen in a map frame */ public static void main(String[] args) throws Exception { // display a data store file chooser dialog for shapefiles File file = JFileDataStoreChooser.showOpenFile("shp", null); if (file == null) { return; } FileDataStore store = FileDataStoreFinder.getDataStore(file); SimpleFeatureSource featureSource = store.getFeatureSource(); // Create a map content and add our shapefile to it MapContent map = new MapContent(); map.setTitle("Quickstart"); Style style = SLD.createSimpleStyle(featureSource.getSchema()); Layer layer = new FeatureLayer(featureSource, style); map.addLayer(layer); // Now display the map JMapFrame.showMap(map); } } Now, where I am confused is as to what method I should use to click two points and draw a line between them? Anyone have any good resources on this? I've read up on the GeoTool…
has answer: http://stackoverflow.com/a/24632929
has comment: http://stackoverflow.com/comment/38149784
accepted answer: http://stackoverflow.com/a/24632929
tagged with: gis
has comment: http://stackoverflow.com/comment/37962151
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: geotools
type: Question
score: 4
tagged with: shapefile
has comment: http://stackoverflow.com/comment/38149394

http://stackoverflow.com/a/24556819
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/38034699
answers question: http://stackoverflow.com/q/24556110
has comment: http://stackoverflow.com/comment/38033949
downvote count: 0
has comment: http://stackoverflow.com/comment/38039426
has comment: http://stackoverflow.com/comment/38039697
type: Answer
has body: As Vakh said, use an ExecutorService to run the threads, however I would recommend using a SingleThreadExecutor. The SingleThreadExectutor is guaranteed to execute threads sequentially because unlike a FixedThreadPool it can not be reconfigured to use a different number of threads. ExecutorService es = Executors.newSingleThreadExecutor(); // one thread only // ... for(Runnable r : myRunnables) { es.submit(r); } You can also call Thread.join() to tell the current thread to block exectution until the other thread dies. Thread t = new Thread(myRunnable); t.join(); //Wait until t dies There are variations of join which will set a maximum wait time

http://stackoverflow.com/q/24446861
has comment: http://stackoverflow.com/comment/37835950
upvote count: 1
has comment: http://stackoverflow.com/comment/37840499
has comment: http://stackoverflow.com/comment/37835887
has title: Getting Null values of current visible windows titles
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37835426
accepted answer: http://stackoverflow.com/a/24463093
tagged with: java
has comment: http://stackoverflow.com/comment/37839364
has comment: http://stackoverflow.com/comment/37839852
type: Question
has comment: http://stackoverflow.com/comment/37840579
has comment: http://stackoverflow.com/comment/37842537
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jna
has body: I have created this program to get current visible window names. This gives names of all windows that are opened on a system. import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class WindowNames { String s3; static int arraySize = 10; static int arrayGrowth = 2; static String[] m = new String[arraySize]; static int count = 0; public static void main(String[] args) { final List&lt;WindowInfo&gt; inflList = new ArrayList&lt;WindowInfo&gt;(); final List&lt;Integer&gt; order = new ArrayList&lt;Integer&gt;(); int top = User32.instance.GetTopWindow(0); while (top != 0) { order.add(top); top = User32.instance.GetWindow(top, User32.GW_HWNDNEXT); } User32.instance.EnumWindows(new WndEnumProc() { @Override public boolean callback(int hWnd, int lParam) { if (User32.instance.IsWindowVisible(hWnd)) { RECT r = new RECT(); User32.instance.GetWindowRect(hWnd, r); if (r.left &gt; -32000) { // minimized PointerType hwnd = User32.instance.GetForegroundWindow(); byte[] buffer = new byte[1024]; User32.instance.GetWindowTextA(hWnd, buffer, buffer.length); String title = Native.toString(buffer); if (m.length == count) { // expand list m = Arrays.copyOf(m, m.length + arrayGrowth); } m[count] = Native.toString(buffer); System.out.println("title====" + m[count]); count++; inflList.add(new WindowInfo(hWnd, r, title)); } } return true; } }, 0); Collections.sort(inflList, new Comparator&lt;WindowInfo&gt;() { public int compare(WindowInfo o1, WindowInfo o2) { return order.indexOf(o1.hwnd) - order.indexOf(o2.hwnd); } }); for (WindowInfo w : inflList) { System.out.println(w); } } public static interface WndEnumProc extends StdCallLibrary.StdCallCallback { boolean callback(int hWnd, int lParam); } public static interface User32 extends StdCallLibrary { final User32 instance = (User32) Native.loadLibrary("user32", User32.class); boolean EnumWindo…
score: 1
has answer: http://stackoverflow.com/a/24463093

http://stackoverflow.com/q/24551144
possible better answer: http://stackoverflow.com/a/24552407
tagged with: jaxb
type: Question
answer count: 2
score: 5
favorite count: 0
has body: i started a small new project and i want to deserialize objects from XML. i created a xsd: http://pastebin.com/n1pwjRGX and an example XML File : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <variableHoliday daysAfterEaster="49" name="PENTECOAST" /> <fixedHoliday month="JANUARY" day="1" name="NEWYEAR" /> <fixedHoliday month="APRIL" day="1" name="FUNNYDAY" /> <variableHoliday daysAfterEaster="0" name="EASTERSUNDAY" /> <variableHoliday daysAfterEaster="12" name="CORPUSCHRISTI" /> <fixedHoliday month="JULY" day="4" name="INDEPENDENCEDAY" /> <fixedHoliday month="JULY" day="4" name="INDEPENDENCEDAY" /> Which should use the xsd and so on. So how can i achive the deserialization of these XML to a nice Java-Object Structure? Mabe like : class HDB { private HashMap<CountryCode,Country> map; } class Country { private List<Holiday> list; // or two Lists with <variableHoliday> and <fixedHoliday> private List regions; } class Region{ private List<Holiday> list; // or two Lists with <variableHoliday> and <fixedHoliday> } class variableHoliday { private String name; private int daysAfterEaster; } class fixedHoliday { private String name; private int day; private MonthName month; // while MonthName is an enum defined like the enum from XSD } Any ideas how to achive that easy? I thought of jaxb an tried some stuff, but it seems to me (im a beginner with jaxb) that its hard to achive this XML structure because of maps cant be written like v.
has title: Parsing/Deserialize XML to JavaObjects
accepted answer: http://stackoverflow.com/a/24551384
tagged with: http://stackoverflow.com/tag/xml
upvote count: 5
downvote count: 0
tagged with: xsd
has answer: http://stackoverflow.com/a/24552407
has answer: http://stackoverflow.com/a/24551384
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37861066
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24464074
score: 0
has text: Maybe a Future is what you're looking for.

http://stackoverflow.com/comment/38056945
comment on: http://stackoverflow.com/q/24569304
type: Comment
type: QuestionComment
has text: an easier way would be simply to split `line` using `line.split (": ");`
score: 0

http://stackoverflow.com/comment/37958662
type: Comment
has text: sorry but i don't undrestand what do you mean by 'path it inyour code'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24516353

blender
tags question: http://stackoverflow.com/q/24456321
tag name: blender
type: Tag

http://stackoverflow.com/comment/38065047
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24573018
type: Comment
has text: Did you set android.permission.READ_LOGS permission in your manifest file?

http://stackoverflow.com/comment/37826383
score: 1
comment on: http://stackoverflow.com/q/24445400
has text: No. I'm pretty sure this has been asked before...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24508570
type: Answer
accepted answer of: http://stackoverflow.com/q/24507626
answers question: http://stackoverflow.com/q/24507626
has comment: http://stackoverflow.com/comment/37943618
has body: You can try this: public void onClick(View v){ smoke.setVisibility(View.VISIBLE); Handler delayedAction = new Handler(); delayedAction.postDelayed(new Runnable() { public void run() { smoke.setVisibility(View.INVISIBLE); } }, 500); }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37944393

unmarshalling
tags question: http://stackoverflow.com/q/24499509
tag name: unmarshalling
tags question: http://stackoverflow.com/q/24439760
type: Tag
tags question: http://stackoverflow.com/q/24529416

http://stackoverflow.com/a/24560086
type: Answer
has body: The syntax of the call commands to use cam.setPreviewCallback(this); from inside the CameraOperations class. To have the preview callbacks, you must call cam.startPreview(); If you want your parameters to be used (e.g. after changing the preview format), you need cam.setParameters(parameters); Normally, you want to set parameters before you startPreview().
score: 0
has comment: http://stackoverflow.com/comment/38105121
answers question: http://stackoverflow.com/q/24558093

rest
tags question: http://stackoverflow.com/q/24574900
tags question: http://stackoverflow.com/q/24481542
tags question: http://stackoverflow.com/q/24484160
tags question: http://stackoverflow.com/q/24530650
tags question: http://stackoverflow.com/q/24498964
tags question: http://stackoverflow.com/q/24462061
tags question: http://stackoverflow.com/q/24539478
tags question: http://stackoverflow.com/q/24514518
tags question: http://stackoverflow.com/q/24451062
tags question: http://stackoverflow.com/q/24445096
tags question: http://stackoverflow.com/q/24516534
tags question: http://stackoverflow.com/q/24534287
tags question: http://stackoverflow.com/q/24548964
tags question: http://stackoverflow.com/q/24574935
tags question: http://stackoverflow.com/q/24516444
tags question: http://stackoverflow.com/q/24474411
tags question: http://stackoverflow.com/q/24501369
tags question: http://stackoverflow.com/q/24490976
tags question: http://stackoverflow.com/q/24429556
tags question: http://stackoverflow.com/q/24585103
tags question: http://stackoverflow.com/q/24497344
tags question: http://stackoverflow.com/q/24519044
tags question: http://stackoverflow.com/q/24457646
tags question: http://stackoverflow.com/q/24501590
tags question: http://stackoverflow.com/q/24518150
tags question: http://stackoverflow.com/q/24550641
tags question: http://stackoverflow.com/q/24535411
tags question: http://stackoverflow.com/q/24455509
tags question: http://stackoverflow.com/q/24432098
tags question: http://stackoverflow.com/q/24491103
tags question: http://stackoverflow.com/q/24462040
tags question: http://stackoverflow.com/q/24447280
tags question: http://stackoverflow.com/q/24441020
tags question: http://stackoverflow.com/q/24550906
tags question: http://stackoverflow.com/q/24567779
tags question: http://stackoverflow.com/q/24476719
tags question: http://stackoverflow.com/q/24430048
tags question: http://stackoverflow.com/q/24551412
tags question: http://stackoverflow.com/q/24549971
tags question: http://stackoverflow.com/q/24553832
tags question: http://stackoverflow.com/q/24462483
tags question: http://stackoverflow.com/q/24515853
type: Tag
tags question: http://stackoverflow.com/q/24546168
tags question: http://stackoverflow.com/q/24547767
tags question: http://stackoverflow.com/q/24429636
tags question: http://stackoverflow.com/q/24500279
tags question: http://stackoverflow.com/q/24472536
tags question: http://stackoverflow.com/q/24496270
tags question: http://stackoverflow.com/q/24427991
tag name: rest
tags question: http://stackoverflow.com/q/24427710
tags question: http://stackoverflow.com/q/24429943
tags question: http://stackoverflow.com/q/24559288
tags question: http://stackoverflow.com/q/24493627
tags question: http://stackoverflow.com/q/24445901
tags question: http://stackoverflow.com/q/24446767

http://stackoverflow.com/comment/37829684
comment on: http://stackoverflow.com/q/24431728
score: 0
type: Comment
has text: I want to copy a folder needed in other module
type: QuestionComment

http://stackoverflow.com/q/24498345
has title: Hibernate and DOUBLE in Oracle 11g
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I'm porting an application written for Sybase and Hibernate 3.6.4 to start using Oracle 11g. As I understand people were able to get Hibernate working with Oracle 11g using Oracle10gDialect. I'm using that but for one of the columns which is mapped java.lang.Double I'm having issues. When I create the table with the column as BINARY_DOUBLE, hibernate complains saying: Caused by: org.hibernate.HibernateException: Wrong column type in TEST_SCHEMA.TEST_TABLE for column PERCENTAGE. Found: binary_double, expected: double precision and when I define the column as DOUBLE PRCEISION, it complains saying: Caused by: org.hibernate.HibernateException: Wrong column type in TEST_SCHEMA.TEST_TABLE for column PERCENTAGE. Found: float, expected: double precision Looking at the docs both of these errors make sense because there's no Double data type in Oracle. But looking at the Dialect code, I'm not sure why I'm seeing the second error. Class org.hibernate.dialect.Oracle8iDialect has this method which has "double precision" mapped to Types.DOUBLE protected void registerNumericTypeMappings() { registerColumnType( Types.BIT, "number(1,0)" ); registerColumnType( Types.BIGINT, "number(19,0)" ); registerColumnType( Types.SMALLINT, "number(5,0)" ); registerColumnType( Types.TINYINT, "number(3,0)" ); registerColumnType( Types.INTEGER, "number(10,0)" ); registerColumnType( Types.FLOAT, "float" ); registerColumnType( Types.DOUBLE, "double precision" ); registerColumnType( Types.NUMERIC, "number($p,$s)" ); registerColumnType( Types.DECIMAL, "number($p,$s)" ); } So, I'm not sure why DOUBLE PRECISION is not working for me. Any pointers on what I'm doing wrong here. I'm sure those who have tested Oracle11gDialect would have used Double in their code. Thanks, K.
has comment: http://stackoverflow.com/comment/37925374
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/2524966
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37926275
has comment: http://stackoverflow.com/comment/105002217
tagged with: oracle-database
has answer: http://stackoverflow.com/a/33152133
score: 1

http://stackoverflow.com/a/24554865
has body: Thanks to the comments, I had a look at synchronized / wait() / notify() again. So here is another working and more elegant solution: public class MyClass { protected Something myAttribute; protected boolean busy = true; protected final Object lock = new Object(); public ReactiveLogger() { new Thread(new FileListener()).start(); } private class FileListener implements Runnable { @Override public void run() { RandomAccessFile raf = new RandomAccessFile(LOG_FILE, "rw"); while (true) { final String line = cutFirstLine(raf); if (line == null) { busy = false; synchronized (lock) { lock.notifyAll(); } Thread.sleep(1000); } else { busy = true; // handeLogMessage changes myAttribute handleLogMessage(line); } } } // definition of cutFirstLine etc. } // definition of handleLogMessage etc. public Something getSomething() { synchronized (lock) { while (busy) { lock.wait(); } } return myAttribute; } } But there may still be better solutions. Java luminary Josh Bloch strictly advises against using these methods in his book Effective Java 2nd Edition (from this answer): Given the difficulty of using wait and notify correctly, you should use the higher-level concurrency utilities instead [...] using wait and notify directly is like programming in "concurrency assembly language", as compared to the higher-level language provided by java.util.concurrent. There is seldom, if ever, reason to use wait and notify in new code.
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24551244
accepted answer of: http://stackoverflow.com/q/24551244

http://stackoverflow.com/comment/37806572
has text: FWIW, the amount of GLES required for simple sprite animation is pretty minimal. One example: https://code.google.com/p/android-breakout/ One thing you might want to check is how many input events you're handling per frame -- if you're getting 1000 events per second, and performing a heavyweight action after each, it's going to bog you down.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24433595
type: QuestionComment

http://stackoverflow.com/q/24566192
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38051580
tagged with: applet
has comment: http://stackoverflow.com/comment/38051699
has comment: http://stackoverflow.com/comment/38051366
type: Question
has answer: http://stackoverflow.com/a/24566542
has comment: http://stackoverflow.com/comment/38051392
has comment: http://stackoverflow.com/comment/38051611
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38051317
accepted answer: http://stackoverflow.com/a/24566542
has comment: http://stackoverflow.com/comment/38051855
tagged with: java
has body: I am writing an applet which contains a panel (PanelCondition) with a java.awt.choice dropdown. http://docs.oracle.com/javase/7/docs/api/java/awt/Choice.html public class PanelCondition extends Panel { Choice choiceCond = new Choice(); public PanelCondition(bool isGood) { setCond(isGood); } private void setCond(boolean isGood) { condCode = getCondItems(isGood); this.choiceCond.removeAll(); for (int i=0; i &lt; condCode.length; i++) { this.choiceCond.addItem(condCode[i]); } this.choiceCond.repaint(); } ... } The PanelCondition is included in a java.awt.Frame public class FrameExample extends Frame { PanelCondition cond; private void setCond(bool isGood) { cond = new PanelCondition(isGood) this.add(orderCond,...) ... } } When the FrameExample.setCond() is called first time (isGood=true), the correct items are added to the dropdownlist. However if I call the setCond() the second time (isGood=false), the dropdownlist items don't have any changes. I have tried to call this.choiceCond.validate() or this.choiceCond.repaint, but it still doesn't work.
has comment: http://stackoverflow.com/comment/38051891
has title: Java Applet java.awt.Choice Add Item not working for second time

http://stackoverflow.com/comment/37979760
score: 0
comment on: http://stackoverflow.com/q/24528068
type: QuestionComment
type: Comment
has text: fileinput.value does not give me any file data See this http://jsfiddle.net/PKVq5/1/

http://stackoverflow.com/comment/37799137
has text: This post [Support of pagination in smartGWT for ListGrid?](http://stackoverflow.com/questions/9468486/support-of-pagination-in-smartgwt-for-listgrid) might help you.
comment on: http://stackoverflow.com/q/24427658
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24498217
type: AnsweredQuestion
tagged with: arrays
tagged with: bubble-sort
tagged with: sorting
type: Question
has comment: http://stackoverflow.com/comment/37928368
linked to: http://stackoverflow.com/q/12757841
accepted answer: http://stackoverflow.com/a/24498622
has body: I'm trying to write a program that generates an array populated by random numbers, then bubble sorts them and returns the sorted array as a separate array so you can compare the two. However, once I create my random array and then try to created another sorted one, the sorted array "overwrites" the random one and the random one appears as a sorted one when I try to print it out. My question is: How can I modify my code so that I can create and array of random doubles, then generate another, separate, array which is the sorted version of that random one? Main: import java.io.IOException; import java.util.InputMismatchException; import java.util.Scanner; public class BubbleMain { public static void main(String args[])throws IOException{ int n; Scanner keyboard = new Scanner(System.in); while(true){ try{ System.out.println("Enter the size of the array"); n = keyboard.nextInt(); if(n &gt;= 2){ break; } System.out.println("Size must be 2 or greater"); }catch(InputMismatchException e){ System.out.println("Value must be an integer"); keyboard.nextLine(); } } double[] template = new double[n]; double[] mess = Bubble.randPop(template); double[] tidy = Bubble.bubbleSort(mess); Bubble.printOut(mess); Bubble.printOut(tidy); } } Bubble Class: public class Bubble { private double[] list; public Bubble(double[] list){ this.list = list; } public double[] getArray(){ return list; } public static double[] randPop(double[] template){ for(int i = 0; i &lt; template.length; i++){ template[i] = Math.random(); } return template; } public static double[] bubbleSort(double[] mess){ double[] tidy = new double[mess.length]; for(int i=0; i&lt;mess.length; i++) { for(int j=i + 1; j&lt;mess.length; j++) { if(mess[i] &gt; mess[j]) { double temp = mess[i]; mess[i] = mess[j]; mess[j] = temp; } } tidy[i] = mess[i]; } return tidy; } public static void printOut(double[] list){ for(int i = 0; i &lt; list.length; i++){ System.out.println(list[i]); } } }
score: 0
answer count: 2
tagged with: arrayobject
possible better answer: http://stackoverflow.com/a/24498661
has answer: http://stackoverflow.com/a/24498661
has comment: http://stackoverflow.com/comment/37928413
tagged with: java
has comment: http://stackoverflow.com/comment/37925653
has comment: http://stackoverflow.com/comment/37925190
has answer: http://stackoverflow.com/a/24498622
has title: Return a bubble sort as a separate array

http://stackoverflow.com/comment/38039209
comment on: http://stackoverflow.com/q/24559843
type: Comment
score: 1
has text: The server apparently only allows 3 connections per client IP address. Unfortunately, there is no way in Java to reject a TCP connection before accepting it. So, the connection is closed right after accepting it.
type: QuestionComment

http://stackoverflow.com/comment/37803290
type: QuestionComment
has text: @Sankumarsingh yes Your are right thank so much for your reply.. and can you give it as asnswer pls
comment on: http://stackoverflow.com/q/24429232
score: 0
type: Comment

http://stackoverflow.com/q/24462061
tagged with: eclipse
type: Question
answer count: 1
score: 0
tagged with: rest
has body: While executing POST request using Jersey 2.9 on Eclipse, I can see Class HttpDateFormat but one of it's method "getPreferedDateFormat" is not found ! Any idea ? I see following error during runtime: NoSuchMethodError: org.glassfish.jersey.message.internal.HttpDateFormat.getPreferedDateFormat()
has title: Class HttpDateFormat found but method "getPreferedDateFormat" NOT found
type: UnansweredQuestion
tagged with: jersey-client
tagged with: java
has answer: http://stackoverflow.com/a/24703090

http://stackoverflow.com/comment/37959893
comment on: http://stackoverflow.com/q/24516070
has text: Why you need to call the run method a second time? Can't you just `@Autowire` or `@Import` ScheduledTasks in Application?
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/24439901
accepted answer of: http://stackoverflow.com/q/24439843
upvote count: 5
has body: Background: This is called anonymous class. It is a class that extends a non final class or implements a single interface and you're creating a single instance of this class. Now, to your questions: 1) Are these functions overwritten at an instance level? No, they are at level class. You have a new subclass of the desired class and this subclass overrides the method. Then, you create a new instance of the subclass. 2) Does this language feature have a name? Yes, it is anonymous class.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37816841
type: Answer
has comment: http://stackoverflow.com/comment/37816763
downvote count: 1
has comment: http://stackoverflow.com/comment/37816701
score: 4
answers question: http://stackoverflow.com/q/24439843
has comment: http://stackoverflow.com/comment/37816658

http://stackoverflow.com/a/24600297
upvote count: 9
has body: You can use a css trick for this, using looked-up colors. In an external CSS file, define a looked-up color for the beginning of the linear gradient, and define the text fill using a linear gradient that references the looked-up color: animated-gradient.css: .animated-gradient { -gradient-base: red ; -fx-text-fill: linear-gradient(to right, -gradient-base, black); } Then "animate" a color property, and update the inline style to change the value of the looked-up color whenever the property changes: import javafx.animation.Animation; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.util.Duration; public class AnimatedGradient extends Application { @Override public void start(Stage primaryStage) { StackPane root = new StackPane(); Label label = new Label("Animated gradient"); root.getChildren().add(label); label.getStyleClass().add("animated-gradient"); Scene scene = new Scene(root,400,400); scene.getStylesheets().add(getClass().getResource("animated-gradient.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); ObjectProperty&lt;Color&gt; baseColor = new SimpleObjectProperty&lt;&gt;(); KeyValue keyValue1 = new KeyValue(baseColor, Color.RED); KeyValue keyValue2 = new KeyValue(baseColor, Color.YELLOW); KeyFrame keyFrame1 = new KeyFrame(Duration.ZERO, keyValue1); KeyFrame keyFrame2 = new KeyFrame(Duration.millis(500), keyValue2); Timeline timeline = new Timeline(keyFrame1, keyFrame2); baseColor.addListener((obs, oldColor, newColor) -&gt; { label.setStyle(String.format("-gradient-base: #%02x%02x%02x; ", (int)(newColor.getRed()*255), (int)(newColor.getGreen()*255), (int)(newColor.getBlue()*255))…
downvote count: 0
answers question: http://stackoverflow.com/q/24587342
type: Answer
score: 9
has comment: http://stackoverflow.com/comment/47004549

http://stackoverflow.com/q/24481429
has answer: http://stackoverflow.com/a/24545911
accepted answer: http://stackoverflow.com/a/24545911
type: Question
has comment: http://stackoverflow.com/comment/37896732
has title: Hibernate HQL Projection Using Entities ManyToMany Definitions Issue
score: 1
tagged with: java
tagged with: hibernate
tagged with: hql
has comment: http://stackoverflow.com/comment/37894698
tagged with: sql
answer count: 1
tagged with: jpa
downvote count: 0
has body: Problem: HQL query is not returning any results when I reference an entities collection field as part of the HQL statement. It works for one HQL projection for example like this: select inc.categoryTypes as categoryTypes from IncidentEntity inc where (inc.id = :id105019) The categoryTypes is one of the IncidentEntity classes fields (which is a collection defined as a ManyToMany join as seen below). This works fine, but the issue arises when I am attempting to reference another projection collection that is mapped as a ManyToMany join. select inc.categoryTypes as categoryTypes, inc.consequences as consequences from IncidentEntity inc where (inc.id = :id105019) As soon as I do it like this, I get an empty set. Which means the SQL query that hibernate generates isn't returning anything. I have verified this by executing the command within SQL Manager which returns no results. Here is the IncidentEntity: /** * Database entity for the 'incidents' table records.&lt;br&gt; * Entity domain object is {@link nz.co.doltech.ims.shared.domains.Incident} * @author Ben Dol * */ @javax.persistence.Entity(name = "incidents") @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL) public class IncidentEntity implements Entity { ... @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "incident_categorytype", joinColumns = { @JoinColumn(name = "incident_id") }, inverseJoinColumns = { @JoinColumn(name = "categorytype_id") }) private Set&lt;CategoryTypeEntity&gt; categoryTypes = new HashSet&lt;CategoryTypeEntity&gt;(); @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "incident_consequence", joinColumns = { @JoinColumn(name = "incident_id") }, inverseJoinColumns = { @JoinColumn(name = "consequence_id") }) private Set&lt;ConsequenceEntity&gt; consequences = new HashSet&lt;ConsequenceEntity&gt;(); ... public Set&lt;CategoryTypeEntity&gt; getCategoryTypes() { return categoryTypes; } public void setCategoryTypes(Set&lt;CategoryTypeEntity&gt; categoryTypes) { this.categoryTypes = categoryT…
favorite count: 0
has comment: http://stackoverflow.com/comment/37894897
has comment: http://stackoverflow.com/comment/37967183
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/comment/37897025
has text: That "duplicate" is merely a comment and doesn't provide an answer to the question.
comment on: http://stackoverflow.com/q/24482503
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24538754
favorite count: 0
tagged with: spring-jdbc
tagged with: java
has answer: http://stackoverflow.com/a/24560786
upvote count: 1
has title: performance optimization in spring with transaction
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6119966
accepted answer: http://stackoverflow.com/a/24560786
answer count: 1
downvote count: 0
has body: I am making one enterprise application. In which i have task to parse one csv file that contain suppose 50,000 k records. This csv file supplied by the end user at the time of registration. I made one program to parse the csv file into java object and then save all these object into database. This file contain mobile number and before save the csv file as a java object it firstly validated for mobile number. either it exist on database or not. It it is exist then it fails the validation and stop the exection. Now Suppose two different user called A and B send a request for registration.Controller listen this request by the following code. controller layer @Transactional @RequestMapping(value = "/saveCsvData") public ModelAndView saveVMNDataFromCsv(@ModelAttribute("vmn") @Valid VMN vmn, BindingResult result, HttpSession session, HttpServletRequest request) { String response = parseCsvService.parseAndPersistCsv(vmn.getVmnFile(),vmn.getNumberType(), request); } on the controller method i have user @Transactional annotation so that this method can complete its work completely.This controller call the helper call to read line by line from csv file and put them into java object.After getting the list of VMN Object with the help of loop i call service method which again call dao method for ecah line. helper class public String parseAndPersistCsv(MultipartFile csvFile,String numberType, HttpServletRequest request){ List&lt;VMN&gt; vmnList = new ArrayList&lt;VMN&gt;(); if(save){ for(VMN vmn : vmnList){ System.out.println("Remote Host :" + request.getRemoteHost()); System.out.println("Remote Add :" + request.getRemoteAddr()); vmnService.saveVmn(vmn, numberType); } response = constantService.getSuccess(); } } service Layer public String saveVmn(final VMN vmn, String numberType) { vmnService.saveVmn(vmn, numberType); } At Dao Layer method looks like this. This method insert record into multiple tables as it can be seen in method code. Dao Layer public String saveVmn(final VMN v…
score: 1

timer
tag name: timer
tags question: http://stackoverflow.com/q/24543828
tags question: http://stackoverflow.com/q/24538821
tags question: http://stackoverflow.com/q/24461510
tags question: http://stackoverflow.com/q/24495554
tags question: http://stackoverflow.com/q/24455434
tags question: http://stackoverflow.com/q/24470111
tags question: http://stackoverflow.com/q/24440547
type: Tag
tags question: http://stackoverflow.com/q/24452774
tags question: http://stackoverflow.com/q/24579288
tags question: http://stackoverflow.com/q/24515013
tags question: http://stackoverflow.com/q/24463284
tags question: http://stackoverflow.com/q/24459779
tags question: http://stackoverflow.com/q/24483546
tags question: http://stackoverflow.com/q/24465486
tags question: http://stackoverflow.com/q/24527471

http://stackoverflow.com/comment/38349310
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24587059
has text: How could `backgroundImg` have a `null` value when it is never stated? @m0skit0
type: QuestionComment

http://stackoverflow.com/q/24585545
tagged with: nullpointerexception
answer count: 3
possible better answer: http://stackoverflow.com/a/24585573
has comment: http://stackoverflow.com/comment/38086670
has answer: http://stackoverflow.com/a/24585573
has title: NullPointerException in Java when using an object as a field
accepted answer: http://stackoverflow.com/a/24585607
has answer: http://stackoverflow.com/a/24585585
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I'm pretty new to Java, as my post might give away. I need to create a class (let's call it class A) which uses another class (class B) as one of its fields. Class A's constructor calls class B's constructor. So far things work fine. But when one of A's methods tries to use one of B's methods on the object of class B, I get a NullPointerException. This is probably too confusing so I wrote this simple example which creates the Exception. This is class B: public class class_B { private int y; public class_B(int N) { int y = N*N; } public int class_B_method() { return y; } } and this is class A: public class class_A { private class_B obj; public class_A(int N) { class_B obj = new class_B(N); } public int call_class_B_method() { return obj.class_B_method(); } public static void main(String[] args) { int N =4; class_A p = new class_A(N); int a = p.call_class_B_method(); } } When I run class_A I get the exception on the line "int a = p.call_class_B_method();". I don't understand this, since 'obj' should have been created by the constructor 'class_B' and should be available for the method 'call_class_B_method'. thanks!
downvote count: 0
has answer: http://stackoverflow.com/a/24585607
favorite count: 0

http://stackoverflow.com/q/24485348
answer count: 4
linked to: http://stackoverflow.com/q/20199760
has answer: http://stackoverflow.com/a/24485583
has comment: http://stackoverflow.com/comment/37901319
downvote count: 0
has comment: http://stackoverflow.com/comment/37901315
has comment: http://stackoverflow.com/comment/37901341
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24485440
has title: Reason for ConcurrentModificationException on ArrayLists iterator.next()
has comment: http://stackoverflow.com/comment/37909458
has comment: http://stackoverflow.com/comment/37909930
has body: I have no idea why a ConcurrentModificationException occurs when i iterate over an ArrayList. The ArrayList is methode scoped, so it should not be visible by other threads which execute the same code. At least if i understodd multi threading and variable scopes correctly. Caused by: java.util.ConcurrentModificationException at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:64) at com....StrategyHandler.applyStrategy(StrategyHandler.java:184) private List&lt;Order&gt; applyStrategy(StorageObjectTree storageObjectTree) { ... List&lt;OrderHeader&gt; finalList = new ArrayList&lt;Order&gt;(); for (StorageObject storageObject : storageObjectTree.getStorageObjects()) { List&lt;Order&gt; currentOrders = strategy.process(storageObject); ... if (currentOrders != null) { Iterator&lt;Order&gt; iterator = currentOrders.iterator(); while (iterator.hasNext()) { Order order = (Order) iterator.next(); // line 64 // read some values from order } finalList.addAll(currentOrders); } } return finalList; } Can anybody give me an hint what could be the source of the problem?
has comment: http://stackoverflow.com/comment/37901301
score: 4
has comment: http://stackoverflow.com/comment/37901329
has comment: http://stackoverflow.com/comment/37909899
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37901427
has comment: http://stackoverflow.com/comment/37909507
has answer: http://stackoverflow.com/a/24485745
favorite count: 0
has comment: http://stackoverflow.com/comment/37909776
has comment: http://stackoverflow.com/comment/37901777
type: UnansweredQuestion
tagged with: concurrentmodification
has comment: http://stackoverflow.com/comment/37909678
has comment: http://stackoverflow.com/comment/37901313
has comment: http://stackoverflow.com/comment/37901335
has answer: http://stackoverflow.com/a/24485643
upvote count: 4

http://stackoverflow.com/a/24526051
has comment: http://stackoverflow.com/comment/37975944
type: Answer
accepted answer of: http://stackoverflow.com/q/24526006
has comment: http://stackoverflow.com/comment/37975655
answers question: http://stackoverflow.com/q/24526006
has comment: http://stackoverflow.com/comment/37975776
downvote count: 0
type: AcceptedAnswer
score: 10
has body: You just missed to reassign your replaceAll result to expenseUUID var. Then your var still contains a 36 chars string. Current : String expenseUUID = UUID.randomUUID().toString(); expenseUUID.replaceAll("-", ""); System.out.print(expenseUUID); // 9e73f8a4-dfde-438e-9eec-ac4e94817b6b Corrected : String expenseUUID = UUID.randomUUID().toString(); expenseUUID = expenseUUID.replaceAll("-", ""); System.out.print(expenseUUID); // 0757c2666e934e2eb303df68bb3c9761
upvote count: 10

http://stackoverflow.com/comment/38046998
comment on: http://stackoverflow.com/a/24563876
score: 0
type: AnswerComment
type: Comment
has text: That gives all of my activites permission to use internet, and wake the device on certain situations from shut down. There you MUST declare ALL of your activities. http://developer.android.com/guide/topics/manifest/manifest-intro.html

http://stackoverflow.com/q/24584642
upvote count: 2
downvote count: 2
has title: LinkedHashSet is not Removing Duplicates
tagged with: linkedhashset
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24584669
tagged with: java
tagged with: set
has body: I am using LinkedHashSet for removing duplicated entries. But for below custom model the Set still keeps duplicate entries. Please help me to find the bugs. Is there anything wrong with overriding equals method. For your kind information i only treats two node equals when their phone, type and status are same. public class BlockNode { public int id; public int type; public int status; public String phone; public String date; public String content; @Override public boolean equals(Object o) { return this.toString().equals(((BlockNode)o).toString()); } @Override public String toString() { return "number:" + phone + " type:" + type + " status:" + status + "\n"; } }
tagged with: collections
type: Question
linked to: http://stackoverflow.com/q/14748095
has comment: http://stackoverflow.com/comment/38085092
tagged with: duplicates
duplicate of: http://stackoverflow.com/q/14748095
has answer: http://stackoverflow.com/a/24584672
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24584669
possible better answer: http://stackoverflow.com/a/24584672
favorite count: 0

http://stackoverflow.com/q/24485709
accepted answer: http://stackoverflow.com/a/24488585
tagged with: maven
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
has title: Nested property in Maven profile for plugin configuration
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24488585
score: 6
tagged with: nested-properties
has body: I have a Java EE 7 project which is deployed to WildFly 8.1.0-Final. I use a standalone Wildfly server managed by Maven (i.e., clean configuration on every mvn clean) for testing, and the "normal" server remotely. In order to deploy to both servers with the maven-wildfly-plugin (1.0.2.Final), I have configured two Maven profiles: wildfly-local, which defines local username, password, and port number; and wildfly-remote, which defines remote username, password, and port number. However, the remote server runs in domain mode, while the local server does not. Thus, I am required to define a domain configuration with a server-group for the remote server, like so: ... wildfly-maven-plugin ${wildfly-hostname} ${wildfly-username} ${wildfly-password} ${wildfly-server-group} ... ... ${wildfly-hostname} and the three other proiperties are defined in the profile, and this configuration works. However, the standalone, non-"domain mode" local test server does not allow deployment of an application where a server-group is defined at all. My first thought was to define a nested property in the remote profile, like so: wildfly-remote ... *my server group name* ... ... and a simple property in the local profile, like so: wildfly-local Maven does not like this because it cannot parse tags where text is expected. Is there any way of defining a "resource" which is nested in one Maven profile, but flat in another?
favorite count: 0

http://stackoverflow.com/q/24445901
score: 3
upvote count: 3
has answer: http://stackoverflow.com/a/24448770
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24448770
tagged with: jersey
downvote count: 0
tagged with: tomcat
tagged with: rest
answer count: 1
favorite count: 0
has body: I want to upload images into server using restful jersey web services.I have included jersey-multipart-1.9.jar,jersey-bundle-1.14.jar and asm-3.3.1.jar jar files and I am not using Maven. Below code snippet for upload function. @POST @Path("/uploadImage") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile(@FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader) { String filePath = SERVER_UPLOAD_LOCATION_FOLDER + contentDispositionHeader.getFileName(); saveFile(fileInputStream, filePath);//method to save the file. String output = "File saved to server location : " + filePath; return Response.status(200).entity(output).build(); } But i am getting following error when i deploy or run it in apache tomcat 7. SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.sec.samsung.FileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 0 SEVERE: Missing dependency for method public javax.ws.rs.core.Response com.sec.samsung.FileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 1 SEVERE: Method, public javax.ws.rs.core.Response com.sec.samsung.FileUpload.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition), annotated with POST of resource, class com.sec.samsung.FileUpload, is not recognized as valid resource method. SEVERE: Servlet /uploadImage threw load() exception com.sun.jersey.spi.inject.Errors$ErrorMessagesException at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.jav…
has title: File upload services using jersey in tomcat without maven
type: AnsweredQuestion

http://stackoverflow.com/q/24531252
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has body: I have an acitivity with three fragments is attched on it and there is a class that is responsible for my tcp connection in activity. TCP class works as async. Inside onCreate method of main activity I am starting the tcp connection. Then when I click a button I am starting a new activity and getting the current tcp connection in new activity using a singleton class. I can send messages from the new activity to server using the available tcp. However it is an asyc task so I can't do changes in new activity according to the message that is received from server. How can I change the layout of new activity from async task? //Activity code: public class MainScreen extends FragmentActivity implements ActionBar.TabListener { TCPClient mTcpClient; connectTask cnnTask; ///The class is responsible for tcp connection public class connectTask extends AsyncTask&lt;String, String, TCPClient&gt; { @Override public TCPClient doInBackground(String... message) { //we create a TCPClient object mTcpClient = new TCPClient(new TCPClient.OnMessageReceived() { @Override //here the messageReceived method is implemented public void messageReceived(String message) { //do process } } protected void onCreate(Bundle savedInstanceState) { SharedPreferences preferences = null; super.onCreate(savedInstanceState); try { cnnTask = new connectTask(); preferences = this.getSharedPreferences("MyPreferences", Context.MODE_PRIVATE); mTcpClient.SERVERIP = preferences.getString("IPAddress", "0"); mTcpClient.SERVERPORT = Integer.parseInt(preferences.getString("Port", "13759")); cnnTask.execute(""); } catch (Exception e) { } //.. SingletonTCP .getInstance().setmTCPClient(mTcpClient); } //Fragment code: public class FragmentDesign extends Fragment implements View.OnClickListener { public void onClick(View v) { String name = v.getTag().toString(); Intent intent = new Intent(getActivity(),NewActivity.class); intent.putExtra("Name", this._name); startActivity(intent); } } //Singleton class to set and get the cur…
tagged with: tcp
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24531316
score: 0
answer count: 1
tagged with: android-activity
has title: Calling activity from inside a background thread

http://stackoverflow.com/q/24494024
has comment: http://stackoverflow.com/comment/37918409
type: Question
has comment: http://stackoverflow.com/comment/37917366
accepted answer: http://stackoverflow.com/a/24494210
has comment: http://stackoverflow.com/comment/37918313
has title: method overloading and primitive types
has comment: http://stackoverflow.com/comment/37917396
tagged with: overriding
has body: I have a java program that I want to discuss here and get your thoughts and opinions public class StackFriends { public static void go(short n) { System.out.println("short"); } public static void go(Short n) { System.out.println("SHORT"); } public static void go(Long n) { System.out.println("LONG"); } public static void main(String[] args) { Short y = 6; int z = 7; go(y); go(z); } } Why do I get compile time error? is it because for both go(y) and go(z) the compiler cannot decide whether to call go(Long n), go(Short n) or go(short n)? is the declaration Short y = 6; valid? If it is valid, public static void go(Short n) -- would accept only the wrapper object of type Short? Please let me know how wrapper classes behave and are the possible values they can take as arguments in this case? I know I can do a little more research and find it all by myself, but it gets a little lonely to use the compiler all by yourself, I just want to discuss it and learn, it gives a lot of joy.
has answer: http://stackoverflow.com/a/24494210
has comment: http://stackoverflow.com/comment/37917441
answer count: 3
downvote count: 3
possible better answer: http://stackoverflow.com/a/24494133
favorite count: 0
has comment: http://stackoverflow.com/comment/37917519
score: -3
has answer: http://stackoverflow.com/a/24494133
has answer: http://stackoverflow.com/a/24494188
has comment: http://stackoverflow.com/comment/37917340
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/37917509
tagged with: java
has comment: http://stackoverflow.com/comment/37932489

http://stackoverflow.com/a/24501509
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24496757
has comment: http://stackoverflow.com/comment/37963656
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24496757
has comment: http://stackoverflow.com/comment/71402553
type: Answer
has body: It looks like PgJDBC sets the client encoding once it's authenticated and connected, not in the protocol startup packet. So the server doesn't know the encoding PgJDBC expects and uses its default encoding - but PgJDBC must be ignoring the server's notification about the server encoding. That's clearly a bug; I'll chase it up if time permits. It's possible that I have the protocol flow order wrong here, though. I think the startup packet carries the encoding and is sent pre-auth. If I'm wrong then this is a protocol issue that requires a protocol rev to fix - not quick or simple. I'll check. Meanwhile here's the pgjdbc bug. (On a side note, PostgreSQL also mixes different text encodings in its log files, creating a horrible mess, because it emits log messages to the logs in the client_encoding. I've looked at fixing this before but there's been resistance to what I see as the only possible fixes - a log file per database and logging in the database default encoding, or preferably just logging everything in utf-8).
score: 3
downvote count: 0

http://stackoverflow.com/q/24454936
favorite count: 0
accepted answer: http://stackoverflow.com/a/24456077
tagged with: javafx-2
upvote count: 1
has title: NoSuchMethodException <init>() when extending javafx.scene.chart.LineChart
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24455088
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/24455326
has answer: http://stackoverflow.com/a/24455326
has answer: http://stackoverflow.com/a/24456077
answer count: 3
has body: I am trying to extend javafx.scene.chart.LineChart in order to add some extra features. I have implemented the two constructors public LiveLineChart(Timeline animation, Axis&lt;Number&gt; xAxis, Axis&lt;Number&gt; yAxis) and public LiveLineChart(Timeline animation, Axis&lt;Number&gt; xAxis, Axis&lt;Number&gt; yAxis, ObservableList&lt;Series&lt;Number, Number&gt;&gt; data) My project compiles, however, when I run, I get this: Caused by: java.lang.NoSuchMethodException: org.mypackage.LiveLineChart.&lt;init&gt;() at java.lang.Class.getConstructor0(Class.java:2971) at java.lang.Class.newInstance(Class.java:403) ... 20 more If I try to implement a default (empty) constructor, I get a compile error: no suitable constructor found for LineChart(no arguments) constructor LineChart.LineChart(Axis&lt;Number&gt;,Axis&lt;Number&gt;) is not applicable (actual and formal argument lists differ in length) constructor LineChart.LineChart(Axis&lt;Number&gt;,Axis&lt;Number&gt;,ObservableList&lt;Series&lt;Number,Number&gt;&gt;) is not applicable (actual and formal argument lists differ in length) What am I missing to be able to get this to run?
downvote count: 0
score: 1

http://stackoverflow.com/q/24494573
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has body: I have a performance issue with the following Hibernate TypedQuery: select generatedAlias0 from MyClass1 as generatedAlias0 where generatedAlias0.class2.uid in (:param0, ..., :paramN) Following the actual implementation this results in the following query: select myclass1_.id, myclass1_.other, ... # 16 fields in total, no special big ones from myschema.dbo.TblMyClass1 myclass1_ cross join myschema.dbo.TblMyClass2 myclass2_ where myclass1_.myclass2Id=myclass2.Id and (myclass2_.uid in('value1', ... 'valueN')) Where N each time stands for 384 items. When I execute this query in Toad it only takes about 150ms, but executed from code it takes almost a minute! Class mappings @Entity @Table(name = "TblMyClass1", catalog = "myschema", schema = "dbo") public class MyClass1 implements Serializable { private static final long serialVersionUID = 8208493383744288872L; @Id @Column(name = "Id") @GeneratedValue(strategy = GenerationType.AUTO) protected Integer id; @NotNull @ManyToOne @JoinColumn(name = "myclass2Id", referencedColumnName = "Id", nullable = false) private MyClass2 class2 = null; @NotNull @ManyToOne @JoinColumn(name = "myclass3Id", referencedColumnName = "Id", nullable = false) private MyClass3 class3 = null; @NotNull @ManyToOne @JoinColumn(name = "myClass4Id", referencedColumnName = "Id", nullable = false) private MyClass4 myClass4; @ManyToOne @JoinColumn(name = "myClass5Uid", referencedColumnName = "UID", nullable = true) private MyClass5 resultType; @Column(name = "string2", nullable = true) private String string2; // other column fields and getters and setters ... } @Entity @Table(name = "TblMyClass2", schema = "myschema", catalog = "dbo") public final class MyCLass2 implements Serializable { private static final long serialVersionUID = 4660579327140751989L; @Id @Column(name = "Id") @GeneratedValue(strategy = GenerationType.AUTO) protected Integer id; @Column(name = "uid", nullable = false, updatable = false, unique = true) private String uid; // ... other columns…
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/37918839
score: 0
tagged with: sql-server-2008
has comment: http://stackoverflow.com/comment/37951778
has comment: http://stackoverflow.com/comment/37938201
has title: Hibernate with SqlServer performance drop on select

http://stackoverflow.com/q/24518386
has answer: http://stackoverflow.com/a/24518729
tagged with: cdi
has answer: http://stackoverflow.com/a/24547466
score: 0
tagged with: java-ee-6
accepted answer: http://stackoverflow.com/a/24518729
type: Question
type: AnsweredQuestion
tagged with: java
has body: I'm currently looking at building a new application without using Spring, rather I'm trying to do all of my injection using CDI. I have a DAO that looks like the following: @TransactionManagement(TransactionManagementType.CONTAINER) public class TestDao { @PersistenceUnit(unitName="DefaultPersistenceUnit") private EntityManagerFactory emf; @PersistenceContext(unitName="DefaultPersistenceUnit") private EntityManager em; @TransactionAttribute(TransactionAttributeType.MANDATORY) public void test ( ) { System.err.println ("EMF == " + emf); System.err.println ("EM == " + em); } } When I run the test method, I see the following: EMF == org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory@1e3b8c4 EM == null So its fairly obvious that my EntityManager is not getting loaded by CDI. It seems like it should, but no joy. I've tried hosting on both TomEE and WebSphere Liberty profile, but the effect is the same in both cases. Can someone point me in the right direction? I'm stumped... Thanks...
answer count: 2
tagged with: jpa
has title: How do I get @PersistenceContext to load my EntityManager in CDI?
possible better answer: http://stackoverflow.com/a/24547466

http://stackoverflow.com/a/24567990
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38055930
upvote count: 3
has comment: http://stackoverflow.com/comment/38057195
has comment: http://stackoverflow.com/comment/38056170
score: 3
accepted answer of: http://stackoverflow.com/q/24567941
has body: To use the new keyword you must supply a class (i.e. new MyClass()). You could use reflection for this... but wouldn't it be much simpler to just have a common superclass (or interface) for CustomPlayer and CurrentPlayer? For example, suppose both CustomPlayer and CurrentPlayer have the playOne() and playTwo() methods. You could then define: public interface Player { void playOne(); void playTwo(); } public class CurrentPlayer implements Player { @Override public void playOne() { // code } @Override public void playTwo() { // code } } private class CustomPlayer implements Player { @Override public void playOne() { // code } @Override public void playTwo() { // code } } public class Notifier { Player mPlayer; } And then assign mPlayer with new CurrentPlayer() or new CustomPlayer() You can then call any methods on the interface.
answers question: http://stackoverflow.com/q/24567941

http://stackoverflow.com/comment/37906454
type: QuestionComment
comment on: http://stackoverflow.com/q/24482259
has text: @eis I work just with eclipse.
score: 0
type: Comment

http://stackoverflow.com/comment/37816786
type: AnswerComment
type: Comment
has text: The problem is fixed now. As you can see in the comments under the original post, the problem was in my add function. Thank you so much for your help!
comment on: http://stackoverflow.com/a/24438908
score: 0

http://stackoverflow.com/comment/38039805
score: 0
comment on: http://stackoverflow.com/q/24560138
type: Comment
type: QuestionComment
has text: Yeah,I agree with @Insertusernamehere,what an alias...

http://stackoverflow.com/comment/37941706
has text: Don't user-specific settings override the environment variables? Did you set anything in your .bashrc (or what the file is called in Ubuntu)?
comment on: http://stackoverflow.com/q/24507445
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37840689
type: Comment
comment on: http://stackoverflow.com/a/24449911
score: 0
type: AnswerComment
has text: @m0skit0: Nitpicking: Your question was why the compiler *does* warns about a resource leak. My answer does answer that: The compiler cannot look into the function. The question why it does *not* warn was not your main question ;).

http://stackoverflow.com/q/24484579
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: hibernate
type: Question
tagged with: criteria
has title: How to update table column with existing value using criteria?
tagged with: sql-update
answer count: 1
has answer: http://stackoverflow.com/a/24485910
has body: I am using DB2. I want to lock the table using Select for Update. But anyhow my DB is not locking the query using Select for Update. I am required to through update query on the selected row to update the same. Following will be my HQL query for the same: query.append("UPDATE IfmsFundMst set finyearId = finyearId "); Query existingQuery = this.getSession().createQuery(query.toString()); int result = existingQuery.executeUpdate(); Now the problem is, I want to set UPGRADE_NOWAIT lock mode using criteria. So, I am required to update the same row with existing value using criteria. Please suggest some way to do this.

http://stackoverflow.com/a/24451474
type: Answer
has body: Well all network operations in android requires to be performed in a separate thread and AsyncTask is a class that allows you to perform threading in an elegant manner(painless threading). Heres an example of asynctask: public class SendRequestAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); //runs in ui thread } @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub //perform network operations here it is the background thread return null; } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); //runs in ui thread you can update the layout here } } On your onpageloading finished method you can call this asynctask like this: new SendRequestAsyncTask().execute();
has comment: http://stackoverflow.com/comment/37841881
upvote count: 1
has comment: http://stackoverflow.com/comment/37837924
has comment: http://stackoverflow.com/comment/37837985
score: 1
has comment: http://stackoverflow.com/comment/37837452
has comment: http://stackoverflow.com/comment/37838075
accepted answer of: http://stackoverflow.com/q/24451402
answers question: http://stackoverflow.com/q/24451402
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37837522

http://stackoverflow.com/q/24431005
tagged with: gwt
tagged with: adt
score: 6
answer count: 4
has comment: http://stackoverflow.com/comment/38182303
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25145418
has answer: http://stackoverflow.com/a/25124586
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/23119661
tagged with: android
has title: Google adt/gwt support for eclipse 4.4 (Luna)
has answer: http://stackoverflow.com/a/24442215
has body: Have anyone gotten the release version of eclipse 4.4 to work with adt(Android development) and/or google web toolkit(gwt). It seems like the gwt/adt plugins don't works with eclipse 4.4, so is there a secret place to download new versions or should I keep using 4.3 -( Edit: The reason I thought adt was not working was that the documentation(http://developer.android.com/sdk/installing/installing-adt.html) says that the plugin is called "ADT Plugin" which it is not.
has comment: http://stackoverflow.com/comment/37820623
accepted answer: http://stackoverflow.com/a/25124586
tagged with: java
tagged with: google-plugin-eclipse
possible better answer: http://stackoverflow.com/a/24442215
upvote count: 7
downvote count: 1
has answer: http://stackoverflow.com/a/24460400

http://stackoverflow.com/q/24468496
upvote count: 1
type: AnsweredQuestion
has body: I've been trying to parse an iCal file using ical4j but I can't seem to make it find the ical4j.properties file. From the documentation we can read that we should create a file within our classpath. So according to this question I should have done exactly that. My directory structure looks as follows: src -- main/ ----java/ ------project/ ------ical4j.properties ------main.java ----resource/ --test/ The folder named Java is indeed blue so it should be in my classpath. It also contains the properties file so I'm stuck on how to get it to find the file.
score: 1
tagged with: java
has title: ical4j.properties file IntelliJ
has answer: http://stackoverflow.com/a/24468634
type: Question
tagged with: intellij-idea
downvote count: 0
linked to: http://stackoverflow.com/q/6104551
answer count: 1
accepted answer: http://stackoverflow.com/a/24468634
tagged with: ical4j
favorite count: 0

http://stackoverflow.com/comment/132234609
type: Comment
has text: You don't need a GestureDetector to handle clicks in a RecyclerView. You just need `setOnClickListener`. Why is this the most upvoted answer???
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26196831

http://stackoverflow.com/q/24574733
type: Question
has answer: http://stackoverflow.com/a/24574846
has answer: http://stackoverflow.com/a/24574792
tagged with: android-arrayadapter
has comment: http://stackoverflow.com/comment/38066574
accepted answer: http://stackoverflow.com/a/24575333
possible better answer: http://stackoverflow.com/a/24574846
has comment: http://stackoverflow.com/comment/38066631
has comment: http://stackoverflow.com/comment/38066657
favorite count: 0
tagged with: android-asynctask
upvote count: 2
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/38066616
has answer: http://stackoverflow.com/a/24575333
has comment: http://stackoverflow.com/comment/38066646
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24574888
score: 1
tagged with: java
has body: This is my situation. I have this AsyncTask: private class Logo extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { try { // Connect to the web site Document document = Jsoup.connect(BLOG_URL).get(); // Using Elements to get the class data // Locate the src attribute for(Element img : document.select("div.col-1-1 .image img[src]")) { String ImgSrc = img.attr("src"); // Download image from URL InputStream is = new java.net.URL(ImgSrc).openStream(); //add Bitmap to an array bitmap.add(BitmapFactory.decodeStream(is)); } } catch (IOException e) { e.printStackTrace(); Log.e("ESEMPIO", "ERRORE NEL PARSING DELLE IMMAGINI"); } return null; } @Override protected void onPostExecute(Void result) { ParsingAdapterCategorie adapter = new ParsingAdapterCategorie(getActivity(), titoli, bitmap, data); lista.setAdapter(adapter); } } If I press the back button it crashes with a log error like: FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.ArrayAdapter.init(ArrayAdapter.java:310) at android.widget.ArrayAdapter.&lt;init&gt;(ArrayAdapter.java:166) This is because the activity result is null, I think. What can I do?
has answer: http://stackoverflow.com/a/24574913
downvote count: 1
has title: AsyncTask nullPointerException pressing back button

http://stackoverflow.com/a/24480484
has comment: http://stackoverflow.com/comment/37892280
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37892072
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24480466
has comment: http://stackoverflow.com/comment/37892050
answers question: http://stackoverflow.com/q/24480466
has body: You appear to have a UTF-16 encoded file. You have to determine if it is UTF-16LE or UTF-16BE. I would guess UTF-16LE first. I suggest you set the encoding to match the file and you should read it correctly. If you don't know what the encoding should be, ask the source of the file what it/they used. BTW don't use float if you can avoid it. Try double or BigDecimal instead.
score: 4
has comment: http://stackoverflow.com/comment/37893394

http://stackoverflow.com/q/24483822
favorite count: 0
has title: How to read from file in temp?
has body: i have problem, how to read file in temp and get filename ? tempFile = File.createTempFile("MyFile.txt", ".tmp" ); System.out.print("Created temporary file with name "); System.out.println(tempFile.getAbsolutePath());
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4716503
tagged with: file
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37898544
tagged with: java
has answer: http://stackoverflow.com/a/24483857
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/38003280
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24540443
score: 0
has text: @TylerOlson I couldnt find how to initialize calendar with a perviously known timestamp!

http://stackoverflow.com/comment/37939695
has text: Rohit Jain why the synchronized doesn't come into the picture? I set this run method to be synchronized
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24506341

http://stackoverflow.com/comment/37853751
has text: First you have to get each digit. Do you know how to do that? Have you looked at the `String` methods?
score: 1
comment on: http://stackoverflow.com/q/24460258
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24458257
downvote count: 0
answer count: 1
score: 4
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37891185
has title: Opencv Android: java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libopencv_java.so"
has body: UPDATES AT THE BOTTOM OF THE POST I am trying to use OpenCV face recognizers on android and while i was able to wrap the c++ code i couldn't make it work on a Intel Atom avd. I'm not 100% sure but i think the cause of the error in the title is that i miss the libopencv_java.so in the /lib/x86 project directory. Any thoughts why the lib is missing and how to get it work properly? My Android.mk looks like: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OPENCV_LIB_TYPE:=SHARED include /home/fat/Scaricati/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk LOCAL_MODULE := FaceDetectionPerformances LOCAL_SRC_FILES := FaceDetectionPerformances.cpp FILE_LIST_CPP := $(wildcard $(LOCAL_PATH)/*.cpp) # finds all cpp files OPENCV_INSTALL_MODULES:=on include $(BUILD_SHARED_LIBRARY) While my Application.mk is APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := x86 armeabi armeabi-v7a APP_PLATFORM := android-8 The ndk-build log is 18:32:16 **** Auto Build of configuration Default for project FaceDetectionPerformances **** /home/fat/android-ndk-r9d/ndk-build NDK_DEBUG=1 all Android NDK: WARNING:jni/Android.mk:FaceDetectionPerformances: non-system libraries in linker flags: -lopencv_java Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [x86] Gdbserver : [x86-4.6] libs/x86/gdbserver [x86] Gdbsetup : libs/x86/gdb.setup [armeabi] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver [armeabi] Gdbsetup : libs/armeabi/gdb.setup [armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi-v7a/gdbserver [armeabi-v7a] Gdbsetup : libs/armeabi-v7a/gdb.setup [x86] Compile++ : FaceDetectionPerformances &lt;= FaceDetectionPerformances.cpp [x86] SharedLibrary : libFaceDetectionPerformances.so [x86] Install : libFaceDetectionPerformances.so =&gt; libs/x86/libFaceDetectionPerformances.so [armeabi] Compile++…
has answer: http://stackoverflow.com/a/24487430
tagged with: opencv
type: AnsweredQuestion
tagged with: java-native-interface
tagged with: java
tagged with: android-ndk
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24487430

http://stackoverflow.com/comment/37874643
has text: @Alex Exactly. I got it. for(int i=0; i<N; i++){ boolean[] column = new boolean[N]; for(int j=0; j<N; j++){ column[i] = false; } ar[i] = column; }
comment on: http://stackoverflow.com/a/24471191
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38072910
comment on: http://stackoverflow.com/a/24537398
type: AnswerComment
score: 0
has text: Thanks! It's all good now.
type: Comment

http://stackoverflow.com/q/24474838
has answer: http://stackoverflow.com/a/25976687
upvote count: 83
has comment: http://stackoverflow.com/comment/37881180
has answer: http://stackoverflow.com/a/24474878
has comment: http://stackoverflow.com/comment/37881172
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/62474408
has comment: http://stackoverflow.com/comment/37895173
possible better answer: http://stackoverflow.com/a/24474871
has answer: http://stackoverflow.com/a/24474871
answer count: 11
has comment: http://stackoverflow.com/comment/37881212
has answer: http://stackoverflow.com/a/53519564
has comment: http://stackoverflow.com/comment/37881215
has body: Sometimes I want to perform a set of operations on a stream, and then process the resulting stream two different ways with other operations. Can I do this without having to specify the common initial operations twice? For example, I am hoping a dup() method such as the following exists: Stream [] desired_streams = IntStream.range(1, 100).filter(n -&gt; n % 2 == 0).dup(); Stream stream14 = desired_streams[0].filter(n -&gt; n % 7 == 0); // multiples of 14 Stream stream10 = desired_streams[1].filter(n -&gt; n % 5 == 0); // multiples of 10
score: 82
has answer: http://stackoverflow.com/a/24481672
has comment: http://stackoverflow.com/comment/37893756
favorite count: 0
has answer: http://stackoverflow.com/a/73936705
has answer: http://stackoverflow.com/a/37751103
has answer: http://stackoverflow.com/a/67510307
tagged with: java-8
has comment: http://stackoverflow.com/comment/37889713
has answer: http://stackoverflow.com/a/66780730
type: AnsweredQuestion
tagged with: java-stream
has title: Can I duplicate a Stream in Java 8?
has comment: http://stackoverflow.com/comment/37894382
has answer: http://stackoverflow.com/a/24474874
tagged with: java
accepted answer: http://stackoverflow.com/a/24481672

http://stackoverflow.com/a/24472350
has body: Put import packagename.classname; (note: you don't have to put the import if they're in the same package) at the top of the class you want to access the method in and create a reference. Example: methodClass.java: package net.snugglesstuff.methods; public class methodClass() { public void sayHi() { System.out.println("Hi"); } } useMethodClass.java: package net.snugglesstuff.run; import net.snugglesstuff.methods.methodClass; public class useMethodClass() { private static methodClass mc = new methodClass(); public static void main(String[] args) { mc.sayHi(); } } The main class should be net.snugglesstuff.run.useMethodClass. The result should be (updated, does work) "Hi".
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24472237

http://stackoverflow.com/comment/38072882
type: Comment
score: 1
has text: I got this to work, except that manipulating the join table directly like this is not thread safe; given that it does not modify the `@Version` field of the Contract entity, any other thread that already has a Contract entity loaded will not know that the data is stale. And to manually update the version field and persist the Contract will just overwrite my changes to the join table. So the only way I can think of is to use a raw sql to update the version field so persisting an existing Contract object would fail. Is there a better way?
type: AnswerComment
comment on: http://stackoverflow.com/a/24570357

http://stackoverflow.com/a/24442046
score: 1
has body: Using your variables, you can have set = rs.next(); Alsi in SQL part you can have SELECT 1 ... which will work a tad faster.
upvote count: 1
has comment: http://stackoverflow.com/comment/37820433
answers question: http://stackoverflow.com/q/24441944
type: Answer
has comment: http://stackoverflow.com/comment/37820458
downvote count: 0

http://stackoverflow.com/q/24557584
has title: Java - remove useless words from text file
accepted answer: http://stackoverflow.com/a/24557765
answer count: 2
downvote count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24557811
has answer: http://stackoverflow.com/a/24557765
favorite count: 0
has body: I have to write a java program that reads a text file line by line and removes the "useless" words like "I," "you," "he," "she," "on," "in," ... and so on, keeping all others for a sort of sentiment analysis. As there are a lot, does a dictionary exist of words like those, or do I need to write one by myself?
has comment: http://stackoverflow.com/comment/38034810
tagged with: text
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24557811
type: Question
tagged with: java
score: -1

http://stackoverflow.com/comment/37896960
comment on: http://stackoverflow.com/q/24481796
type: Comment
type: QuestionComment
has text: Hrmm, it's been a while since I've used Java...my thought was to declare the method as `public void write(String string, DebugStream stream)`.
score: 0

http://stackoverflow.com/q/24525970
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37975698
downvote count: 3
type: UnansweredQuestion
score: -3
has title: Parsing text file in java - Error
tagged with: parsing
upvote count: 0
linked to: http://stackoverflow.com/q/17499455
has answer: http://stackoverflow.com/a/24526206
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37975735
has answer: http://stackoverflow.com/a/24526087
answer count: 2
has body: I am trying to remove errors in the following code. package in.citydoor.imports.catalog.tools; import java.io.IOException; import java.lang.reflect.Array; import java.util.ArrayList; public class Main { /** * @param args */ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String file_name="C:/aman/textfile.txt"; try { CatFeedWriterToMemory obj = new CatFeedWriterToMemory(file_name); String[] arryLines = obj.ReadFile(); /* * int i; * for(i=0;i&lt;arryLines.length;i++){ * System.out.println(arryLines[i]); * } */ } catch(IOException e) { System.out.println(e.getMessage()); System.out.println("Keep file on specified path"); } } } package in.citydoor.imports.catalog.tools; import java.util.ArrayList; public class CatFeedBean { ArrayList&lt;ProductVo&gt; parsedList = new ArrayList&lt;ProductVo&gt;(); ArrayList&lt;PriceVo&gt; priceList = new ArrayList&lt;PriceVo&gt;(); ArrayList&lt;SkuVo&gt; SkuList = new ArrayList&lt;SkuVo&gt;(); **String[] columns = arryLines.split("/");** String productid = columns[0]; String productname = columns[1]; String skuid = columns[2]; String price = columns[3]; ProductVo productObj = new ProductVo(productid,productname); **parsedList.add(productObj);** SkuVo skuObj = new SkuVo(skuid); // SkuList.add(skuObj); PriceVo priceObj = new PriceVo(price); // priceList.add(priceObj); } package in.citydoor.imports.catalog.tools; public class ProductVo { private String product_id; private String product_name; public ProductVo(String i, String n) { product_id = i; product_name = n; } public String getProductId() { return this.product_id; } public void setProductId(String product_id) { this.product_id = product_id; } public String getProductName() { return this.product_name; } public void setProductname(String product_name){ this.product_name = product_name; } } 1) For the line String[] columns = arryLines.split("/"); in main class, I am getting error "arryLines cannot be resolved". 2). For line parsedList.add(p…
favorite count: 0

http://stackoverflow.com/q/24568282
has title: Check whether the job is running or not?
linked to: http://stackoverflow.com/q/24282441
tagged with: cron
tagged with: job-scheduling
type: UnansweredQuestion
tagged with: quartz-scheduler
has body: I want to check whether Quartz job is running or not.I found that it can be used using scheduler.getCurrentlyExecutingJobs(). BuI'm confused with that and where exactly should I put it to get the results? Thanks try { // specify the job' s details.. JobDetail job = JobBuilder.newJob(TestJob.class) .withIdentity("testJob") .build(); // specify the running period of the job Trigger trigger = TriggerBuilder.newTrigger() .withSchedule( SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(10) .repeatForever()) .build(); //schedule the job SchedulerFactory schFactory = new StdSchedulerFactory(); Scheduler sch = schFactory.getScheduler(); sch.start(); sch.scheduleJob(job, trigger); System.out.println("******* " + sch.getCurrentlyExecutingJobs()); } catch (SchedulerException e) { e.printStackTrace(); }
has answer: http://stackoverflow.com/a/24569130
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/38006629
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24539420
has text: That's a good point. The reference type doesn't mean anything here because the compiler rewrites `setData(Object)`. I have run a `javap -c` to confirm it. Thank you.

http://stackoverflow.com/a/24551486
type: Answer
has body: It looks like your changes does not reflect when accessing you app in the server. It is most probably compiling but not getting published to the server. There is a setting in your server config, open it up and in Overview tab > Publishing section, make sure the chosen setting is "Automatically publish when resource change". Every save then not only compiles your code but also deploys the class file to your server. Here is some typical way to config "auto publish" for servers in eclipse-based IDEs. (Note: sorry can only do links to screenshots!) Tomcat 7 server config screenshot Jboss EAP 6.1 server config screenshot
answers question: http://stackoverflow.com/q/24551357
score: 0
has comment: http://stackoverflow.com/comment/38030969
has comment: http://stackoverflow.com/comment/38023561

http://stackoverflow.com/q/24487988
has body: How do I achieve Cross browser testing using Selenium with any BDD tool which can coded in Java. My actual requirement is to use Selenium (code in Java) and use any mature BDD tool achieve cross browser testing. I have heard the Cucumber-JVM &amp; Jbehave commonly used BDD tools for Java. However, I also hear that Cucumber-JVM does not support multi-threading concept and therefore cross browser execution cannot be achieved.
favorite count: 0
tagged with: cucumber-jvm
has answer: http://stackoverflow.com/a/24549920
tagged with: selenium-webdriver
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24615924
linked to: http://stackoverflow.com/q/24252800
downvote count: 1
type: Question
score: 1
tagged with: java
has title: BDD Automation with Cross Browser Testing?
answer count: 2

http://stackoverflow.com/comment/37951172
has text: @Andrew_CS I added more information to my original question. Path has already been set
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24512412

http://stackoverflow.com/comment/37956658
score: 0
type: AnswerComment
has text: Should I be using the benchmarks batchSize feature to turn the granularity into noise? Is that a valid use case for that feature? In the jmh samples it is used for: "Sometimes you need to evaluate operation which doesn't have the steady state. The cost of a benchmarked operation may significantly vary from invocation to invocation."
type: Comment
comment on: http://stackoverflow.com/a/24503960

http://stackoverflow.com/a/24528173
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37980233
upvote count: 2
has comment: http://stackoverflow.com/comment/37980186
type: Answer
has comment: http://stackoverflow.com/comment/37980315
score: 2
accepted answer of: http://stackoverflow.com/q/24527883
has comment: http://stackoverflow.com/comment/37980032
has comment: http://stackoverflow.com/comment/37979883
has comment: http://stackoverflow.com/comment/37982194
answers question: http://stackoverflow.com/q/24527883
has body: You're using backticks ` instead of quotes ' to wrap your values. Backticks are only used to wrap column names. Statement.execute("INSERT INTO PS2 (`uuid` , team, kills , deaths , rank_lvl, rank_name, pts) " + "VALUES" + " ('" + name.toString() + "' , 'none' , 0 , 0 , 1 , 'Starter' , 0)"); As mention by Caweren, you should be careful of SQL reserved keywords. UUID could be one of them (with an Oracle V9i database, for example), so you should wrap it with backticks.
has comment: http://stackoverflow.com/comment/37981986
has comment: http://stackoverflow.com/comment/37982461

http://stackoverflow.com/comment/37896097
type: AnswerComment
has text: "Really concerned with the question" is **not** a reason to do someone's work for them. It's their responsibility to do their work, regardless of how concerned they are. Yes, I read his comments, and yes, his question has code. It does not mean you should provide code for him to copy/paste. It's a nice intention you have, though.
type: Comment
comment on: http://stackoverflow.com/a/24480767
score: 0

http://stackoverflow.com/comment/38085612
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24584710
has text: I'd rather power through it for now :). That way I can really understand what makes this tick. I don't like it when the IDE does all the work.

http://stackoverflow.com/comment/38009269
score: 0
type: QuestionComment
type: Comment
has text: What is the error you are getting?
comment on: http://stackoverflow.com/q/24543539

http://stackoverflow.com/a/77396757
answers question: http://stackoverflow.com/q/24487805
score: 0
type: Answer
has body: My impression is that when answering this question there are typically two topics mixed up: 1) whether to use a lambda expression or a method reference when all the operation does is call a method and 2) whether to reduce the logic inside a lambda expression by using multiple or just one method. The main argument of the accepted answer by Brian seems to fall into that very trap. Yes, it is often a case-by-case decision whether to reduce a lambda expression that holds some logic by extracting that logic into a speaking name. For this decision there are imho some guidelines one can apply, like a) the more complex the logic and b) the more reusable the logic the more this indicates it should be a method. However, the other question whether to write a method call like this user-&gt;user.getId() or like this User::getId. And this is the one that IntelliJ will try to force towards the latter approach. But for both decisions, there isn't a clearly better format. While in the example above the method reference seems more succinct in expressing the main meaning of the function, consider this: Stream.of(doggoA,doggoB).foreach(dog -&gt; dog.barkLoudly()) vs Stream.of(doggoA,doggoB).foreach(BigMouthedDogBreed::barkLoudly) In the flow of a lambda expression you typically don't care about the exact type of an object you rather need enough information to derive the type and the primary piece of information what happens next in the flow, the method name is the most crucial bit of information in that expression. The class name just distracts from that in many such cases. In a case like this, for instance, userWallets.stream() .map(w -&gt; w.getPremiumCurrency()) .foreach(currency -&gt; print(currency) vs userWallets.stream() .map(UserCurrencyWallet::getPremiumCurrency) .foreach(UserCurrencyHandler::print) the type of the collection is likely clear when you reach the code and if not the name would make it clear enough. We typically would be trying to understand to conversion that goe…

http://stackoverflow.com/comment/37885206
comment on: http://stackoverflow.com/q/24476878
type: Comment
type: QuestionComment
score: 0
has text: @ben75 if a device has a little wider screen, the image is little squized in the height - because it has more wider surface

http://stackoverflow.com/comment/37976714
score: 1
comment on: http://stackoverflow.com/a/24508853
type: AnswerComment
has text: (1) The full XML you've pulled from the form contains the template, the data description, maybe the datasets, javascript and more. You can use it if you want to change the form (and if you know the XFA syntax, because iText won't help you here; it's a matter of XML manipulation).
type: Comment

http://stackoverflow.com/comment/38071068
comment on: http://stackoverflow.com/q/24576793
type: QuestionComment
type: Comment
score: 0
has text: @JonSkeet It seems not to work either, I still get different instances. I have one JVM and I want one instance of this class

http://stackoverflow.com/q/24464915
tagged with: android-edittext
accepted answer: http://stackoverflow.com/a/24466625
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24465158
has answer: http://stackoverflow.com/a/24465158
tagged with: java
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/34083133
has title: How correct add EditText to Fragment programmatically?
has comment: http://stackoverflow.com/comment/37862860
upvote count: 0
has answer: http://stackoverflow.com/a/24466625
favorite count: 0
answer count: 3
tagged with: android
type: AnsweredQuestion
has body: This is My Java code: View RV2 = inflater.inflate(R.layout.fragment__dummy,container, false); LinearLayout LL = (LinearLayout) RV2 .findViewById(R.id.section_label); EditText ET = new EditText(getActiity()); ET.setText("LOL"); ET.setId(5); ET.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); LL.addView(ET); return RV; Thus not lit red line, the application is stopped, when I run. Thank You!

http://stackoverflow.com/comment/39092781
has text: Are you using JavaEE standard persistence? Does your application deployment contains it's own copy of Hibernate? Are you using the JTA transaction manager in the Hibernate configuration? How is transaction demarcation managed? Are you using (possibly stateless) session beans for this purpose?
type: Comment
comment on: http://stackoverflow.com/q/24485365
type: QuestionComment
score: 1

http://stackoverflow.com/a/24515392
downvote count: 0
answers question: http://stackoverflow.com/q/24515275
has comment: http://stackoverflow.com/comment/37960915
has comment: http://stackoverflow.com/comment/37959300
has comment: http://stackoverflow.com/comment/37976876
score: 1
has comment: http://stackoverflow.com/comment/37961166
has body: What about using a CursorAdapter? And a SimpleCursorAdapter? Standard constructor. Parameters context The context where the ListView associated with this SimpleListItemFactory is running layout resource identifier of a layout file that defines the views for this list item. The layout file should include at least those named views defined in "to" c The database cursor. Can be null if the cursor is not available yet. from A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. to The views that should display column in the "from" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the from parameter. Can be null if the cursor is not available yet. flags Flags used to determine the behavior of the adapter, as per CursorAdapter(Context, Cursor, int). ListView listView = (ListView) findViewById(...); listView.setAdapter(new SimpleCursorAdapter( this, // The context R.layout.layoutToShow, // The layout of the row to show dbOpen.getUnits(), // Here the cursor where the data is, i used .getUnits() // but it can be anything new String[] { tables to show }, // here the tables to show new int[] { where to put data? }, // here where to show? the IDs // of the layout elements where put data. 0 ); Check out SimpleCursorAdapter for more info, or more general class which gives to you more options if you need CursorAdapter
upvote count: 1
has comment: http://stackoverflow.com/comment/37959331
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38108578
has comment: http://stackoverflow.com/comment/37968885
has comment: http://stackoverflow.com/comment/37970110
has comment: http://stackoverflow.com/comment/37960317
type: Answer
has comment: http://stackoverflow.com/comment/37960489
accepted answer of: http://stackoverflow.com/q/24515275

http://stackoverflow.com/q/24529471
downvote count: 0
favorite count: 0
tagged with: jeditorpane
type: UnansweredQuestion
tagged with: swing
has body: I am trying to render follwing code in JEditor Which is working fine in chrome and Mozile browser but not in EditorPane. In the given figure, ABCD is a quadrilateral in which BD = 10 cm, AL ^ BD, CM ^ BD such that AL = 4 cm and CM = 6 cm. Find the area of quadrilateral ABCD. <IMG align=middle Relacing tags with Unicode working fine but i want to display it using Tags.
has title: Issue with Rendering Math symbol in JEditorPane
has comment: http://stackoverflow.com/comment/37986455
tagged with: fonts
tagged with: java
has comment: http://stackoverflow.com/comment/38018872
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/53419763
linked to: http://stackoverflow.com/q/13250061
score: 4
tagged with: http://stackoverflow.com/tag/html
answer count: 1

http://stackoverflow.com/q/24452893
has answer: http://stackoverflow.com/a/24453036
accepted answer: http://stackoverflow.com/a/24453036
has title: Java- how do I make the cells in a JTable editable?
linked to: http://stackoverflow.com/q/12776021
tagged with: jtable
score: 0
answer count: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/24453061
possible better answer: http://stackoverflow.com/a/24453061
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37840064
has body: I have a JTable displayed in my GUI- currently, when the program loads, the table is completely empty- showing only the column headings (there isn't even an empty table there). I have a button which, when clicked, will add a new empty row to the table, underneath the column headings. However, although I can select each of the individual cells added to the table, I cannot type anything into them. I am adding the row to the table using the following code: /*Create the button, and add an ActionListener to it */ JButton addBtn = new JButton("Add"); addBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ } }); public void actionPerformed(ActionEvent arg0){ System.out.println("Add button pressed. "); DefaultTableModel model = (DefaultTableModel)jEntityFilterTable.getModel(); Object[] obj = new Object[]{}; model.addRow(obj); } This code currently works- as mentioned, whenever I click the button, a new row is added to the table, and I can select each individual cell. What do I need to do to make the selected cell editable? I have another button ('Edit'), which I want the user to be able to click when they have selected a cell from the table, and once they have clicked it, they should be able to type data into the cell. But I'm not sure how to do this, and couldn't find anything online about how to add this functionality to a button in the GUI. Any help would be much appreciated.
type: Question

http://stackoverflow.com/q/24448723
has comment: http://stackoverflow.com/comment/37832309
score: 4
favorite count: 0
tagged with: smartfoxserver
has answer: http://stackoverflow.com/a/24448933
has body: Hey guy's am getting this error: Can you guy's possibly try to fix this? or see whats wrong post a fix or something Thanks alot guy's :) Exception in thread "ExtensionHandler-1" java.lang.NoSuchMethodE rror: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/Concu rrentHashMap$KeySetView; at aerivial.requests.aqw.GetAction.process(GetAction.java:196) at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.processEve nt(ExtensionHandler.java:535) at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.run(Extens ionHandler.java:344) at java.lang.Thread.run(Thread.java:619) The error Code: ConcurrentHashMap tgtBuffDebuffs = (ConcurrentHashMap)userTgt.properties.get(Users.BUFFS_DEBUFFS); for (Iterator i = tgtBuffDebuffs.keySet().iterator(); i.hasNext(); ) { int auraId = ((Integer)i.next()); Aura aura = (Aura)World.instance.auras.get(Integer.valueOf(auraId)); if ((aura.getDamage() &gt;= 0.0D) &amp;&amp; (!aura.getCategory().equals("d"))) { damage = (int)(damage * aura.getDamage()); } }
accepted answer: http://stackoverflow.com/a/24448933
has title: Java error java.util.concurrent.ConcurrentHashMap.keySet
upvote count: 4
downvote count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37833160
tagged with: java
has comment: http://stackoverflow.com/comment/37832402
answer count: 1

http://stackoverflow.com/comment/37878319
type: QuestionComment
has text: Have you read [How to Use the Focus Subsystem](http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html) in the Java tutorials?
comment on: http://stackoverflow.com/q/24473289
score: 0
type: Comment

http://stackoverflow.com/q/24454650
favorite count: 0
has answer: http://stackoverflow.com/a/24454780
accepted answer: http://stackoverflow.com/a/24454780
has comment: http://stackoverflow.com/comment/37845809
has body: I have this piece of code, that serialises a subclass of Map using Jackson. Without the serializer registered I get a valid json, I use the serializer to get the name to lower case. However, the produced json looks like: {:"two":"aaa":"one":"aaa"} Any idea why? How to fix? @Test public void test_serialization() throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule("JSONModule", new Version(1, 0, 0, null, null, null)); module.addSerializer(Circle.class, new CircleSerializer()); module.addKeySerializer(Circle.class, new CircleSerializer()); mapper.registerModule(module); CircleMap statistics = new CircleMap(); statistics.put(Circle.ONE, "aaa"); statistics.put(Circle.TWO, "aaa"); System.out.println(mapper.writeValueAsString(statistics)); } enum Circle { ONE, TWO } static class CircleMap extends HashMap&lt;Circle, String&gt; { } static class CircleSerializer extends JsonSerializer&lt;Circle&gt; { @Override public void serialize(Circle value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonProcessingException { gen.writeString(value.name().toLowerCase()); } }
has comment: http://stackoverflow.com/comment/37843501
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
type: Question
has title: Jackson serializer produces invalid Json for subclass of Map
tagged with: jackson
answer count: 1

http://stackoverflow.com/comment/37903189
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24485720
has text: the problem is,if you run this code on jellybean then it will be work.But for froyo you have to use support libraries or supportmapfragment

http://stackoverflow.com/comment/37905117
comment on: http://stackoverflow.com/q/24480919
score: 0
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).

xsd
tags question: http://stackoverflow.com/q/24488052
tags question: http://stackoverflow.com/q/24505374
tags question: http://stackoverflow.com/q/24551144
tags question: http://stackoverflow.com/q/24524901
tags question: http://stackoverflow.com/q/24563583
tags question: http://stackoverflow.com/q/24446846
tag name: xsd
tags question: http://stackoverflow.com/q/24458759
tags question: http://stackoverflow.com/q/24445549
type: Tag
tags question: http://stackoverflow.com/q/24564677
tags question: http://stackoverflow.com/q/24446194

http://stackoverflow.com/comment/37985097
comment on: http://stackoverflow.com/a/24531009
score: 0
type: AnswerComment
has text: Given the minimal error information provided, this looks like the most likely solution.
type: Comment

http://stackoverflow.com/a/24555089
has comment: http://stackoverflow.com/comment/38037687
type: Answer
score: 1
upvote count: 1
has body: You're going to have to create your own custom component; there isn't going to be a magical out-of-the-box solution. You do this be extending an existing component, or by creating a class that combines multiple components. In this case you might create a JPanel that holds both a JComboBox and a JPanel, and that JPanel would hold your JCheckBoxes.
downvote count: 0
answers question: http://stackoverflow.com/q/24552821

http://stackoverflow.com/comment/38082082
score: 0
type: AnswerComment
has text: @zulualph You just put it instead of `Collections.sort(employeeList);` No imports required. You could then, if you wanted, remove the Employee class's `compareTo` method and `implements Comparable`. (They wouldn't be used since the sort call is now supplying its own comparator in the call.) There are other ways to write sorts too, but the two I suggested are the simplest.
type: Comment
comment on: http://stackoverflow.com/a/24582793

http://stackoverflow.com/comment/46254560
score: 0
type: AnswerComment
has text: are you sure it will work by deleting API20 package as i am facing the same issue and i am trying to download the other API's as well
type: Comment
comment on: http://stackoverflow.com/a/24544231

http://stackoverflow.com/q/24432295
tagged with: java
has body: I use Vaadin 7. I want to save a Chart configuration and restore it later. I found an interesting thing in com.vaadin.addon.charts.model.Configuration is that you can serialize the configuration into JSON object. Code : chart.getConfiguration().toString(); Result: { "type": "column" }, "title": { "text": "Chart" }, "xAxis": { "categories": [ "f", "e" ], "axisIndex": 0 }, "yAxis": { "min": 0, "title": { "text": "Quantity" }, "axisIndex": 0 }, "tooltip": { "_fn_formatter": "this.series.name +\u0027: \u0027+ this.y +\u0027 (\u0027+ Math.round(this.percentage) +\u0027%)\u0027" }, "plotOptions": { "column": { "stacking": "normal" } }, "series": [ { "data": [ 1, 2 ], "name": "d", "visible": true } ], "exporting": { "enabled": false } } What I want now is build Configuration from that JSON object. Is there a way to that ?
tagged with: http://stackoverflow.com/tag/json
tagged with: vaadin
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24432495
favorite count: 0
tagged with: serialization
score: 1
upvote count: 1
has title: Serialization of Chart configuration in Vaadin
has answer: http://stackoverflow.com/a/24432495
type: Question
tagged with: charts
type: AnsweredQuestion

http://stackoverflow.com/q/24514272
answer count: 3
upvote count: 7
has answer: http://stackoverflow.com/a/24514409
tagged with: maven
tagged with: spring
accepted answer: http://stackoverflow.com/a/24527240
has title: Importing only a few class from a dependency
has comment: http://stackoverflow.com/comment/37957987
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37955089
downvote count: 0
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/24514678
has answer: http://stackoverflow.com/a/24527240
type: Question
has answer: http://stackoverflow.com/a/24514678
has body: I'm developing a modular web-app where I'm using maven. The skeleton of my application is the following: The skeleton of my application with the share-services module Now I want to import some classes of Service-App1 within Service-App2 but without the Service-App1 dependencies( like Module-App1, Util-App1 and the external dependencies). Summarazing, since in the App2 I have a composite persistence unit Composite Persistence Unit and I want to share some business logic between applications. For example if in App1 I have a spring service like this: public interface ContractService { void processSomethings(); } @Service public class ContractServiceImpl implements ContractService { public void processSomethings(){ //Manage some share entities } } I would want use the method processSomethings() also in App1 How can I realize this?
tagged with: maven-3
favorite count: 0

http://stackoverflow.com/a/68599706
answers question: http://stackoverflow.com/q/24545576
upvote count: 5
downvote count: 0
has body: // run this commend - its fixed everything ionic cordova plugin add cordova-plugin-androidx-adapter
type: Answer
score: 5

http://stackoverflow.com/a/24480565
accepted answer of: http://stackoverflow.com/q/24480504
type: Answer
answers question: http://stackoverflow.com/q/24480504
upvote count: 6
has comment: http://stackoverflow.com/comment/37892265
has comment: http://stackoverflow.com/comment/37892127
has body: Assuming CustomPanel extends JComponent or JPanel, make the frame visible after adding CustomPanel. Calling super.paintComponent(g) is a good idea to paint any background components. frame.setVisible(true);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37892297
score: 6
has comment: http://stackoverflow.com/comment/37892281

http://stackoverflow.com/a/24525787
has body: Declare your screen object before try block(you can initialize it in catch) and return it after catch block.
answers question: http://stackoverflow.com/q/24525727
type: Answer
score: 0

http://stackoverflow.com/comment/38025350
type: Comment
has text: Thank you. Fixed my horrible null Pointer but since I need the Array to be dynamic I couldn't set it up exactly like what you gave. I did public static String[] itemStrings = new String [] {}
comment on: http://stackoverflow.com/a/24552443
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38060951
comment on: http://stackoverflow.com/a/24570754
type: AnswerComment
score: 0
type: Comment
has text: Please explain why this will work to the question author. This does not help show them what was wrong with their original code. Add a description along with your code sample.

http://stackoverflow.com/a/24516758
has body: It's tough to tell what line 126 is without counting but a quick estimate is that it falls under your TextView setText assignment. If this is correct, then be sure that you are actually finding the text view inside your layout file correctly. If it is not this line then perhaps an update with the highlighted line in question for line 126 where the Nullpointer occurs would be helpful. This could be due to you loading a layout file you didn't mean to load or are referencing the wrong name for the TextView.
answers question: http://stackoverflow.com/q/24516423
type: Answer
score: 0

http://stackoverflow.com/q/24507567
has title: Returning list from ajax and creating a list on the jsp page
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37942174
has body: I am trying to show the user with a list of things when the page loads. when the page loads I do and AJAX call to the database and return a list of DTOs. In the controller I set the list of DTOs into the model and on the JSP page I try to access the list value through loop of JSTL. here is my code ajax --> $(document).ready(function() { $.ajax({ url : 'loadInterests', dataType : "json", type : "GET", success: function (response) { } , error: function (response) { } }); }); contoller --> @RequestMapping(value="/loadInterests", method = RequestMethod.GET) public List<InterestsDto> loadInterests( Model model1) { String Email = ((UserDetailsDto)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername(); long id = ((UserDetailsDto)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId(); System.out.println(" " +Email+ " kkk " +id); List<InterestsDto> interests = userService.loadInterests(Email ,id); System.out.println("controller out "); for(int i =0 ; i < interests.size(); i++) { System.out.println( "id == " +interests.get(i).getName()); System.out.println( "value == " +interests.get(i).getId()); } model1.addAttribute("interests", interests); return interests; } jsp --> <c:forEach var="i" begin="0" end="${interests.size()}" items="${interests}"> <c:out value="${i}"/>${i.getName()} Add </c:forEach> the code does not work. Every Time i try to load the page it throws an exception of NullPointerException type. java.io.IOException: JspException when evaluating the body Please help.
has comment: http://stackoverflow.com/comment/37942249
has comment: http://stackoverflow.com/comment/37942385
answer count: 0
has comment: http://stackoverflow.com/comment/37942100
type: Question
has comment: http://stackoverflow.com/comment/37941844
has comment: http://stackoverflow.com/comment/37942211
tagged with: java
score: 0
tagged with: jstl
has comment: http://stackoverflow.com/comment/37941924
tagged with: jsp
tagged with: jquery
tagged with: ajax

http://stackoverflow.com/comment/38023944
score: 0
type: Comment
type: QuestionComment
has text: Are you using Gradle?
comment on: http://stackoverflow.com/q/24551822

http://stackoverflow.com/comment/38071540
type: Comment
comment on: http://stackoverflow.com/a/24577216
score: 1
type: AnswerComment
has text: @emma: Really this is up to the implementation details of `soot`. If it's an Eclipse plugin that can run Java code, it's running in Eclipse's JVM, but it is probably sandboxing using a separate classloader. You should probably think of separate runs as being in separate JVMs.

http://stackoverflow.com/q/24434131
accepted answer: http://stackoverflow.com/a/24565618
has comment: http://stackoverflow.com/comment/37842210
has comment: http://stackoverflow.com/comment/37843768
tagged with: android-canvas
has answer: http://stackoverflow.com/a/58249644
score: 0
has answer: http://stackoverflow.com/a/24565618
tagged with: android
type: AnsweredQuestion
has title: cannot see path while moving finger
possible better answer: http://stackoverflow.com/a/58249644
type: Question
has body: Hey I implementing doodling functoinality in my application. While drawing a line I cannot see the line path while moving the finger. I can see the line when is up ie TouchUp, could some one help me so that I can see the line drawn while moving the finger along the path. public class DoodleImageView extends View { // drawing path private Path drawPath; // drawing point private boolean drawPoint; // drawing and canvas paint public Paint drawPaint; public Paint tempPaint; private Paint canvasPaint; // initial color private int paintColor; // canvas private Canvas drawCanvas; // canvas bitmap private Bitmap canvasBitmap; private ArrayList&lt;Path&gt; paths = new ArrayList&lt;Path&gt;(); private ArrayList&lt;Integer&gt; pathscolor = new ArrayList&lt;Integer&gt;(); private ArrayList&lt;Integer&gt; pointcolor = new ArrayList&lt;Integer&gt;(); private ArrayList&lt;Integer&gt; marker = new ArrayList&lt;Integer&gt;(); private ArrayList&lt;Point&gt; points = new ArrayList&lt;Point&gt;(); private float mX, mY; private final float TOUCH_TOLERANCE = 1; public DoodleImageView(Context context, AttributeSet attrs) { super(context, attrs); setupDrawing(); // TODO Auto-generated constructor stub } private void setupDrawing() { // get drawing area setup for interaction drawPath = new Path(); drawPaint = new Paint(); // drawPaint.setColor(paintColor); drawPaint.setAntiAlias(true); drawPaint.setStrokeWidth(20); drawPaint.setStyle(Paint.Style.STROKE); drawPaint.setStrokeJoin(Paint.Join.ROUND); drawPaint.setStrokeCap(Paint.Cap.ROUND); canvasPaint = new Paint(Paint.DITHER_FLAG); } private Paint setUpPaint(int color) { tempPaint = new Paint(); tempPaint.setColor(color); tempPaint.setAntiAlias(true); tempPaint.setStrokeWidth(20); tempPaint.setStyle(Paint.Style.STROKE); tempPaint.setStrokeJoin(Paint.Join.ROUND); tempPaint.setStrokeCap(Paint.Cap.ROUND); return tempPaint; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { // TODO Auto-generated method stub super.onSize…
has comment: http://stackoverflow.com/comment/37844923
tagged with: java
has comment: http://stackoverflow.com/comment/37841120
tagged with: android-custom-view
answer count: 2

http://stackoverflow.com/comment/41759441
has text: This will not provide any clue about which button or view (within the item) was clicked. But for overall item click, this is fine.
comment on: http://stackoverflow.com/a/26196831
type: AnswerComment
type: Comment
score: 98

http://stackoverflow.com/a/24586025
answers question: http://stackoverflow.com/q/24584594
has body: If you're reliably getting an IOException of some kind when reading locked files, merely catching it and aborting/cleaning up the copy appears to completely solve your problem. You have to do that anyway on any IOException, not just this one, so there's nothing special about this situation. InputStream.available() doesn't have anything to do with either file locks or file sizes. See the Javadoc.
has comment: http://stackoverflow.com/comment/38090767
score: 0
type: Answer

postgresql
tags question: http://stackoverflow.com/q/24570005
tags question: http://stackoverflow.com/q/24444385
tags question: http://stackoverflow.com/q/24576322
tags question: http://stackoverflow.com/q/24534286
tags question: http://stackoverflow.com/q/24504655
tags question: http://stackoverflow.com/q/24528571
tags question: http://stackoverflow.com/q/24568775
tags question: http://stackoverflow.com/q/24427798
tag name: postgresql
tags question: http://stackoverflow.com/q/24460934
tags question: http://stackoverflow.com/q/24520493
tags question: http://stackoverflow.com/q/24517120
tags question: http://stackoverflow.com/q/24465706
tags question: http://stackoverflow.com/q/24440774
type: Tag
tags question: http://stackoverflow.com/q/24506861
tags question: http://stackoverflow.com/q/24441172
tags question: http://stackoverflow.com/q/24496757
tags question: http://stackoverflow.com/q/24435275
tags question: http://stackoverflow.com/q/24553536
tags question: http://stackoverflow.com/q/24509817
tags question: http://stackoverflow.com/q/24465078
tags question: http://stackoverflow.com/q/24520280

http://stackoverflow.com/comment/37970735
comment on: http://stackoverflow.com/q/24428433
has text: 3.2.1. I tried installing a newer version of jBoss to no avail.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37862920
comment on: http://stackoverflow.com/q/24464812
type: Comment
type: QuestionComment
has text: possible duplicate of [PersistenceException, Column 'id' specified twice](http://stackoverflow.com/questions/24377478/persistenceexception-column-id-specified-twice)
score: 1

http://stackoverflow.com/comment/37979198
type: Comment
has text: Are ` backticks correct as string quotes? Try `'`
comment on: http://stackoverflow.com/q/24527883
score: 0
type: QuestionComment

http://stackoverflow.com/a/24429488
score: 0
answers question: http://stackoverflow.com/q/24429011
type: Answer
has body: Given that jsch throws exceptions when an error occurs, why don't you just implement your own counter (just an int would work)?

http://stackoverflow.com/comment/37875240
has text: then what should i do to save the the bill data n map it to the customer id
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24471562
score: 0

http://stackoverflow.com/comment/38166254
comment on: http://stackoverflow.com/a/24626349
score: 0
type: AnswerComment
has text: my mistake, it's `i<=total`
type: Comment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24500581
tags question: http://stackoverflow.com/q/24447229
tags question: http://stackoverflow.com/q/24516880
tags question: http://stackoverflow.com/q/24469636
tag name: android-actionbar
tags question: http://stackoverflow.com/q/24479110

http://stackoverflow.com/comment/37810902
comment on: http://stackoverflow.com/a/24436630
type: Comment
has text: @user3780342 Edited. I missed a defect.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37907503
comment on: http://stackoverflow.com/a/24480767
score: 0
has text: Also, This doesnt work, I'm getting issues like it calling the months, Month 81 and month 41.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24520421
type: Question
tagged with: object
accepted answer: http://stackoverflow.com/a/24520439
has title: Java class instance from type Object can only call methods of type Object
score: 0
has answer: http://stackoverflow.com/a/24520439
answer count: 1
has comment: http://stackoverflow.com/comment/37965599
has comment: http://stackoverflow.com/comment/37965489
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37965780
tagged with: dynamic
tagged with: java
has comment: http://stackoverflow.com/comment/37965825
has comment: http://stackoverflow.com/comment/37965520
has body: I implemented the code from this tutorial http://www.javablogging.com/dynamic-in-memory-compilation/comment-page-1/#comment-65105 which in a nut shell is dynamically creating a class and only saving it to memory (versus writing to a file with extension .java and compiling that file with extension .class). At the end of his main he instantiates the class with Object instance = fileManager.getClassLoader(null) .loadClass(fullName).newInstance(); System.out.println(instance); And in the file we create we defined the toString method so when we print out instance the class name is printed. But when I add methods to the class and try to call them I get the error method is undefined for type object. I know that in normal circumstances I would need to use Object like Object obj = new Foo(); and then I could call Foo's members but with the code I showed above I cannot stick new in front of fileManager...newInstance(); Conclusion: How can I create an instance of the DynaClass (the dynamically created class) from the tutorial and call its members. UPDATE: I'm not sure if it's possible to cast the object because we are creating the class dynamically and everything is in strings. As far as I know you cannot cast something with a string name.

http://stackoverflow.com/comment/38133197
score: 0
has text: Yep. My task is trying to write task queue or something like that.
type: Comment
comment on: http://stackoverflow.com/a/24571263
type: AnswerComment

http://stackoverflow.com/a/24460269
downvote count: 0
has comment: http://stackoverflow.com/comment/37854384
score: 3
has body: You should try String fromdate = "Jun/2014"; SimpleDateFormat format = new SimpleDateFormat("MMM/yyyy"); Date date = null; try { date = format.parse(fromdate); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(date); Your result : Sun Jun 01 00:00:00 ECT 2014
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24460103
has comment: http://stackoverflow.com/comment/37854132

http://stackoverflow.com/comment/38067724
type: AnswerComment
has text: Why not? You'd just do the right thing and refactor the code.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24575207

http://stackoverflow.com/a/24446124
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: http://java-sl.com/wrap.html See the link above. In short your view's minimum span should be equal preferred span then no wrap is used. To use space based wrap you should define break weights properly. UPDATE http://java-sl.com/tip_letter_wrap_java7.html the link shows difference in wrapping for Java 7 and how it could be fixed.
answers question: http://stackoverflow.com/q/24446042

http://stackoverflow.com/q/24588056
downvote count: 0
tagged with: dependencies
upvote count: 11
accepted answer: http://stackoverflow.com/a/24588231
favorite count: 0
type: Question
has body: I am trying to implement a unit test of a method in a Spring MVC controller as follows: @Test public void testGetProfile() { Person mockPerson = new Person(); mockPerson.setPersonId(1); mockPerson.setName("Mr Brown"); mockPerson.setAddress("Somewhere"); mockPerson.setTelephone("1234567890"); mockPerson.setEmail("brown@brown.com"); when(mockPersonService.get(1)).thenReturn(mockPerson); try { mockMvc.perform(get("/person/profile?personId=1")) .andExpect(status().isOk()) .andExpect(view().name("view/profile")) .andExpect(forwardedUrl("/WEB-INF/jsp/view/profile.jsp")) .andExpect(model().attribute("person", hasSize(1L))) .andExpect(model().attribute("person", hasItem( allOf( hasProperty("personId", is(1L)), hasProperty("name", is("Mr Brown")), hasProperty("address", is("Somewhere")), hasProperty("telephone", is("1234567890")), hasProperty("email", is("brown@brown.com")), ) ))); } catch(Exception e) { Misc.printStackTrace(e); } verify(mockPersonService, times(1)).get(1); verifyNoMoreInteractions(mockPersonService); } But I get messages about dependencies concerning hasSize(long) and hasProperty(...). I have recent versions of Mockito, HamCrest et al in the application's class path. So what am I missing? My current imports are: import library.model.Person; import library.service.PersonService; import library.util.Misc; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import static org.hamcrest.CoreMatchers.*; import static org.junit.matchers.JUnitMatchers.hasItem; import static org.mockito.Mockito.*; impor…
tagged with: spring
has answer: http://stackoverflow.com/a/24588231
tagged with: spring-mvc
has title: Missing dependencies hasSize() and hasProperty() when implementing unit test of Spring controller
tagged with: java
has comment: http://stackoverflow.com/comment/38091418
has comment: http://stackoverflow.com/comment/38091377
answer count: 1
tagged with: unit-testing
score: 11
has comment: http://stackoverflow.com/comment/38091439
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38091479

http://stackoverflow.com/q/24558549
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/38036613
has answer: http://stackoverflow.com/a/24558795
has comment: http://stackoverflow.com/comment/38038009
tagged with: java
has comment: http://stackoverflow.com/comment/38037285
type: Question
tagged with: boolean
downvote count: 4
upvote count: 0
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/38036792
has title: Boolean results to string value
favorite count: 0
has body: I need to create a coin tossing java application. Ok it must have an instance variable boolean. and when it's true, the side of the coin will heads. if false, then tails. how do I go about it? then after that, head will be = 1 while tails will be 0. the purpose is to be able to count the number of times each side has. Thanks! import java.lang.Math; class Coin { boolean coinSide; Coin() { coinSide = true; } getCoinside() { if(num = 1) { } } public static void main(String [] args) { int num = (int)(Math.random() *2); //returns an integer System.out.println(num); } } Ok I think i better put the requirements document over here so everyone can understand. cheers (a) Design, write and test class that will represent a coin, with a method to toss the coin. A coin has an instance variable that indicates whether a result was heads or tails. What type should this instance variable be? The constructor for a coin should initialise the face of the coin to heads. The constructor has no parameters. The coin has two methods: • A method to return the result of the toss (i.e. returns the instance variable indicating heads or tails). • A method to toss the coin The method to toss the coin requires a random number, either 0 or 1. We can get a random number using a method of the Math class. Math.random() returns a double value between 0 and 1. To convert this value to an integer, either 0 or 1, the following code is used int num = (int)(Math.random() *2); //returns an integer (b) When you have written your coin class, write a test class, with a main method, which will create a Coin object, and toss it. Each time it is tossed, print out the result (heads or tails). (c) Now alter the main method to toss the coin 100 times, and count the number of times the coin toss results in heads and the number of time it result in tails. You will need a loop for this, iterating 100 times. Display the heads count and tails count.

http://stackoverflow.com/comment/38069556
comment on: http://stackoverflow.com/a/24576084
has text: Care to explain why #2 is an advantage?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24571705
has comment: http://stackoverflow.com/comment/38061300
tagged with: spring
has comment: http://stackoverflow.com/comment/38062722
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38061998
tagged with: java
has title: Remove dependency on Jackson
has comment: http://stackoverflow.com/comment/38063230
type: Question
has comment: http://stackoverflow.com/comment/38062232
has body: In Spring-MVC you have the ability to remove the Jackson library as a dependency and replace it with your own using this method: protected void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) I am trying to do the same thing for Spring-Websocket so I have overridden both of these methods: @Bean public CompositeMessageConverter brokerMessageConverter() protected boolean configureMessageConverters(List&lt;MessageConverter&gt; messageConverters) However there is still a dependency on Jackson somewhere and I can't figure out where. EDIT Here is a stack trace: Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException at org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService.getDefaultTransportHandlers(DefaultSockJsService.java:81) at org.springframework.web.socket.sockjs.transport.handler.DefaultSockJsService.&lt;init&gt;(DefaultSockJsService.java:74) at org.springframework.web.socket.config.annotation.SockJsServiceRegistration.createSockJsService(SockJsServiceRegistration.java:231) at org.springframework.web.socket.config.annotation.SockJsServiceRegistration.getSockJsService(SockJsServiceRegistration.java:198) at org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration$StompSockJsServiceRegistration.getSockJsService(WebMvcStompWebSocketEndpointRegistration.java:113) at org.springframework.web.socket.config.annotation.WebMvcStompWebSocketEndpointRegistration.getMappings(WebMvcStompWebSocketEndpointRegistration.java:87) at org.springframework.web.socket.config.annotation.WebMvcStompEndpointRegistry.getHandlerMapping(WebMvcStompEndpointRegistry.java:122) at org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHandlerMapping(WebSocketMessageBrokerConfigurationSupport.java:60) at com.test.wsb.config.WebsocketConfig$$EnhancerBySpringCGLIB$$b414d315.CGLIB$stompWebSocketHandlerMapping$4(&lt;generated&gt…
tagged with: spring-websocket
has comment: http://stackoverflow.com/comment/38142487
has answer: http://stackoverflow.com/a/24614572
has comment: http://stackoverflow.com/comment/38062817
has comment: http://stackoverflow.com/comment/38062392
score: 0
accepted answer: http://stackoverflow.com/a/24614572
has comment: http://stackoverflow.com/comment/38063370
answer count: 1
has comment: http://stackoverflow.com/comment/38062356
has comment: http://stackoverflow.com/comment/38062947

http://stackoverflow.com/q/24456057
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37846700
upvote count: 5
tagged with: java
tagged with: unit-testing
linked to: http://stackoverflow.com/q/34571
type: Question
score: 5
has body: If a private static final value X from a class is needed in a unit test (in a separate package), how should one go about obtaining X? I can think of three options, none of which seems clean to me: 1) Copy X into the test class. I fear that if the source's X is changed, while the test's X is preserved, the unit test would still pass when it should fail. 2) Make X public. I fear this breaks encapsulation. Nonetheless, this is in my opinion the best option given that X is final. 3) Create a public getter for X. This also seems like it's breaking encapsulation if X should only be accessed from the class and unit test.
has comment: http://stackoverflow.com/comment/37846422
has comment: http://stackoverflow.com/comment/37846589
has answer: http://stackoverflow.com/a/24456787
downvote count: 0
tagged with: encapsulation
has comment: http://stackoverflow.com/comment/37852908
has answer: http://stackoverflow.com/a/24457458
answer count: 3
has comment: http://stackoverflow.com/comment/37846756
favorite count: 0
possible better answer: http://stackoverflow.com/a/24456471
accepted answer: http://stackoverflow.com/a/24456787
has comment: http://stackoverflow.com/comment/37846345
has answer: http://stackoverflow.com/a/24456471
has title: Best practices for accessing private static final values in unit tests

http://stackoverflow.com/comment/37940506
type: QuestionComment
comment on: http://stackoverflow.com/q/24506774
has text: Post the code also and point out line no 35
score: 0
type: Comment

http://stackoverflow.com/comment/37969279
type: Comment
comment on: http://stackoverflow.com/a/24522402
score: 2
type: AnswerComment
has text: Introducing a Spring dependency seems like overkill just to run a thread.

http://stackoverflow.com/q/24443130
has comment: http://stackoverflow.com/comment/37822420
score: 0
answer count: 1
favorite count: 0
has title: have number input correlate to string using substring?
accepted answer: http://stackoverflow.com/a/24443628
has comment: http://stackoverflow.com/comment/37822426
type: AnsweredQuestion
upvote count: 2
downvote count: 2
type: Question
has body: I have to write a program following these guidelines. I have no Idea what I am doing. I have tried working through it, but can't seem to figure out how to get the input to correlate to the substring. Write a program that transforms 1,2,3...12 into the corresponding month January, February... Make a very long string "January February March... " in which you add spaces such that each month name has the same length. Then use substring to extract the month you want. Can someone please give me some guidance on this? We haven't worked with arrays or if statements yet, so I don't believe I should be using any of that either. – Ok here is what I have so far. public class MonthIdentifier { private String monthNames = "January February March April May June July August September October November December "; private int monthNumber; public MonthIdentifier(int month) { month = monthNumber; } public String getMonth() { int monthNameLength = 10; int end = monthNumber * monthNameLength; int start = end - monthNameLength; return monthNames.substring(start, end); } } Here is the main import java.util.Scanner; public class ChooseMonth { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Number 1-12: "); int month = input.nextInt(); MonthIdentifier newMonth = new MonthIdentifier(month); newMonth.getMonth(); String monthName = newMonth.getMonth(); System.out.println(month + " : " + monthName); } } I have updated my code to what I have so far. I am getting an error: exception in thread Main String Index out of range: -10 Also I forgot to mention I have to take user input 1-12 and have it correlate to the substring for that month.
tagged with: java
has answer: http://stackoverflow.com/a/24443628
has comment: http://stackoverflow.com/comment/37822442

http://stackoverflow.com/comment/38071128
has text: @Jon Skeet: JIT inlining has no effect on the stack trace. That’s why creating a stack trace will kill performance for sure. On the other hand, using Reflection has an impact on the stack trace.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24576979
type: AnswerComment

http://stackoverflow.com/comment/37896090
type: Comment
comment on: http://stackoverflow.com/a/24482447
score: 0
type: AnswerComment
has text: Still crashes the app

http://stackoverflow.com/comment/37887701
comment on: http://stackoverflow.com/q/24450500
score: 1
has text: Your exception says no bean found that means that spring can not find the bean for JMXAgent.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37920534
comment on: http://stackoverflow.com/q/24494550
score: 0
type: Comment
type: QuestionComment
has text: Apparently, you need to do little more work (hack!~1) to access final field. I'll update my answer once more. Moreover, I made mistake and adviced you to use wrong `field.set` method.

http://stackoverflow.com/comment/37948128
type: Comment
has text: If you are placing your jar files into WEB-INF/lib folder, then there is no need of setting your jars in build path.
comment on: http://stackoverflow.com/a/24510666
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38006914
comment on: http://stackoverflow.com/a/24531009
type: AnswerComment
score: 0
type: Comment
has text: @user3652550 - What did you do, and how did it "not work"? The fix provided should prevent you getting that exception in the logcat. That's what you wanted ... isn't it?

http://stackoverflow.com/q/24436871
tagged with: sorting
has comment: http://stackoverflow.com/comment/37812793
has title: Very confused by Java 8 Comparator type inference
has comment: http://stackoverflow.com/comment/37813431
has comment: http://stackoverflow.com/comment/132086595
tagged with: comparator
has comment: http://stackoverflow.com/comment/37813001
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24437480
accepted answer: http://stackoverflow.com/a/24442897
has comment: http://stackoverflow.com/comment/37811027
downvote count: 0
has comment: http://stackoverflow.com/comment/37812177
favorite count: 0
has answer: http://stackoverflow.com/a/24437207
type: Question
upvote count: 125
has body: I've been looking at the difference between Collections.sort and list.sort, specifically regarding using the Comparator static methods and whether param types are required in the lambda expressions. Before we start, I know I could use method references, e.g. Song::getTitle to overcome my problems, but my query here is not so much something I want to fix but something I want an answer to, i.e. why is the Java compiler handling it in this way. These are my finding. Suppose we have an ArrayList of type Song, with some songs added, there are 3 standard get methods: ArrayList<Song> playlist1 = new ArrayList<Song>(); //add some new Song objects playlist.addSong( new Song("Only Girl (In The World)", 235, "Rihanna") ); playlist.addSong( new Song("Thinking of Me", 206, "Olly Murs") ); playlist.addSong( new Song("Raise Your Glass", 202,"P!nk") ); Here is a call to both types of sort method that works, no problem: Collections.sort(playlist1, Comparator.comparing(p1 -> p1.getTitle())); playlist1.sort( Comparator.comparing(p1 -> p1.getTitle())); As soon as I start to chain thenComparing, the following happens: Collections.sort(playlist1, Comparator.comparing(p1 -> p1.getTitle()) .thenComparing(p1 -> p1.getDuration()) .thenComparing(p1 -> p1.getArtist()) ); playlist1.sort( Comparator.comparing(p1 -> p1.getTitle()) .thenComparing(p1 -> p1.getDuration()) .thenComparing(p1 -> p1.getArtist()) ); i.e. syntax errors because it does not know the type of p1 anymore. So to fix this I add the type Song to the first parameter (of comparing): Collections.sort(playlist1, Comparator.comparing((Song p1) -> p1.getTitle()) .thenComparing(p1 -> p1.getDuration()) .thenComparing(p1 -> p1.getArtist()) ); playlist1.sort( Comparator.comparing((Song p1) -> p1.getTitle()) .thenComparing(p1 -> p1.getDuration()) .thenComparing(p1 -> p1.getArtist()) ); Now here comes the CONFUSING part. For playlist1.sort, i.e. the List, this solve all compilation errors, for both the following thenComparing calls. However,…
has comment: http://stackoverflow.com/comment/37812049
possible better answer: http://stackoverflow.com/a/24437207
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/45325781
tagged with: java
has comment: http://stackoverflow.com/comment/37814274
has answer: http://stackoverflow.com/a/24442897
has comment: http://stackoverflow.com/comment/37812109
answer count: 4
has comment: http://stackoverflow.com/comment/37810592
score: 125

http://stackoverflow.com/q/24483172
has comment: http://stackoverflow.com/comment/37897257
has body: I am trying to format a date such as Mon Jul 28 00:00:00 CDT 2014 to something a bit more user friendly, such as Mon 6/28. What am I doing wrong? Code: String date_string = "Mon Jul 28 00:00:00 CDT 2014"; SimpleDateFormat inputFormatter = new SimpleDateFormat("ccc LLL F HH:mm:ss zzz yyyy"); //please notice the capital M SimpleDateFormat outputFormatter = new SimpleDateFormat("ccc LLL/yyyy"); try { Date date = inputFormatter.parse(date_string); String text = outputFormatter.format(date); System.out.println(text); } catch (ParseException e) { e.printStackTrace(); } When I use System.out.println to see what outputFormatter is set to, the result is: Sun Jan/2015
has title: Convert date to friendly format using SimpleDateFormat
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24483212
has comment: http://stackoverflow.com/comment/37897240
favorite count: 0
has comment: http://stackoverflow.com/comment/37899988
type: Question
tagged with: time
linked to: http://stackoverflow.com/q/454315
has answer: http://stackoverflow.com/a/24483567
tagged with: android
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24483229
possible better answer: http://stackoverflow.com/a/24483215
has answer: http://stackoverflow.com/a/24483215
has comment: http://stackoverflow.com/comment/37898063
score: 0
tagged with: simpledateformat
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/24483212
answer count: 4

http://stackoverflow.com/comment/38074260
score: 0
type: AnswerComment
has text: Thats not true, i have removed the api however the exception will be thrown again.
type: Comment
comment on: http://stackoverflow.com/a/24569684

http://stackoverflow.com/comment/37917027
type: Comment
comment on: http://stackoverflow.com/a/24493150
type: AnswerComment
score: 0
has text: @Manish: it doesn't store a textual representation at all. It stores a bunch of bits - the same bits for 23, 23.0, 23.00 etc. How your db stores it is a different matter.

http://stackoverflow.com/comment/37919885
type: Comment
comment on: http://stackoverflow.com/q/24494543
type: QuestionComment
has text: Do you see anything in the log files when the app starts up that mentions not being able to create an endpoint for POST?
score: 0

android-volley
tags question: http://stackoverflow.com/q/24559923
tags question: http://stackoverflow.com/q/24529973
type: Tag
tags question: http://stackoverflow.com/q/24456355
tags question: http://stackoverflow.com/q/24538459
tags question: http://stackoverflow.com/q/24580578
tag name: android-volley
tags question: http://stackoverflow.com/q/24518727
tags question: http://stackoverflow.com/q/24515803
tags question: http://stackoverflow.com/q/24585682

http://stackoverflow.com/comment/37793775
has text: This is private method of class under test.
comment on: http://stackoverflow.com/q/24427685
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37825987
score: 0
comment on: http://stackoverflow.com/q/24445170
type: QuestionComment
type: Comment
has text: Who says you need Maven for external libraries?

http://stackoverflow.com/comment/37930929
comment on: http://stackoverflow.com/a/24501410
has text: Tried, compiler forbids to have two methods `(Object... data)` and `(Object[] data)` with the same name.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/38150203
has text: I see what you are saying now. I just fixed it by changing my code to use a custom adapter which extends BaseAdapter and it works much more efficiently for my use.
score: 0
comment on: http://stackoverflow.com/a/24562962
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38065701
type: Comment
type: QuestionComment
score: 0
has text: Yes audit_date and audit_time has already index
comment on: http://stackoverflow.com/q/24572836

http://stackoverflow.com/q/24521401
has answer: http://stackoverflow.com/a/24521548
has comment: http://stackoverflow.com/comment/37967311
has comment: http://stackoverflow.com/comment/37967287
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24521570
has body: How do I remove the last known word in a String? For example a sentence here, "Hello, World. more&gt;&gt; I want remove the last word which is more&gt;&gt;. This word is known throughout all of my String collection. Tried using replaceAll method, but couldn't make it work. I also tried substring like so: person = person.substring(0, person.lastIndexOf(" ")) + " "; but it removes the last two words in my sentence. Does regex help?
has title: Remove last known word in a string
tagged with: string
type: Question
has answer: http://stackoverflow.com/a/24524841
answer count: 6
has answer: http://stackoverflow.com/a/24521744
has answer: http://stackoverflow.com/a/24558568
score: 0
has answer: http://stackoverflow.com/a/24522027
has comment: http://stackoverflow.com/comment/37967326

http://stackoverflow.com/q/24477684
has title: Superclass handling subclass exceptions
has body: Let's say I have a superclass called ApplicationDao and a number of inheriting subclasses such as UserDao, ProductDao etc... If my catch and finally blocks are exactly the same for all my subclasses' CRUD methods, is it possible for the superclass (ApplicationDao) to handle the exceptions rather than the subclasses. That would mean I would only need to write one TRY...CATCH...FINALLY block in the superclass rather than duplicating it in each subclass. If it is possible, I'm not sure how to do it because the methods in each subclass would have a different name (getUsers in UserDao, getProducts in productDao, etc...) so I'm not directly overriding a method in the superclass. Any advice appreciated for how to capture exceptions in the parent class for all subclasses.
has answer: http://stackoverflow.com/a/24477734
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: inheritance
score: 0
possible better answer: http://stackoverflow.com/a/24478292
tagged with: exception
answer count: 3
has answer: http://stackoverflow.com/a/24478292
has comment: http://stackoverflow.com/comment/37886484
accepted answer: http://stackoverflow.com/a/24477734
has answer: http://stackoverflow.com/a/24477743

list
type: Tag
tags question: http://stackoverflow.com/q/24536812
tags question: http://stackoverflow.com/q/24487646
tags question: http://stackoverflow.com/q/24441868
tags question: http://stackoverflow.com/q/24536428
tags question: http://stackoverflow.com/q/24526398
tags question: http://stackoverflow.com/q/24564767
tags question: http://stackoverflow.com/q/24503743
tags question: http://stackoverflow.com/q/24516354
tag name: list
tags question: http://stackoverflow.com/q/24497150
tags question: http://stackoverflow.com/q/24443601
tags question: http://stackoverflow.com/q/24511474
tags question: http://stackoverflow.com/q/24458799
tags question: http://stackoverflow.com/q/24467745
tags question: http://stackoverflow.com/q/24557138
tags question: http://stackoverflow.com/q/24428394
tags question: http://stackoverflow.com/q/24434934
tags question: http://stackoverflow.com/q/24487438
tags question: http://stackoverflow.com/q/24475036
tags question: http://stackoverflow.com/q/24432194
tags question: http://stackoverflow.com/q/24511454

http://stackoverflow.com/comment/38007819
comment on: http://stackoverflow.com/q/24542816
type: Comment
type: QuestionComment
has text: compChoice.equalsIgnoreCase(answer)
score: 0

http://stackoverflow.com/comment/38078899
has text: -1, `Try adding a call to Update inside of paint` the painting method should NOT update its own state, only paint its state.
type: Comment
comment on: http://stackoverflow.com/a/24581125
score: 1
type: AnswerComment

http://stackoverflow.com/comment/38074499
has text: wait, "with java file"? You *are* using an IDE, are you not?!
comment on: http://stackoverflow.com/q/24578741
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/38017302
score: 1
comment on: http://stackoverflow.com/q/24545746
type: Comment
has text: Read again that tutorial and follow it to the point.
type: QuestionComment

http://stackoverflow.com/q/24433925
answer count: 2
has answer: http://stackoverflow.com/a/34385125
tagged with: playframework
upvote count: 1
has body: What is the right approach in order to implement a correct exception handling within a WS API Request? An example: F.Promise&lt;List&lt;String&gt;&gt; modulesPromise = WS.url(requestUrl).setAuth(apiUser, apiPassword).get().map( new F.Function&lt;WSResponse, List&lt;String&gt;&gt;() { public List&lt;String&gt; apply(WSResponse response) { List&lt;String&gt; modules = new ArrayList&lt;&gt;(); JsonNode json = response.asJson(); for (JsonNode node : json) { modules.add(node.get("name").toString().replace("\"", StringUtils.EMPTY)); } return modules; } } ); modulesPromise.recover(new F.Function&lt;Throwable, List&lt;String&gt;&gt;() { @Override public List&lt;String&gt; apply(Throwable throwable) throws Throwable { Logger.error("error", throwable); return new ArrayList&lt;&gt;(); } }); If an exception occurs in that case within the inner class, the exception ll be thrown further. Its the same problem with the method .onFailure(). Isn't it the best way to use a try catch block in order to catch potential exceptions? The recover and the onFailure method seems to be useless.
possible better answer: http://stackoverflow.com/a/34385125
tagged with: exception
tagged with: promise
tagged with: error-handling
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24434367
accepted answer: http://stackoverflow.com/a/24434367
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question
has title: Play Framework 2.3.1 Promise exception handling within inner class

http://stackoverflow.com/comment/37896427
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24472004
type: Comment
has text: Yes, for that I should implement Serializable in a class of JTDS. But I returned a byte array for the RMI. Thanks!

http://stackoverflow.com/comment/37847165
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24456595
score: 0
has text: No I think it's correct. The function that contains the switch needs to be returning a boolean, and getRating() returns an int, and getGrape returns a String.

http://stackoverflow.com/comment/37963337
type: QuestionComment
has text: Use a mocking framework to mock the object? What's the issue exactly?
score: 1
comment on: http://stackoverflow.com/q/24519222
type: Comment

http://stackoverflow.com/q/24482186
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: regex
score: 2
has body: Now my program use this pattern .*[A-Z].* to match every word that has an uppercase letter. But my problem is, I need a pattern that can identify a word with an uppercase only on the beginning of word. Example Input for my program now:- My name is Johan and I am from langKawi. Output Matched: My Johan I langKawi. But using my pattern a word like langKawi where the uppercase is not at the beginning of a word it still matched. Can anyone help me with the pattern where it match a word that has uppercase for the first letter only and my text/input only consist alphabetical characters without number and symbols. Thank you.
tagged with: java
has title: What is the correct regex to match uppercase letter for only first letter in words
type: Question
has answer: http://stackoverflow.com/a/24482229
has answer: http://stackoverflow.com/a/24482216
answer count: 2

http://stackoverflow.com/comment/37930707
has text: Thanks. So, I cannot do it only by JAVA api?
type: AnswerComment
comment on: http://stackoverflow.com/a/24501242
score: 0
type: Comment

http://stackoverflow.com/comment/66004000
comment on: http://stackoverflow.com/a/24520760
score: 0
type: AnswerComment
has text: What we can use for Annotation based example? I'm facing extact issue
type: Comment

http://stackoverflow.com/comment/37820831
comment on: http://stackoverflow.com/a/24442256
type: AnswerComment
has text: if you read a line with a dash, you're not adding it to list but you're still incrementing x. So when you reference list.get(x), you'll get an indexoutofbounds exception
score: 0
type: Comment

http://stackoverflow.com/a/24497432
answers question: http://stackoverflow.com/q/24497392
has body: Why are you passing the entire query via POST? Bad idea! Especially since you show usernames and passwords! But for the issue, disable magic_quotes_gpc in php.ini or if you can't: $_POST = array_map('stripslashes', $_POST);
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37923790

http://stackoverflow.com/a/24537663
upvote count: 2
type: AcceptedAnswer
has body: You can use the standard Java Date API: long yourNumber = 23377855; Date date = new Date(yourNumber); Or you can use Joda Time library, provides much better overall functionality than Java Date API: long yourNumber = 23377855; DateTime dt = new DateTime(yourNumber);
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24537602
answers question: http://stackoverflow.com/q/24537602
score: 2

http://stackoverflow.com/comment/38008213
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24539311
has text: **this has nothing to do with erasure and everything to do with the fact that there is no type information on `Node n`, there is nothing ot "erase" it is `Object` if nothing else is presented**
type: AnswerComment

http://stackoverflow.com/comment/37865347
type: Comment
type: QuestionComment
has text: how to make that in parallel?
score: 0
comment on: http://stackoverflow.com/q/24466277

http://stackoverflow.com/q/24545711
has title: How to find whole word only in JtextPane
has body: I have to find out whole word only in a given text.I had tried that.But,it is not working sometimes.For example whole word contains starting of a given text as a substring,end of the given text contains the whole word and I press search button continueosly It was shows an error "offset out of bounds" in some cases.Please help me.Thank you in Advance. Here is my code: public class FindWholeWord extends javax.swing.JFrame { public static void main(String args[]) { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) { ex.printStackTrace(); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new FindWholeWord().setVisible(true); } }); } private javax.swing.JScrollPane scrollPane; private javax.swing.JTextField searchText; private javax.swing.JTextPane textPane; private javax.swing.JButton search; public FindWholeWord() { initComponents(); } public void highLight(JTextComponent component, String patteren) { try { Document doc = component.getDocument(); String text = component.getText(0, doc.getLength()); int pos = component.getCaretPosition(); if (pos == doc.getLength()) { pos = 0; } int index = text.toUpperCase().indexOf(patteren.toUpperCase(), pos); int start = Utilities.getWordStart(component, index); int end = Utilities.getWordEnd(component, index + patteren.length()); int patterenLn=patteren.length(); int diff=end-start; if (index &gt;= 0) { if((start==index)&amp;&amp;(end==index+patter…
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24548284
accepted answer: http://stackoverflow.com/a/24545902
tagged with: swing
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24545902
score: -1
has comment: http://stackoverflow.com/comment/38015427
answer count: 3
possible better answer: http://stackoverflow.com/a/24548284
has comment: http://stackoverflow.com/comment/38015370
downvote count: 1
tagged with: string
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/38016012
has comment: http://stackoverflow.com/comment/38013530
has answer: http://stackoverflow.com/a/24545912

http://stackoverflow.com/q/24456605
tagged with: inline
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4197693
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37852104
type: Question
has comment: http://stackoverflow.com/comment/38050211
has comment: http://stackoverflow.com/comment/37847492
tagged with: perl
has body: I was looking for some help getting this bit of code to funciton correctly via perl Inline::Java. My problem occurs when I call the stupid() method passing two arguments. My apache log (attached below) returns No public method 'stupid' defined for class 'main::MathFunctions'. Note: line 342 is print $jfunc-&gt;stupid($tapsRe{$i},$tapsIm{$i}) . "\n"; My other method (twoComplimentNbit) inside the MathFunctions class works just fine. Can anyone point to something I'm missing here? BEGIN { $ENV{CLASSPATH} .= ":/var/www/java/commons-lang-2.6/commons-lang-2.6.jar"; $ENV{CLASSPATH} .= ":/var/www/java/commons-math-2.2/commons-math-2.2.jar"; } use Inline::Java; use Inline (Java =&gt; &lt;&lt;'END_OF_JAVA_CODE', AUTOSTUDY =&gt; 1, DEBUG =&gt; 6, import org.apache.commons.math.complex.*; import org.apache.commons.math.MathException; import org.apache.commons.math.transform.FastFourierTransformer; import java.util.*; class MathFunctions { public static int twoComplimentNbit(int val, int bits) { val &amp;= (int) (1 &lt;&lt; bits) - 1; int R = (int) (1 &lt;&lt; bits - 1); if (val &lt; R) { return val; } else { return val - R * 2; } } public double stupid (float REAL, float IMG) { Complex result = new Complex(REAL,IMG); double realOne = result.getReal(); double imgOne = result.getImaginary(); return realOne; } } END_OF_JAVA_CODE SHARED_JVM =&gt; 1, DIRECTORY =&gt; '/tmp', ); my $jfunc = new MathFunctions(); Output: [Fri Jun 27 16:11:45 2014] [error] [perl][3] packet sent is call_method 2031 MathFunctions fastAtan2 (double,double) scalar:LTAuMDAxOTU2OTY5NjQ2MDM2Mzc= scalar:MC4wMDE5NTY5Njk2NDYwMzYzNw== [Fri Jun 27 16:11:45 2014] [error] [perl][3] packet recv is ok scalar:LTAuNzg1Mzk4Mg== [Fri Jun 27 16:11:45 2014] [error] [perl][5] stupid [Fri Jun 27 16:11:45 2014] [error] No public method 'stupid' defined for class 'main::MathFunctions' at /var/www/pre_eq-dev.cgi line 342 [Fri Jun 27 16:11:45 2014] [error] [perl][4] destroying Inline::Java::Object [Fri Jun 27 16:11:45 2014] [error…
has comment: http://stackoverflow.com/comment/37847485
upvote count: 1
has title: Perl inline::Java No public method ' ' defined for class ' '
favorite count: 0

http://stackoverflow.com/q/24511769
has comment: http://stackoverflow.com/comment/37951990
has comment: http://stackoverflow.com/comment/37960226
has body: I have tcp communication via socket code like : public void openConnection() throws Exception { socket = new Socket(); InetAddress iNet = InetAddress.getByName("server"); InetSocketAddress sock = new InetSocketAddress(iNet, Integer.parseInt(port)); socket.connect(sock, 0); out = new PrintWriter(socket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); } and send method as : synchronized void send(String message) { try { out.println(message); } catch (Exception e) { throw new RuntimeException(this.getClass() + ": Error Sending Message: " + message, e); } } This writes message on socket and communicated through tcp. (non-blocking call) My doubt is, how can we determine if this packet was successfully sent or if dropped, what was the reason through java code?
has comment: http://stackoverflow.com/comment/37959908
tagged with: tcp
tagged with: java
has title: Socket TCP connection write failure
has comment: http://stackoverflow.com/comment/37949272
type: Question
has comment: http://stackoverflow.com/comment/37952444
has comment: http://stackoverflow.com/comment/37950438
has answer: http://stackoverflow.com/a/24511950
has comment: http://stackoverflow.com/comment/37962362
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24514658
tagged with: sockets

http://stackoverflow.com/q/24532854
possible better answer: http://stackoverflow.com/a/24533573
has answer: http://stackoverflow.com/a/24533031
type: AnsweredQuestion
tagged with: netbeans
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24533031
has body: I downloaded the source files (contained in folders) for javadoc and doclet (some folders like com/sun/tools/doclets/... with some .java source files in them) and I would like to load it into Netbeans as a project (all the .java files that are somewhere starting in the com directory), so that I am able to work with it easily. Are there any ways, how to make it (there is quite lots of them, so I do not want to start new project and add them manually one by one)?
has title: Netbeans java files as a project
score: 0
tagged with: java
tagged with: import
has answer: http://stackoverflow.com/a/24533573

spring-integration
tags question: http://stackoverflow.com/q/24556825
tags question: http://stackoverflow.com/q/24516832
type: Tag
tags question: http://stackoverflow.com/q/24462695
tags question: http://stackoverflow.com/q/24531553
tags question: http://stackoverflow.com/q/24575144
tag name: spring-integration

http://stackoverflow.com/q/24521639
type: Question
has title: Mercurial Tag rule engine
answer count: 1
downvote count: 0
tagged with: rule-engine
tagged with: mercurial
favorite count: 0
has answer: http://stackoverflow.com/a/24521781
upvote count: 2
accepted answer: http://stackoverflow.com/a/24521781
type: AnsweredQuestion
score: 2
has body: Is there a tag rule engine in Mercurial? I want to enforce the tag name. For example. tag VERSION 2.4...I want to have a way to enforce "VERSION" to be in the tag name no mater what? Thanks.
tagged with: java
linked to: http://stackoverflow.com/q/6746881
tagged with: tortoisehg

http://stackoverflow.com/q/24524811
has answer: http://stackoverflow.com/a/24525097
has answer: http://stackoverflow.com/a/24524846
score: 2
type: AnsweredQuestion
has body: what's the difference between the two initialization: Object x = new String(); String x = new String(); in java thank!
linked to: http://stackoverflow.com/q/380813
downvote count: 0
has answer: http://stackoverflow.com/a/24524900
tagged with: java
has answer: http://stackoverflow.com/a/24525515
type: Question
possible better answer: http://stackoverflow.com/a/24524834
has answer: http://stackoverflow.com/a/24524834
has answer: http://stackoverflow.com/a/24524902
upvote count: 2
has title: what's the difference between the two initialization: Object x = new String(); String x = new String();
has comment: http://stackoverflow.com/comment/37973497
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24524833
accepted answer: http://stackoverflow.com/a/24524833

http://stackoverflow.com/q/24454422
type: UnansweredQuestion
tagged with: java
has title: asynctask fatal exception #1 in loadermanager
type: Question
score: 0
answer count: 2
has body: I have a problem with my loadermanager that should extracts my data from my contentprovider. the error is : 06-27 10:14:29.053: E/AndroidRuntime(2270): FATAL EXCEPTION: AsyncTask #1 06-27 10:14:29.053: E/AndroidRuntime(2270): Process: com.trackme, PID: 2270 06-27 10:14:29.053: E/AndroidRuntime(2270): java.lang.RuntimeException: An error occured while executing doInBackground() 06-27 10:14:29.053: E/AndroidRuntime(2270): at android.os.AsyncTask$3.done(AsyncTask.java:300) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 06-27 10:14:29.053: E/AndroidRuntime(2270): at java.lang.Thread.run(Thread.java:841) 06-27 10:14:29.053: E/AndroidRuntime(2270): Caused by: java.lang.IndexOutOfBoundsException` and my code is : public class RoutesListActivity extends ListActivity implements LoaderManager.LoaderCallbacks&lt;Cursor&gt;{ public static final String TAG = "RouteList"; private static final int LOADER_ID = 1; public static final int ACTIVITY_CREATE = 0; public static final int ACTIVITY_RESULTS = 1; private SimpleCursorAdapter mRoutesCursorAdapter; @Override protected void onCreate(Bundle savedInstanceState){ Log.i(TAG, "onCreate della lista "); super.onCreate(savedInstanceState); setContentView(R.layout.activity_routes_list); String[] from = new String[] {GeoProvider.KEY_ROWID}; int[] to = new int[] {R.id.route1}; mRoutesCursorAdapter = new SimpleCursorAdapter(this, R.layout.route_row, null, from, to, 0); setListAdapter(mRoutesCursorAdapter); //pe…
has answer: http://stackoverflow.com/a/24454691
linked to: http://stackoverflow.com/q/7553724
has answer: http://stackoverflow.com/a/24454613
tagged with: android
tagged with: android-asynctask

http://stackoverflow.com/comment/37807502
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24435019
score: 1
has text: @David Yes, according to the JLS any number of statements can follow the case label, including blocks. But to avoid confusion, I always make sure that my `case`s are either a single block or a single statement followed by a `break` statement.

http://stackoverflow.com/q/24585420
has title: Can't change text after async task
tagged with: asynchronous
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24585539
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/24585509
has answer: http://stackoverflow.com/a/24585633
has body: I am developing android application. It connects to the internet using async task and gets JSON result. After that it saves values to private String variables. This task works with button listener in fragment class. After button click, async task executes. Next command is setText to TextView. Async task works well, but nothing appears. If I start preference activity and then come back, it is there. So it works but it doesn't appear. Maybe I have to "repaint" screen but I don't know how. Or some other ideas? Please help. I created basic android project in Eclipse/Android studio where I have MainActivity class and PlaceholderFragment class is extending Fragment (with no Fragment tag in XML - activity_main.xml is FrameLayout and fragment_main.xml is Linear Layout). Firstly class PlaceholderFragment was inner static class but I putted it out to separate .java file. Look at my code, I tried to simplify it: MainActivity.java import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity { // URL to get JSON private static String pref_url; private static String pref_key; private static String pref_check; private String status = " "; private static final String PARAM_KEY = "key"; private static final String PARAM_CODE = "code"; private static final String PARAM_CHECK = "check"; // JSON Node Names private static final String TAG_STATUS = "s…
score: 0
answer count: 3

http://stackoverflow.com/q/24570288
has title: Debug OSGi component activation/deactivation issue
accepted answer: http://stackoverflow.com/a/24574229
upvote count: 1
has comment: http://stackoverflow.com/comment/38064144
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38065487
has comment: http://stackoverflow.com/comment/38063696
has answer: http://stackoverflow.com/a/24574229
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38063621
tagged with: apache-felix
tagged with: osgi
has comment: http://stackoverflow.com/comment/38060237
favorite count: 0
has body: I'm trying to debug a issue which seems to be caused by a weird behavior of one of my OSGi components during framework shutdown. When I try to shutdown the framework by calling context.getBundle(0).shutdown() My component gets deactivated, but for some reason it is re-activated then deactivated again. The second activation/deactivation cycle is causing some weird behavior because the component registers with a "UI Container" which causes flickering in the UI of the application during shutdown. My question is what could cause the second activation/deactivation cycle? I'm using declarative services Maven, Apache Felix and the SCR plugin. The links below are to the stack traces from the deactivate/re-activate/deactivate methods which where requested in an answer below: deactivate stacktrace re-activate stacktrace deactivate stacktrace

http://stackoverflow.com/comment/38085398
type: QuestionComment
comment on: http://stackoverflow.com/q/24584805
score: 0
has text: What do you mean with "having the CA"?
type: Comment

http://stackoverflow.com/comment/37838267
type: AnswerComment
score: 0
has text: What should I enter in the `When` field? I'd like to just select the project in project view and then when hitting the keystroke it should be installed.
type: Comment
comment on: http://stackoverflow.com/a/24451887

http://stackoverflow.com/comment/37894274
score: 1
type: AnswerComment
has text: If I were the interviewer, I would employ this person. No point re-inventing wheels.
type: Comment
comment on: http://stackoverflow.com/a/24476295

http://stackoverflow.com/comment/37995727
has text: thank you, thats what I needed to know, but I still have a question; is that how It(button) knows that the it was clicked ...?
comment on: http://stackoverflow.com/a/24536620
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24546004
type: Answer
answers question: http://stackoverflow.com/q/24545803
score: 2
has body: The default layout manager for a panel is a FlowLayout which arranges elements from left-to-right. Since you want the grid to appear in the main view, you may consider using a different layout manager such as a BorderLayout. If you use a BorderLayout, you can place the grid into the center region such that grid fills up the main view: import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.BorderLayout; public class TicTacToePlayer { private static final int FRAME_WIDTH = 400; private static final int FRAME_HEIGHT = 400; private int count = 0; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final JFrame frame = new JFrame(); // create board final LinesComponent boardLines = new LinesComponent(); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(0, 0)); panel.add(boardLines, BorderLayout.CENTER); frame.getContentPane().add(panel); frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } } To add buttons to the window while using a BorderLayout, you can add the buttons to another JPanel and add that panel to the BorderLayout in one of the other regions (ie: BorderLayout.NORTH, BorderLayout.SOUTH, etc.). Also, note that in the above corrected code that the Swing GUI code is placed in the Event Dispatch Thread (EDT). You should never run any Swing code outside of the EDT because most Swing object methods are not thread safe. For more information about layout managers, take a read at A Visual Guide to Layout Managers.
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24566583
has body: By having the list of missiles inside the Missilies class, you make each missile have its own list - and the missile itself is the only thing on its list. You need to move the declaration of the list to a different class.
score: 3
has comment: http://stackoverflow.com/comment/38052596
accepted answer of: http://stackoverflow.com/q/24566568
has comment: http://stackoverflow.com/comment/38054267
has comment: http://stackoverflow.com/comment/38052914
answers question: http://stackoverflow.com/q/24566568
has comment: http://stackoverflow.com/comment/38052636
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/38052221
type: Answer
downvote count: 0

http://stackoverflow.com/q/24519986
answer count: 8
has answer: http://stackoverflow.com/a/24648912
has answer: http://stackoverflow.com/a/24676770
has answer: http://stackoverflow.com/a/24700479
downvote count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/38323154
has answer: http://stackoverflow.com/a/24707223
has title: How to get rid of this ClassNotFoundException that is encountered in my Android app only in debug mode?
tagged with: android
has answer: http://stackoverflow.com/a/24695970
favorite count: 0
has answer: http://stackoverflow.com/a/24589961
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24702244
has body: I am using Google Play Location Services in my Android app and while debugging it, the code execution stops at this ClassNotFoundException instead of the breakpoints that I have set. The class in question (ParcelableGeofence) seems to belong to the Location Services API. I had added the Google Play Services library strictly following the instructions in the documentation and the app runs fine on the phone - this problem occurs only in the debug mode. I have double checked to make sure that Google Play library project is present in Eclipse workspace as a library, is referenced by my project and the play services jar is present in the libs folder of my project. What else can we try to fix this issue or work around it? I am not able to debug other code because this error suspends the VM while debugging. Please see the image of my debug perspective for this error below: EDIT: To clarify, this error occurs when I debug on my phone that has the latest version of Google Play Services installed. So this does not have to do with the emulator not having the Play Services SDK.
has answer: http://stackoverflow.com/a/24587686
score: 2
tagged with: java
tagged with: eclipse
type: Question
tagged with: debugging

key-bindings
tags question: http://stackoverflow.com/q/24478991
tags question: http://stackoverflow.com/q/24470164
tag name: key-bindings
type: Tag

http://stackoverflow.com/a/24442256
has comment: http://stackoverflow.com/comment/37820805
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37820831
has body: You're referencing list.get(x), but your x++ and your list.add won't be in synch if you read a line with no dash. So (x) won't be the correct reference. Why are you doing: String [] temp2 = list.get(x).split(" "); Instead of: String [] temp2 = temp.split(" "); EDIT Try: if(!(temp.contains(dash))){ list.add(temp); if(temp.contains(" ")){ String [] temp2 = temp.split(" "); names.add(temp2[0]); syn.add(temp2[1]); id.add(temp2[2]); }else{ System.out.println(temp); }//Close if }//Close if for(int x = 0; x &lt; names.size(); x++) { System.out.println(names.get(x)); System.out.println(syn.get(x)); System.out.println(id.get(x)); }
answers question: http://stackoverflow.com/q/24442086
has comment: http://stackoverflow.com/comment/37821842
downvote count: 0
has comment: http://stackoverflow.com/comment/37820899
type: Answer

http://stackoverflow.com/q/24511961
has answer: http://stackoverflow.com/a/24512165
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 3
tagged with: exception
has comment: http://stackoverflow.com/comment/37949490
has answer: http://stackoverflow.com/a/24512574
accepted answer: http://stackoverflow.com/a/24512574
has comment: http://stackoverflow.com/comment/37949713
has answer: http://stackoverflow.com/a/24512276
has comment: http://stackoverflow.com/comment/37949489
has title: reading variables buried in java exception handling
possible better answer: http://stackoverflow.com/a/24512165
has body: I am writing a function to take a text file and count how many lines it has while outputting the lines to an array of strings. Doing this I have several exceptions I need to look out for. The class function has several variables that should have a scope throughout the function but when I write a value to the function inside of an exception, the return statement cannot find it. I've moved the declaration around and nothing helps The value returned "h5Files" "Might not have been initialized" Since I don't know how long the array will be I cannot initialize it to a certain length. I do this within the code and I need a way to tell the return statement that I now have a values Here is the code public String[] ReadScanlist(String fileIn){ int i; String directory ="c:\\data\\"; // "\" is an illegal character System.out.println(directory); int linereader = 0; String h5Files[]; File fileToRead = new File(directory + fileIn); System.out.println(fileToRead); try { FileInputStream fin = new FileInputStream(fileToRead); // open this file } catch(FileNotFoundException exc) { System.out.println("File Not Found"); } try{ //read bytes until EOF is detected do { FileReader fr = new FileReader(fileToRead);// Need to convert to reader LineNumberReader lineToRead = new LineNumberReader(fr); // Use line number reader class // while (lineToRead.readLine() != null){ linereader++; } linereader = 0; lineToRead.setLineNumber(0); //reset line number h5Files = new String[linereader]; while (lineToRead.readLine() != null){ h5Files[linereader] = lineToRead.readLine(); // deposit string into array linereader++; } return h5Files; } while(i !=-1); // When i = -1 the end of the file has been reached } catch(IOException exc) { System.out.println("Error reading file."); } try{ FileInputStream fin = new FileInputStream(fileToRead); fin.close(); // close the file } catch(IOException exc) { System.out.println("Error Closing File"); } return h5Files; }

http://stackoverflow.com/q/24441343
has comment: http://stackoverflow.com/comment/37819210
downvote count: 1
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37819336
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37819293
has comment: http://stackoverflow.com/comment/37819461
has answer: http://stackoverflow.com/a/24599480
has comment: http://stackoverflow.com/comment/37819262
has body: Problem solved : Used wrong Color Package I am trying to read some values from an csv file, and when I put three of the numbers together, they form an rgb-value. However, for some reason, my IDE, Netbeans, is giving me the error: 'new Color(float,float,float) has private access in the class Color' I have no idea how using parseInt can yield a float, even after casting the result to an integer as well. Thank you for your time and patience. public void initBasicRGB(String definitionCSVContent) { String[] lines = definitionCSVContent.split("\n"); String[] values; for (String s : lines) { values = s.split(";"); if (!s.isEmpty() &amp;&amp; values.length==6 ) { int red = (int)Integer.parseInt(values[1]); int green = (int)Integer.parseInt(values[2]); int blue = (int)Integer.parseInt(values[3]); String nameProvince = values[4]; basicRGB.put(new Color(red,green,blue), nameProvince); //the error is on the line above } } }
tagged with: colors
has comment: http://stackoverflow.com/comment/37819329
answer count: 1
has comment: http://stackoverflow.com/comment/37819606
has title: Why can't I create a new Color?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24599480

http://stackoverflow.com/comment/37938690
score: 0
type: AnswerComment
has text: I got a `NullPointerException` for `clip`?
type: Comment
comment on: http://stackoverflow.com/a/24482015

http://stackoverflow.com/a/52873154
score: 1
answers question: http://stackoverflow.com/q/24487064
downvote count: 0
has body: Did you change the PATH variable to point to the newer version? /usr/libexec/java_home is the starting point for switching java versions on the command line. Check out this post to understand how to handle different java versions on the Mac.
type: Answer
upvote count: 1

http://stackoverflow.com/q/24570803
tagged with: bufferstrategy
score: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has title: Exchange BufferStrategy FrameBuffer with Custom Buffer
has body: I wrote a Java color buffer class that contains a 2D float array, which is the buffer. Now I want to exchange the buffer from the BufferStrategy of my JFrame/Canvas with my buffer. I did this by drawing each pixel of the buffer to the screen using drawLine: public void exchangeBuffers(Graphics g) { for (int i = 0; i &lt; width; i++) for (int j = 0; j &lt; width; j++) g.drawLine(i, j, i, j); } Now is there a better way of doing this? The performance is really low using this.
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38060386
type: Question
has comment: http://stackoverflow.com/comment/38061153
tagged with: graphics

http://stackoverflow.com/comment/37921568
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24453449
has text: You are 100% correct. I pruned my project's lib folder and found that jaxb-api and jaxb-impl were the culprits. I removed them and it works. Thanks.

http://stackoverflow.com/a/24584879
answers question: http://stackoverflow.com/q/24583782
type: Answer
score: 0
has body: Print your array a object using Arrays utility. Program: public class TestArray { public static void main(String[] args) { int i, j, temp; int a[] = { 10, 5, 7, 98, 45, 34, 38, 56, 34, 93 }; for (i = 0; i &lt; a.length; i++) { for (j = i + 1; j &lt; a.length - 1; j++) { if (a[i] &gt; a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; i++; } } } System.out.println(Arrays.toString(a)); } } Output: [5, 7, 10, 45, 34, 38, 56, 34, 98, 93]

http://stackoverflow.com/comment/37978371
has text: Even a 1ns difference becomes significant if repeated a few billion times.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24527232

http://stackoverflow.com/comment/37955036
comment on: http://stackoverflow.com/a/24514971
type: Comment
has text: @Peter thanks, but the output comes in boxes like def ab. i want the first letter 'c' as a 'g' and the fifth letter 'g' as a 'd'. thanks
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37950777
type: AnswerComment
type: Comment
has text: hmm thanks, this will be .eb_extensions then what a pain I really dislike trying to deal with custom configuration files such as this.
comment on: http://stackoverflow.com/a/24512350
score: 0

http://stackoverflow.com/a/24696125
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24578375
score: 4
answers question: http://stackoverflow.com/q/24578375
type: Answer
has body: I finally managed to get the installation right! Here's how you do it: Install the COMODO certificates into your keystore wit this command: keytool -import -trustcacerts -alias &lt;filename&gt; -file &lt;filename&gt;.crt -keystore domain.keystore in the following order: » Root: AddTrustExternalCARoot.crt » Intermediate 1: COMODOAddTrustServerCA.crt » Intermediate 2: COMODOExtendedValidationSecureServerCA.crt Then install your domain certificate: keytool -import -trustcacerts -alias mykey -file yourDomainName.crt -keystore domain.keystore You should use the same alias instead of mykey, that you used to generate your keystore. If you do everything correctly, you should get this output: Certificate reply was installed in keystore Anything else means, you probably didn't use the correct alias. The final thing you need to do is to modify your standalone.xml like this: &lt;connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true"&gt; &lt;ssl name="&lt;domain&gt;-ssl" key-alias="&lt;domain&gt;" password="******" certificate-key-file="../standalone/configuration/&lt;domain&gt;.keystore"/&gt; &lt;/connector&gt; And you should be good to go!

http://stackoverflow.com/a/53198801
score: 0
answers question: http://stackoverflow.com/q/24544197
type: Answer
has body: One option to avoid the creation of "WithBlobs" subclasses is to specify &lt;columnOverride/&gt; to use non-Blob jdbc types in your generator config for the Blob columns. So, in the example of a TEXT column named "bar" in your table, you can specify VARCHAR instead: &lt;table tableName='foo' domainObjectName='Foo'&gt; &lt;property name='useActualColumnNames' value='true' /&gt; &lt;columnOverride column="bar" property="bar" jdbcType="VARCHAR" /&gt; &lt;/table&gt;

http://stackoverflow.com/comment/70769149
comment on: http://stackoverflow.com/a/28304164
type: Comment
score: 0
has text: container should be WeakReference<View>. The Context (your activity) contains a reference to the recycler view, which contains a reference to the view holder which, in this case, has a reference back to the context.
type: AnswerComment

http://stackoverflow.com/comment/37805645
comment on: http://stackoverflow.com/q/24433206
has text: Is it possible for the labels with Gar_1 and noGar to be ordered differently? i.e.: can a label with noGar come *before* that same label with Gar_1? Also, can there be more than 2 occurrences of a given label?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37905757
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24487587
type: AnswerComment
has text: I thought of this solution. But i want to know this for my knowledge that is there any direct way to know that script is expecting a input from user?

http://stackoverflow.com/comment/38015851
type: Comment
type: QuestionComment
has text: @MadProgrammer Right! However, he should use something like RMI in java, or an EJB application.
comment on: http://stackoverflow.com/q/24547262
score: 0

http://stackoverflow.com/a/24502222
accepted answer of: http://stackoverflow.com/q/24502158
score: 0
has body: what about adding a players string array String[] playerName = {"Player One", "Computer"}; Then printing in the for loop with the statement System.out.println(playerName[player]);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24502158
type: Answer
has comment: http://stackoverflow.com/comment/37948861

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/24554465

http://stackoverflow.com/comment/38050585
type: Comment
has text: Unfortunately this is no longer about the original question, as your problem is now sending information from one Activity to another through Extras. We like to keep questions and comments on topic here at StackOverflow. The last thing I can see now is that you your line `myIntent.putExtra(Country, position);` is now wrong and should be `myIntent.putExtra("Country", position);`. I hope you are able to fix it! Don't hesitate to ask another question about any new problems you have.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24565393

http://stackoverflow.com/q/24565020
score: 1
tagged with: string
favorite count: 0
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/61732018
has comment: http://stackoverflow.com/comment/38076740
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/38049313
type: UnansweredQuestion
upvote count: 1
type: Question
has title: split xml string using java
tagged with: java
has comment: http://stackoverflow.com/comment/38052170
has comment: http://stackoverflow.com/comment/38051106
has comment: http://stackoverflow.com/comment/38049524
has body: I have sample xml string textAtextB I want to split/traverse this xml using java split function to have an array where each element and its values are placed one after the other, so that I could manipulate them easily. I tried split("(?=<)|(?<=>)") but this is returning me root elements as well as closing tags in the array along with one element (additional space string ). Thanks in advance (Option of chosing XML parser is not feasible right now ).
has answer: http://stackoverflow.com/a/24566273
tagged with: split
has comment: http://stackoverflow.com/comment/38048929
has comment: http://stackoverflow.com/comment/38049029
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/37876679
type: Comment
has text: this returns one it must be the query but i can't see what is wrong with it. tnx
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24472409

http://stackoverflow.com/q/24524820
has comment: http://stackoverflow.com/comment/37973622
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24524896
has title: Method.invoke throws java.lang.IllegalArgumentException: wrong number of arguments
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/24525033
has answer: http://stackoverflow.com/a/24524949
has answer: http://stackoverflow.com/a/24524925
has body: public class ReflectionTest { public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { // TODO Auto-generated method stub ReflectionTest t = new ReflectionTest(); Method method[]= t.getClass().getMethods(); System.out.println(method.length); for(int i=0;i&lt;=method.length;i++){ method[i].invoke(t); } } public void abc(){ System.out.println("abc"); } public void xyz(){ System.out.println("XYZ"); } } Result shows: abc xyz Exception in thread "main" java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.selenium.test.ReflectionTest.main(ReflectionTest.java:21) Please help me how to handle this
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24524946
score: 2

http://stackoverflow.com/q/24527793
answer count: 1
has comment: http://stackoverflow.com/comment/37979192
has comment: http://stackoverflow.com/comment/37979049
score: 0
has comment: http://stackoverflow.com/comment/37979071
accepted answer: http://stackoverflow.com/a/24528155
has title: How can I have a writable text box?
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37979024
has answer: http://stackoverflow.com/a/24528155
has body: Using pure java, I would like to have a player press a JButton, have a text box pop up which they can type in, and then have a certain action happen when the player presses "Enter". How could I do this? I have not yet attempted this because I do not know where to start, however my current code is package Joehot200; import java.awt.Color; import java.awt.EventQueue; import java.awt.Image; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.EOFException; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.net.URLConnection; import javax.swing.ImageIcon; import javax.swing.JMenu; import javax.swing.JMenuBar; public class Main extends JFrame { static boolean start = false; private JPanel contentPane; /** * Launch the application. */ static Main frame = null; String version = "0.4"; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { frame = new Main(); frame.setVisible(true); frame.setTitle("Privateers"); } catch (Exception e) { e.printStackTrace(); } } }); TerrainDemo.startGame(); } boolean cantConnect = false; /** * Create the frame. */ public Main() { setExtendedState(JFrame.MAXIMIZED_BOTH); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); final JButton btnEnterBattlefield = new JButton("Enter battlefield!"); btnEnterBattlefield.setForeground(Color.red); //btnEnterBattlefield.setBackground(Color.green); //btnEnterBattlefield.setOpaque(true); menuBar.add(btnEnterBattlefield); btnEnterBattlefield.addActionListener(new ActionListener() { public void ac…

http://stackoverflow.com/q/24524823
possible better answer: http://stackoverflow.com/a/24525458
tagged with: java
has answer: http://stackoverflow.com/a/24525458
has answer: http://stackoverflow.com/a/24525372
downvote count: 1
type: Question
score: -1
tagged with: eclipse
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/24525372
has comment: http://stackoverflow.com/comment/37973657
has comment: http://stackoverflow.com/comment/37974212
favorite count: 0
has comment: http://stackoverflow.com/comment/37973588
tagged with: android
has title: The third link is not working
has comment: http://stackoverflow.com/comment/37973627
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I created a button to take me to another page and in that other page, there is another button that takes to another page, so page1, page2 and page3 that it's not working with me, check http://oi62.tinypic.com/2m7g4et.jpg when I click on "Fish guide" it takes me to the other one which has another button "Fish", when I click on "Fish" it doesn't take me to the 3rd page! activity_main.xml fishguide.xml <?xml version="1.0" encoding="utf-8"?> fish.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:src="@drawable/bala" /> <TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:text="Balabanka" android:textSize="18sp" android:textStyle="italic" /> MainActivity.java package com.d.di; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { Button button3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button3 = (Button) findViewById(R.id.fishguide); button3.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, PageThree.class); startActivity(intent); } }); } } PageThree.java package com.d.di; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class PageThree extends Activity { Button button3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fishguide); } } I did the third page, it runs but it was .. wrong MainActivity2.java package com.d.di; import android.a…

swap
tags question: http://stackoverflow.com/q/24531396
type: Tag
tag name: swap

http://stackoverflow.com/a/24529643
has comment: http://stackoverflow.com/comment/37982535
score: 0
answers question: http://stackoverflow.com/q/24529486
has comment: http://stackoverflow.com/comment/38007230
type: Answer
has body: I'm not sure, but I think that exists getNumericalCellValue() or getIntegerCellValue() which returns what you want.

http://stackoverflow.com/a/24617287
has comment: http://stackoverflow.com/comment/38148611
has comment: http://stackoverflow.com/comment/38148902
has comment: http://stackoverflow.com/comment/38148666
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24584369
has body: I think your issue is that you are using the this keyword inside the constructor. See Java - Leaking this in constructor. As the linked answer says, "An object is considered to be completely initialized when its constructor finishes. A thread that can only see a reference to an object after that object has been completely initialized is guaranteed to see the correctly initialized values for that object's final fields". No such guarantee if you leak this to another thread in the constructor! Also 'at the end of the constructor' may be reordered by the VM." My guess is that world.worldrenderer.getShader("punchShockWave").setListener is the other thread that now has access to an incompletely constructed object. I'd recommend finding a way to call the above setListener method after your constructor has completed. UPDATE I see that the power field is not final, so that may invalidate my hypothesis, as the linked question seems to indicate this problem holds for final fields only; however, I still would attempt to wait until after the constructor completes before passing this to another object. Maybe try it out and see if it fixes the bug.
type: Answer
answers question: http://stackoverflow.com/q/24584369
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38148982

http://stackoverflow.com/comment/38041622
type: QuestionComment
has text: Could you listen for the event of the button press and have that call the function instead? That's the normal way to do it.
score: 4
comment on: http://stackoverflow.com/q/24561098
type: Comment

http://stackoverflow.com/comment/37900307
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24484776
has text: Is this a problem even if you use maven directly from a command line?

http://stackoverflow.com/comment/37931034
type: Comment
comment on: http://stackoverflow.com/a/24501314
score: 0
has text: Ok, I used ProcessBuilder but I'm getting Access is Denied. Any suggestions?
type: AnswerComment

http://stackoverflow.com/a/24587939
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38091186
downvote count: 0
answers question: http://stackoverflow.com/q/24587919
has comment: http://stackoverflow.com/comment/38091173
type: Answer
has body: btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JPanel contentPane = new ListofDuties2(myFrame); myFrame.getContentPane().removeAll(); myFrame.setContentPane(contentPane); myFrame.getContentPane().revalidate(); myFrame.setVisible(true); }} ); You forgot a ); in the end Also call revalidate()

http://stackoverflow.com/q/24492061
has title: The volatile key word and memory consistency errors
has answer: http://stackoverflow.com/a/24492458
has comment: http://stackoverflow.com/comment/37914759
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37914208
has comment: http://stackoverflow.com/comment/37914530
has body: In the oracle Java documentation located here, the following is said: Atomic actions cannot be interleaved, so they can be used without fear of thread interference. However, this does not eliminate all need to synchronize atomic actions, because memory consistency errors are still possible. Using volatile variables reduces the risk of memory consistency errors, because any write to a volatile variable establishes a happens-before relationship with subsequent reads of that same variable. This means that changes to a volatile variable are always visible to other threads. What's more, it also means that when a thread reads a volatile variable, it sees not just the latest change to the volatile, but also the side effects of the code that led up the change. It also says: Reads and writes are atomic for reference variables and for most primitive variables (all types except long and double). Reads and writes are atomic for all variables declared volatile (including long and double variables). I have two questions regarding these statements: "Using volatile variables reduces the risk of memory consistency errors" - What do they mean by "reduces the risk", and how is a memory consistency error still possible when using volatile? Would it be true to say that the only effect of placing volatile on a non-double, non-long primitive is to enable the "happens-before" relationship with subsequent reads from other threads? I ask this since it seems that those variables already have atomic reads.
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24492621
upvote count: 10
has answer: http://stackoverflow.com/a/24496258
has comment: http://stackoverflow.com/comment/37914197
type: Question
has comment: http://stackoverflow.com/comment/37914092
has comment: http://stackoverflow.com/comment/37914073
has comment: http://stackoverflow.com/comment/37919658
answer count: 6
linked to: http://stackoverflow.com/q/13598359
has comment: http://stackoverflow.com/comment/37914139
has answer: http://stackoverflow.com/a/31854205
has comment: http://stackoverflow.com/comment/37913773
tagged with: volatile
accepted answer: http://stackoverflow.com/a/24496258
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24493343
possible better answer: http://stackoverflow.com/a/24492561
has comment: http://stackoverflow.com/comment/37914350
tagged with: multithreading
has answer: http://stackoverflow.com/a/24492561

http://stackoverflow.com/q/24492385
tagged with: java
has body: I have a simple Java class that runs in a look, doing something. public class SomeClass{ public int counter = 0; public void doSomehing(){ while(true){ doSomethingElse(); counter++; } } I would like to execute some code only when the Java program is forced to stop (e.g. by hitting a terminate button in the IDE or when stopping the program with the operating system (e.g. writing the counter to a file). Is this possible? Or is the very nature of overwriting Java with a forced exit not allowing for such a exit behavior?
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37915106
has title: Executing code at forced system exit
has comment: http://stackoverflow.com/comment/37914943
score: 0
has comment: http://stackoverflow.com/comment/37938905
linked to: http://stackoverflow.com/q/19639319
favorite count: 0
duplicate of: http://stackoverflow.com/q/19639319
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/38136421
type: Comment
comment on: http://stackoverflow.com/q/24575110
score: 0
has text: Incorrect, docx4j is a Java library which makes use of OpenXML.
type: QuestionComment

http://stackoverflow.com/a/24461937
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24453176
type: Answer
has body: As mentioned in this answer, you should be able to use bracket notation to access 'dynamic' properties like so: &lt;display:table id="resultsRow" name="${actionBean.list}"&gt; &lt;c:forEach items="${actionBean.anotherList}" var="columnName"&gt; &lt;display:column sortable="true" property="${resultsRow[columnName]}"/&gt; &lt;/c:forEach&gt; &lt;/display:table&gt;
downvote count: 0

http://stackoverflow.com/a/24470294
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24470288
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/37872661
downvote count: 0
has comment: http://stackoverflow.com/comment/37872687
score: 3
has body: You have three enum constants ENUM1(1), ENUM2(2), ENUM3(3); For each constant, the constructor needs to be invoked. This is normal behavior. The constants are all initialized when the enum class is loaded and initialized.
accepted answer of: http://stackoverflow.com/q/24470288

http://stackoverflow.com/q/24523246
score: 1
tagged with: java
tagged with: rsa
upvote count: 1
type: Question
has title: .java.security.NoSuchAlgorithmException: algorithm RSA/PKCS1 is not available from provider Cryptix
answer count: 1
downvote count: 0
has body: I am using jdk1.7_60 and apache tomcat I deployed my web application I got following error java.security.NoSuchAlgorithmException: algorithm RSA/PKCS1 is not available from provider Cryptix at xjava.security.IJCE.getClassCandidate(IJCE.java:463) at xjava.security.IJCE.getImplementationClass(IJCE.java:416) at xjava.security.IJCE.getImplementation(IJCE.java:373) at xjava.security.Cipher.getInstance(Cipher.java:492) at xjava.security.Cipher.getInstance(Cipher.java:455) at COM.claymoresystems.ptls.SSLClientKeyExchange.encode(SSLClientKeyExchange.java:77) at COM.claymoresystems.ptls.SSLHandshake.sendHandshakeMsg(SSLHandshake.java:149) at COM.claymoresystems.ptls.SSLHandshake.sendHandshakeMsg(SSLHandshake.java:144) at COM.claymoresystems.ptls.SSLHandshakeClient.sendClientKeyExchange(SSLHandshakeClient.java:400) at COM.claymoresystems.ptls.SSLHandshakeClient.processTokens(SSLHandshakeClient.java:148) at COM.claymoresystems.ptls.SSLHandshake.processHandshake(SSLHandshake.java:135) at org.globus.gsi.gssapi.GlobusGSSContextImpl.initSecContext(GlobusGSSContextImpl.java:483) at org.globus.gsi.gssapi.net.GssSocket.authenticateClient(GssSocket.java:102) at org.globus.gsi.gssapi.net.GssSocket.startHandshake(GssSocket.java:140) at org.globus.gsi.gssapi.net.GssSocket.getOutputStream(GssSocket.java:161) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:433) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2745) at org.apache.axis.client.Call.invoke(Call.java:2728) at org.apache.axis.client.Call.invoke(Call.java:2405) at org.apache.axis.client.Call.invoke(Call.java:2327) at org.apache.axis.client.Call.invoke(Call.java…
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24523285

http://stackoverflow.com/comment/38008737
score: 0
comment on: http://stackoverflow.com/q/24543108
type: Comment
type: QuestionComment
has text: The ping is correct. What version of JavaMail are you using?

http://stackoverflow.com/a/40461917
has comment: http://stackoverflow.com/comment/68169225
answers question: http://stackoverflow.com/q/24491910
has comment: http://stackoverflow.com/comment/68169529
type: Answer
has body: import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.ui.Label; Label htmlLabel = new Label(" Header text "); htmlLabel.setContentMode(ContentMode.HTML); This piece of code shows needed classes and calls to have HTML markup rendered properly in a vaadin's Label.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/24474118
downvote count: 0
answers question: http://stackoverflow.com/q/24474063
upvote count: 2
type: Answer
score: 2
has body: Although this is not a question that is normally answered on SO, here's what I've seen and heard: A project's SW development plan must define how design is being done, and if UML is used, how an update to the SW must be made. That plan can define that the UML is "one shot" - so it is indeed forgotten after the first design progresses into code. OTOH, a strict follow-up rule and ensuing checking may require and guarantee that the UML design is updated during bug fixes (if required) or more extensive changes. (More often than not, you may even have to go back to requirements and update there, too.) A completely different approach is to generate code from UML - that way you never change the code. Whether this works or not, given the potential differences between UML's expressiveness and what and how a language like Java or C++ provide to implement the semantics of the various diagrams, is a question I'd dearly love to have answered on more reliable data than a salesman's pitch.

http://stackoverflow.com/comment/38024453
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24545844
has text: Yes i used below code DesiredCapabilities capabilities = DesiredCapabilities .internetExplorer(); capabilities .setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); File file = new File(System.getProperty("user.dir") + "//BrowserExe//IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); driver = new InternetExplorerDriver(capabilities);

http://stackoverflow.com/a/24510107
has comment: http://stackoverflow.com/comment/37946566
has body: You can do this much much shorter using replaceAll(): public static String toLastFirst(String firstLast) { return firstLast.replaceAll("(.*) (.*)", "$2, $1"); } This should work exactly like your implementations. If the string contains a space, the expression will match, and switch the first and second part, and add a ,. If it doesn't contain a space, the string remains unchanged.
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/24510021
downvote count: 0
has comment: http://stackoverflow.com/comment/37946588
type: Answer
has comment: http://stackoverflow.com/comment/37946219

http://stackoverflow.com/a/24566533
type: Answer
downvote count: 0
score: 1
has body: Looking at the source code the values for the KeyEvent fields are public static final int VK_A = 65; public static final int VK_B = 66; ... public static final int VK_Z = 90; which are just ascii values for A-Z. You can cast the char to an int to get its ascii value which means you could do something like this. public static int charToNum(char inputChar) { if(inputChar == '!') { return(KeyEvent.VK_EXCLAMATION_MARK); } else if (inputChar == ' ') { return(KeyEvent.VK_SPACE); } if (Character.isUpperCase(inputChar)) { return (int) inputChar + 10000; } else { return (int) inputChar - 32; } } however any non alphabet character will have to have its own special case like the exclamation mark, and space.
upvote count: 1
answers question: http://stackoverflow.com/q/24566230

http://stackoverflow.com/comment/38058931
comment on: http://stackoverflow.com/q/24570005
score: 0
type: Comment
has text: I think you will need to show the processing logic and how is it distributed. But I may be wrong.
type: QuestionComment

http://stackoverflow.com/a/24494469
upvote count: 1
answers question: http://stackoverflow.com/q/24493495
downvote count: 0
has body: If you have multiple threads writing using same logger instance, you have no guarantee of ordering. Take a look at the logback Logger implementation There is no synchronisation inside this method. It's possible that thread1 calls logger.info("1"), a moment later thread2 calls logger.info("2"), but the appender will receive the "2" before the "1". If you need a ordering guarantee, you have to synchronise the calls to logger.info() yourself.
type: Answer
score: 1

http://stackoverflow.com/comment/37956450
type: Comment
score: 0
has text: The weird thing the code in mdb has not been excecuted...
comment on: http://stackoverflow.com/q/24515631
type: QuestionComment

http://stackoverflow.com/a/24544278
downvote count: 0
answers question: http://stackoverflow.com/q/24544229
has body: You could try using something like... XPathExpression expr = xpath.compile("//Communication/Number | //Identification/FileID"); Which should combine the results of each query. In my (simply) test, I got 3 matches (2 for Communication/Number and 1 for Identification/FileID) Updated The intended result was to return a NodeList, for example... NodeList nl = (NodeList)expr.evaluate(inputStr, XPathConstants.NODELIST); for (int index = 0; index &lt; nl.getLength(); index++) { Node node = nl.item(index); String value = node.getTextContent(); System.out.println(value); }
has comment: http://stackoverflow.com/comment/76659292
type: Answer
has comment: http://stackoverflow.com/comment/38099529
has comment: http://stackoverflow.com/comment/38099292
has comment: http://stackoverflow.com/comment/38010940
upvote count: 5
has comment: http://stackoverflow.com/comment/38010887
has comment: http://stackoverflow.com/comment/38011060
has comment: http://stackoverflow.com/comment/38012527
score: 5
has comment: http://stackoverflow.com/comment/76658981

http://stackoverflow.com/q/24446731
has comment: http://stackoverflow.com/comment/37846165
tagged with: jpa
type: UnansweredQuestion
tagged with: sql
has title: JPA: join tables but after that still makes sequence of queries
type: Question
has comment: http://stackoverflow.com/comment/37828798
answer count: 2
tagged with: join
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24450142
has body: I'm sorry if that is too silly or not complete. I want to make one query, joining all tables at once. @NamedQuery(name="User.findByLogin", query="SELECT u FROM User u " + "left outer join fetch u.userInfo ui " + "left outer join fetch u.freeEvents fe " + "left outer join fetch u.paidEvents pe " + "left outer join fetch fe.action fea " + "left outer join fetch pe.action pea " + "where u.login = :login") and it works (no errors, no warnings, sql generated), and SQL is fine, and all appropriate data is retrieved in mysql console. But after that it makes many requests to find actions by id, and it looks like hibernate doesn't know that it had already fetched all needed data or have no idea what to do with it. All other similar joins with two tables are valid and work as expected. By the way, freeEvent and paidEvent are @Inheritance(strategy=InheritanceType.SINGLE_TABLE), they differs by "rate_type" column. I tried both eager and lazy fetch, and hibernate @Fetch annotation. The sql itself: select * #---lots of fields here, all valid from Users user0_ left outer join UserInfos userinfo1_ on user0_.`user_info_id`=userinfo1_.id left outer join Events freeevents2_ on user0_.id=freeevents2_.`user_id` and freeevents2_.rate_type=1 left outer join FreeActions freeaction4_ on freeevents2_.`action_id`=freeaction4_.`id` left outer join Events paidevents3_ on user0_.id=paidevents3_.`user_id` and paidevents3_.rate_type=2 left outer join PaidActions paidaction5_ on paidevents3_.`action_id`=paidaction5_.`id` where user0_.`login`='testuser' Question: where is the problem? Are my classes poorly annotated, or that is a normal hibernate behaviour, where to find a solution? Entities: (without getters, setters and fields that are not mapped by anyone) @Entity @Table(name="Events") @PersistenceUnit(name="default") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="rate_type", discriminatorType=DiscriminatorType.INTEGER) public class AbstractEvent { @Id @GeneratedVa…
has answer: http://stackoverflow.com/a/24447284

http://stackoverflow.com/a/24540739
type: AcceptedAnswer
type: Answer
has body: transform returns a new Collection that transforms elements in the underlying collection only as needed. So your Function will be invoked once for each element in target as you iterate the returned Collection, for example. Judging by your code, what you really want to be doing is much simpler (assuming removeUnnecessaryProperties returns the same object that's passed to it): for (MyBean bean : target) { removeUnnecessaryProperties(bean); }
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24540670
score: 5
accepted answer of: http://stackoverflow.com/q/24540670

http://stackoverflow.com/q/24586840
answer count: 1
has comment: http://stackoverflow.com/comment/38089352
has body: I have a method in Java that parses some data from a database ArrayList&lt;Object&gt; nodeList = new ArrayList&lt;Object&gt;(); public void parseResults() throws SQLException, ListEmptyException, NoRecognisableCharacterException{ // parses records from a query. ONLY ONE COLUMN while(getResultSet().next()){ for(int i = 1; i &lt;= getNumberOfColumns(); i++){ switch(getColumnType()){ //According to the datatype, I call the proper method get[DataType] of resultSet case 0:throw new ListEmptyException(); case 4:nodeList.add(getResultSet().getInt(i));break; case 12:nodeList.add(getResultSet().getString(i).trim());break; default:throw new NoRecognisableCharacterException(); } } } } I was told not to use ArrayList&lt;Object&gt; to store data of different type. I have to create an entity that parses the appropriate datatype instead. I don't want to overload the method for every single datatype (there are plenty) neither create separate classes that just change a single get[DataType] method, nor have that switch loop inside for loop, nor have multible instances of nodeList according to datatype. Is there a way to make that method work for every datatype? Should generics do in that case? Thank you in advance.
has title: Parse results from database table to a generic collection
tagged with: generics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24587332
tagged with: collections
accepted answer: http://stackoverflow.com/a/24587332
type: Question
tagged with: java
score: 0

http://stackoverflow.com/q/24545906
has comment: http://stackoverflow.com/comment/38014203
has comment: http://stackoverflow.com/comment/38022981
has comment: http://stackoverflow.com/comment/38013765
score: 0
has comment: http://stackoverflow.com/comment/38023575
tagged with: runtime.exec
tagged with: java
tagged with: process
has title: Runtime.getRuntime().exec() is not working as expected
answer count: 1
has comment: http://stackoverflow.com/comment/38013932
has comment: http://stackoverflow.com/comment/38013855
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38013877
has answer: http://stackoverflow.com/a/24546657
has body: I am trying to read a pdf created by phantomjs from an html file on the file system. I have done the following. process = Runtime.getRuntime().exec(phantomLocation + scriptLocation + inputFile + " " + destinationFileString); process.waitFor(); I am specifying phantomLocation, js script location, inputHTML and destinationFileString(pdf to be generated and served). I am writing the following servlet code to read the pdf generated and and send as response. InvokePhantom phantom = new InvokePhantom(inputHTMLFileName, destinationFile); process.create();//call the above piece of code //Set the response headers response.setContentType("application/pdf"); String headerKey = "Content-Disposition"; String headerValue = String.format("attachment; filename=\"%s\"", attchmentName); response.setHeader(headerKey, headerValue); //For debugging File file = new File(destinationFile); System.out.println("destinationFile exists = " + file.exists()); //Write to outputStream fileInputStream = new FileInputStream(destinationFile); outputStream = response.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = fileInputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); } outputStream.flush(); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (writer != null) { writer.close(); } if (outputStream != null) { outputStream.close(); } } catch (IOException e) { e.printStackTrace(); } } But the pdf file being generated by the phantomjs is incomplete. When run from command line phantomjs is creating the pdf properly(from the same html). But when called from java code it is not working properly. How to resolve the issue?
type: Question

http://stackoverflow.com/q/24490074
upvote count: 2
type: UnansweredQuestion
tagged with: web-services
has title: How to achieve WS-Security in Android over SOAP Service
tagged with: java
type: Question
score: 2
downvote count: 0
favorite count: 0
has body: We' re trying to call the SOAP Web Service securely from Android. Have utilized KSoap2 library to consume the Web Service. However achieving the message level security with the utilization of Digital Certificate has been a big Question mark? Like to know if KSoap2 supports WS-Security with Digital Certificates? Alternative to KSoap2 could be easyWSDL [which Consumes Soap Services by generating Stubs] but does easyWSDL supports WS-Security?
tagged with: security
tagged with: android
tagged with: soap
answer count: 0

http://stackoverflow.com/comment/38060438
score: 0
has text: @NikhilTalreja I don't have access to the text and would prefer to use the standard properties of the document. Word seems to store this information (if for example I open it in MS Word and go to File > Properties there is a field "Characters" that displays exactly the information I want, however it is not available from POI).
type: Comment
comment on: http://stackoverflow.com/q/24571072
type: QuestionComment

http://stackoverflow.com/comment/38548002
type: Comment
comment on: http://stackoverflow.com/a/24498542
score: 0
type: AnswerComment
has text: Thanks for the hint about the objectID! With this I found out that the user object was overwritten with another user object that didn't match in the query.

http://stackoverflow.com/comment/38040636
comment on: http://stackoverflow.com/a/24559900
type: Comment
has text: guys i told you i looking for something like you mentioned to use inside class aka interceptor. I can't pass request parameter to this in several causes, so i would to know is there any another solutions.
score: 0
type: AnswerComment

playstation3
tags question: http://stackoverflow.com/q/24499833
type: Tag
tag name: playstation3

http://stackoverflow.com/comment/38063244
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24572867
has text: What about http://stackoverflow.com/questions/5217611/the-mvc-pattern-and-swing
score: 0

http://stackoverflow.com/comment/38062455
has text: Why reinvent the wheel? Spring Data JPA already does all that and more. And for the Spring haters Spring Data JPA works fine in a plain JEE environment also no Spring (apart from the internal usage of Spring Data JPA) needed.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24572092
type: QuestionComment

http://stackoverflow.com/comment/37900253
comment on: http://stackoverflow.com/q/24484661
score: 0
has text: Also, try to format your code more clearly. Currently the lines are indented a bit randomly. Fixing this very minor issue will make it easy to read (and as a result fix) your code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37806840
type: Comment
type: QuestionComment
score: 3
has text: Of course an `enum` would be much simpler, and faster ;)
comment on: http://stackoverflow.com/q/24434566

http://stackoverflow.com/a/24445330
has body: First of all,revision of BASIC DIFFFERENCES :- Variables declared in a Java interface is by default final. An abstract class may contain non-final variables. Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected, etc.. Java interface should be implemented using keyword “implements”; A Java abstract class should be extended using keyword “extends”. An interface can extend another Java interface only, an abstract class can extend another Java class and implement multiple Java interfaces. A Java class can implement multiple interfaces but it can extend only one abstract class. Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists. In comparison with java abstract classes, java interfaces are slow as it requires extra indirection. Consider using abstract classes if any of these statements apply to your situation: You want to share code among several closely related classes. You expect that classes that extend your abstract class have many common methods or fields, or require access modifiers other than public (such as protected and private). You want to declare non-static or non-final fields. This enables you to define methods that can access and modify the state of the object to which they belong. Consider using interfaces if any of these statements apply to your situation: You expect that unrelated classes would implement your interface. For example, the interfaces Comparable and Cloneable are implemented by many unrelated classes. You want to specify the behavior of a particular data type, but not concerned about who implements its behavior. You want to take advantage of multiple inheritance of type. (Taken from Oracle's Official Tutorials).
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37826312
has comment: http://stackoverflow.com/comment/38469305
has comment: http://stackoverflow.com/comment/37826375
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24445247
has comment: http://stackoverflow.com/comment/37826273
answers question: http://stackoverflow.com/q/24445247
type: Answer

http://stackoverflow.com/comment/37878510
has text: Correct answer- "It doesn't matter because the question is stupid. Anyone using tricks in production code instead of using an if statement deserves to be fired."
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24473430
score: 37

http://stackoverflow.com/q/24579038
has answer: http://stackoverflow.com/a/24579198
has comment: http://stackoverflow.com/comment/38074906
type: UnansweredQuestion
downvote count: 2
tagged with: cpu
score: 2
has comment: http://stackoverflow.com/comment/38077671
has body: I know how volatile works but question about how especially. Every often I hear that persons which сonsider themselves experts multithreading like debate about how volatile works. Usually for novice persons explain volatile like: every thread has own cach where different variables can store but volatile don't cached. "experts" began try to be clever and said that it is absolutely wrong - volatile cashed in processor cash but volatile don't cash in processor register. I cannot find information about it. Can you confirm or decline this opinion? P.S. I know that java programmer should know JMM for resolve volatile related questions but I want to get exact answer.
tagged with: java
tagged with: concurrency
tagged with: caching
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/24579114
tagged with: volatile
has comment: http://stackoverflow.com/comment/38074947
has title: Is it truth that volatile cannot be cached in CPU register?
favorite count: 0
linked to: http://stackoverflow.com/q/6259745

http://stackoverflow.com/comment/37957129
has text: Not in Java, no. You may be thinking of Generics. Reflection overheads have been getting lower and lower, and there are some Hotspot optimisations that can remove them entirely. But that is not common, yet.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24516026
type: Comment

http://stackoverflow.com/a/24545964
has comment: http://stackoverflow.com/comment/38013515
type: Answer
has body: From : http://www-03.ibm.com/systems/z/os/zos/tools/java/faq/javasecurityfaq.html You will see this error when an application issues a Service.getInstance(algorithm,provider) and the specified provider is not installed in the JVM. The installation instructions provided in How do I install the IBMJCECCA provider? can be used to install any provider as long as you know the package and class name.
score: 0
answers question: http://stackoverflow.com/q/24545574

http://stackoverflow.com/a/24716763
type: AcceptedAnswer
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24526460
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24526460
score: 3
has body: As the comments say, the full proper solution is a Scope. Assuming you've copied the implementation of SimpleScope from this article into your project, then here's what I'd do in your component. As you do above, I assume Foo and Bar are the objects you need created on a per-request basis, and X is the class of the thing you ultimately need Guice to create. I assume further that X has on it a method called doTheActualRequestLogic that is the method you wish to call to ultimately return back to the servlet: public class MyWebComponent { private final Provider&lt;X&gt; theGuiceCreatedObject; private final SimpleScope perRequestScope; public MyWebComponent() { perRequestScope = new SimpleScope(); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { install(new NonChangingModule()); bind(Foo.class).toProvider(SimpleScope.seededKeyProvider()) .in(perRequestScope); bind(Bar.class).toProvider(SimpleScope.seededKeyProvider()) .in(perRequestScope); } }); theGuiceCreatedObject = injector.getProvider(X.class); } // I assume methods called makeFoo and makeBar that can make // a Foo or Bar for a request // called by the web service to say "handle this request" public RequestResult handleRequest(DataToMakeFooAndBarWith requestData) { try { perRequestScope.enter(); perRequestScope.seed(Foo.class, makeFoo(requestData)); perRequestScope.seed(Bar.class, makeBar(requestData)); return theGuiceCreatedObject.get().doTheActualRequestLogic(requestData); } finally { perRequestScope.exit(); } } }

http://stackoverflow.com/comment/37862522
comment on: http://stackoverflow.com/q/24464905
has text: That link "how-to-set-a-timer" eplains how to create time supervision. This is a typical real-time task where something must be done before a deadline, or when you may not keep trying ad infinitum. Your requests ist fundamentally different: you want that code to start at (say) 0:00:00 and do whatever it was written to do and complete it exactly six seconds later ("slow down"). Don't confuse issues!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37940974
type: QuestionComment
has text: See related question http://stackoverflow.com/questions/3969713/java-xml-parser-for-huge-files.
score: 0
comment on: http://stackoverflow.com/q/24505945
type: Comment

http://stackoverflow.com/comment/38009702
has text: Just being rhetorical. If all the DisplayDeck class is doing is displaying one deck, it may seem extraneous. But what if the DisplayDeck class was expanded into a Dealer class, which has characteristics and behaviors of displaying the deck, but also beyond that, like collecting bets, paying winners, etc? I think the tutorial is trying to ease you into OO and if you are familiar with OO from other languages may seem odd.
score: 1
comment on: http://stackoverflow.com/q/24543594
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24574350
type: UnansweredQuestion
has body: I have 5 Keys which must not be removed/updated. I provide my own methods to add, get and remove keys of this HashMap. UnmodifiableMap will make ALL the keys read-only, so I can't use that either. I could maintain a List of these read-only keys and whenever add/remove method is called, I can refer this List and prevent the operation. But is there any other better way to achieve this ? Thanks in advance! EDIT: I know I can extend HashMap and override the put method. That's similar to what I said in the problem description above (Maintain a List of read-only keys and prevent operations on them). I thought there could be a way to merge an UnmodifiableMap in a HashMap such that the keys from UnmodifiableMap will remain read-only in the new HashMap and the other keys will have all operations supported on them.
score: 3
tagged with: hashmap
tagged with: java
has title: Is it possible to make some specific keys of a HashMap read-only?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24574539
downvote count: 0
has comment: http://stackoverflow.com/comment/38066121
has answer: http://stackoverflow.com/a/24574726
has comment: http://stackoverflow.com/comment/38065939
favorite count: 0
has comment: http://stackoverflow.com/comment/38066351
upvote count: 3

http://stackoverflow.com/comment/38119185
type: Comment
has text: Thanks. I am planning to use the Windows registry as of now because there is no opdate in the class path and also the application configuration file will also be within the application and hence cannot locate. Lets see how the registry thing works.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24583085

http://stackoverflow.com/a/25218023
accepted answer of: http://stackoverflow.com/q/24483233
has comment: http://stackoverflow.com/comment/106615645
has comment: http://stackoverflow.com/comment/51284212
answers question: http://stackoverflow.com/q/24483233
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/51271958
upvote count: 13
has comment: http://stackoverflow.com/comment/51266566
type: Answer
has comment: http://stackoverflow.com/comment/106609056
has comment: http://stackoverflow.com/comment/106650446
has comment: http://stackoverflow.com/comment/74912039
score: 13
downvote count: 0
has body: The suggestion by @khmarbaise works best and solves all problems. Just delete the project from Eclipse. Re-import as "Existing Maven Projects" and point it towards the directory that contains the project's pom.xml file. Let Eclipse's m2e plugin handle the rest Worked flawlessly for me. The following advice (taken from https://developers.google.com/appengine/docs/java/webtoolsplatform#maven) may only apply to GAE projects, but seems like it should be generally applicable (my project is GAE, so can't be sure): The directory at the root of the Maven project must not contain any of the following: 1. A subdirectory named target 2. A subdirectory named .settings 3. A file named .classpath 4. A file named .project

http://stackoverflow.com/comment/37880579
has text: something calls `requestList.add`, which is synchronized and calls the OP's `add` which calls `Collections.sort`. `requestList`'s monitor is held during the call.
type: Comment
comment on: http://stackoverflow.com/a/24472709
score: 0
type: AnswerComment

http://stackoverflow.com/q/24570807
has comment: http://stackoverflow.com/comment/38059969
type: Question
linked to: http://stackoverflow.com/q/2591098
tagged with: java
has answer: http://stackoverflow.com/a/24570878
has comment: http://stackoverflow.com/comment/38059933
has comment: http://stackoverflow.com/comment/38059940
tagged with: string
has comment: http://stackoverflow.com/comment/38060239
has title: Find a name in a string of Name Value Pairs and replace its value
has comment: http://stackoverflow.com/comment/38059913
score: 0
has comment: http://stackoverflow.com/comment/38060115
has comment: http://stackoverflow.com/comment/38060097
answer count: 3
has comment: http://stackoverflow.com/comment/38059765
has comment: http://stackoverflow.com/comment/38060257
tagged with: regex
has body: I have a string of the form: " { \"Name1\":\"Value1\",\"Name2\":\"Value2\",\"Name3\":\"Value3\" } " except with about 50 such pairs. I need to Search for some 10 names out of these 50 (I don't know their position, I only know the name) and replace it's corresponding Value with a string "newValue". How do I go about this? I though of finding the location of Name, let us say it was from char 30-40, then use a regex of type ( \" .* \" ) from char 40 onwards to find the complete size of Value. , Then I can replace. Sadly the some of the values themselves contain strings of type ( \" ...... \" ) and anything else (including commas, backslashes, quotes etc..)so I don't think this will work. Any suggestions?
favorite count: 0
has answer: http://stackoverflow.com/a/24571383
has comment: http://stackoverflow.com/comment/38060163
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24571183

http://stackoverflow.com/q/24484709
has comment: http://stackoverflow.com/comment/37904587
has comment: http://stackoverflow.com/comment/37902792
has comment: http://stackoverflow.com/comment/37904686
has comment: http://stackoverflow.com/comment/37904643
has comment: http://stackoverflow.com/comment/37901059
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37904760
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/37900474
type: Question
has answer: http://stackoverflow.com/a/24487675
has body: i have this code for create query and execute sql-procedure but i catch missing-exception public String generateQuery(Integer idAccount, Long[] phoneList, Date date){ StringBuilder query=new StringBuilder(); query.append("declare arr_pn owa_util.vc_arr;\n"); query.append("begin\n"); int idx = 1; for (Long p : phoneList) { query.append("arr_pn(" + idx + "):='" + String.valueOf(p) + "';\n"); idx++; } query.append("call LOC_MAINCLIENT.set_client_relations("); query.append("id_account_ =&gt; " + idAccount); query.append(", phone_number_list_ =&gt; arr_pn"); query.append(", dt_ =&gt; " + date); query.append("); end;"); return String.valueOf(query); } after that i get this query declare arr_pn owa_util.vc_arr; begin arr_pn(1):='12345'; arr_pn(2):='678970'; arr_pn(3):='5675675'; call LOC_MAINCLIENT.set_client_relations(id_account_ =&gt; 123, phone_number_list_ =&gt; arr_pn, dt_ =&gt; Sun Mar 24 21:54:00 NOVT 2013); end; what i did wrong?
accepted answer: http://stackoverflow.com/a/24487675
has title: SQL "missing in or out parameter at index"
answer count: 1
has comment: http://stackoverflow.com/comment/37900793
score: 0
has comment: http://stackoverflow.com/comment/37904359
tagged with: oracle-database
tagged with: sql

http://stackoverflow.com/comment/37813374
has text: enabled is false. Its just a protection against multiple instaces of this thread. The Thread starts normally and is running correctly. Log.d("",""); works correctly, but updating the UI doesnt work
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24438030

http://stackoverflow.com/comment/37963537
comment on: http://stackoverflow.com/q/24519259
score: 2
has text: @Fede that makes absolutely no sense. Regex is implemented by engines, and they have different capabilities. Saying you want the regex only is nonsensical. Even the link you provide to the tester has a "flavours" selector down the side that changes the engine being simulated.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37898164
type: QuestionComment
type: Comment
has text: What is `L1Stack` and why don't you just use the `char`s from the line? And why do you use `StringBuilder`s to do the jobs of `int`s?
score: 0
comment on: http://stackoverflow.com/q/24483551

http://stackoverflow.com/comment/38094019
comment on: http://stackoverflow.com/q/24580710
type: Comment
type: QuestionComment
has text: @X--I upvoted the wrong comment, but they're both yours, so it works out. Won't I sometime have to use something is SOME Java lib that isn't already inside Android Studio? Or is that just plain ignorant since they've loaded all that anyone would/could ever use? I'm so new at Android Studio that, before I asked my question, I didn't realize that `External Libraries` contains `rt.jar` and a whole lot more.
score: 0

http://stackoverflow.com/q/24441363
has body: Is it possible in Java to give a class or even its functions a new name at run time. By reading in the new names as arguments or on a configuration file when the program is started? UPDATE: Here is the purpose of this. I am using Java Script Engine to allow any JSR 223 compatible Scripting Language to access our API. Some of our clients are not used to using Java and it's naming conventions and would feel more comfortable using their own specific naming conventions. So I am required to give them the capability to dynamically change the API's class and function names without actually changing them in the code. It was suggested I use a Map and some sort of binding with a string name and the actual Java name e.g., map.put("Hello",HelloWorld.class) Object obj = new Hello(); which should be the same as, Object obj = new HelloWorld(); If this is not possible please tell me why. I need a solid Java expertise answer. This is out of my league and I need facts to tell people why this is not possible even though myself I am almost sure it's not possible. Possible Solution: Here is the closets solution I have come up with. Using this link, https://weblogs.java.net/blog/2005/08/10/reflection-and-dynamically-changing-classes I could add in the names at run time, use composition to create an Adapter Class, and then compile the file, and voila the Script Language folks could use their defined names instead of my API's Java names. Is this the only conceivable way to accomplish this? UPDATE 2: Here is another possible solution for anyone trying this too, http://asm.ow2.org/doc/faq.html That'll take you directly to their frequently asked questions which will have one for this exact problem.
linked to: http://stackoverflow.com/q/2897685
has answer: http://stackoverflow.com/a/44943150
has comment: http://stackoverflow.com/comment/37819473
accepted answer: http://stackoverflow.com/a/24442878
has comment: http://stackoverflow.com/comment/37819411
has comment: http://stackoverflow.com/comment/37821948
has comment: http://stackoverflow.com/comment/37839853
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37821855
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/37819396
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24442878
answer count: 2
has title: Can you dynamically rename a class name?
downvote count: 0
has comment: http://stackoverflow.com/comment/37819253
has comment: http://stackoverflow.com/comment/37819251
possible better answer: http://stackoverflow.com/a/44943150
favorite count: 0
has comment: http://stackoverflow.com/comment/37832866

http://stackoverflow.com/q/24455434
tagged with: java
has answer: http://stackoverflow.com/a/24455535
type: Question
linked to: http://stackoverflow.com/q/2098642
tagged with: graphics
has answer: http://stackoverflow.com/a/24455537
has answer: http://stackoverflow.com/a/24455645
score: 0
answer count: 3
has title: Java Swing Timer cannot be paused?
tagged with: timer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37845331
tagged with: swing
tagged with: 2d
has body: Is there anyway to pause a Java Swing Timer, i'm planning to implement a feature in this java 2D environment and want the ability to pause the movement graphics.

http://stackoverflow.com/a/24451378
has comment: http://stackoverflow.com/comment/37910156
has comment: http://stackoverflow.com/comment/37838826
has comment: http://stackoverflow.com/comment/37837257
has body: You can try this: ProcessBuilder pb2=new ProcessBuilder("/home/abhijeet/sample1.sh --ip=abc.txt --seqs=20"); Process script_exec = pb2.start(); OutputStream in = script_exec.getOutputStream(); in.write("abc".getBytes()); in.write("1".getBytes()); in.write("10".getBytes()); in.flush(); in.close(); This code writes abc, 1 and 10 to process input.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24450708
answers question: http://stackoverflow.com/q/24450708
has comment: http://stackoverflow.com/comment/37838977
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37837213
type: Answer

message-driven-bean
tags question: http://stackoverflow.com/q/24580794
tag name: message-driven-bean
type: Tag

http://stackoverflow.com/q/24437155
linked to: http://stackoverflow.com/q/5217611
has body: I have to create a program with graphical user interfaces which buttons perform certain things including the login and registration. I wanted to use the MVC pattern to create this project in such a way that the code remains "ordered" and clean. So I created 3 packages: Model, View and Controller. In Model there are several classes that define the objects (for example: User, Message, etc.). In View there are classes with the code created by NetBeans for GUI. I know that using the NetBeans GUI Builder you can create listeners to associate the various buttons. But this code listener is created in the same file as the View while I would like to separate files in the view from that of the controller. So I would have something like: Model: files that define the objects View: files that define the GUI Controller: file "manage" the GUI taking user input and process them But now in the files of the view there are both the GUI and the Controllers (listener). For example, this is the LoginView file: public class Login extends javax.swing.JFrame { /** Creates new form Login */ public Login() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); usernameLabel = new javax.swing.JLabel(); passwordLabel = new javax.swing.JLabel(); usernameField = new javax.swing.JTextField(); regButton = new javax.swing.JButton(); logButton = new javax.swing.JButton(); titleLabel = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .a…
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37812641
has comment: http://stackoverflow.com/comment/37811273
downvote count: 1
type: Question
tagged with: actionlistener
score: 1
tagged with: java
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/24437944
has title: How to split the GUI code from the code of the listener?
favorite count: 0

http://stackoverflow.com/q/24440251
answer count: 1
tagged with: graph
tagged with: layout
has title: layout a graph in JDesktopPane
type: UnansweredQuestion
has body: I have objects that build a graph. Each object is a node of the graph and represented by an JInternalFrame in the JDesktopPane. Now I want to layout the Frames correspondig to the graph. Diplaying the edges is not my problem, but to get proper positions for each Frame(Node). Have you an advice for a good aproach for this? I tried already to build an graph with the JUNG library, let JUNG calculate positions of nodes and transfere them to my swing components. But I am not satisfied with the solution as there result is kind of random. br Tobias
type: Question
has comment: http://stackoverflow.com/comment/37861303
has answer: http://stackoverflow.com/a/24443497
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37817294
linked to: http://stackoverflow.com/q/14123259
tagged with: swing

http://stackoverflow.com/q/24471890
score: 0
tagged with: java
tagged with: gae-search
has comment: http://stackoverflow.com/comment/37882289
type: Question
has body: I am trying to run a distance search to retrieve indexed locations near a given geopoint, but I always get zero matches even for a deployed version of the app. I tried to run the search through the App Engine Console as well, but still could not get any matches. This is my index: And these are query string and result: Could someone please help me figure out what is going wrong? Thank you so much for your help!!
tagged with: geospatial
tagged with: full-text-search
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine
downvote count: 2
has title: Why are distance searches using App Engine's Search Api returning no matches even in a production app?
has comment: http://stackoverflow.com/comment/37882100
answer count: 0

collections
tags question: http://stackoverflow.com/q/24576543
tags question: http://stackoverflow.com/q/24539261
tags question: http://stackoverflow.com/q/24454250
tags question: http://stackoverflow.com/q/24586840
tags question: http://stackoverflow.com/q/24508401
tags question: http://stackoverflow.com/q/24503398
tags question: http://stackoverflow.com/q/24435953
tags question: http://stackoverflow.com/q/24485690
tags question: http://stackoverflow.com/q/24464279
tags question: http://stackoverflow.com/q/24554049
tags question: http://stackoverflow.com/q/24541045
tags question: http://stackoverflow.com/q/24437736
tags question: http://stackoverflow.com/q/24487646
tags question: http://stackoverflow.com/q/24491808
tags question: http://stackoverflow.com/q/24530222
tags question: http://stackoverflow.com/q/24535323
type: Tag
tags question: http://stackoverflow.com/q/24523983
tags question: http://stackoverflow.com/q/24579455
tags question: http://stackoverflow.com/q/24520445
tags question: http://stackoverflow.com/q/24428748
tags question: http://stackoverflow.com/q/24555274
tags question: http://stackoverflow.com/q/24540624
tag name: collections
tags question: http://stackoverflow.com/q/24473364
tags question: http://stackoverflow.com/q/24579849
tags question: http://stackoverflow.com/q/24584642
tags question: http://stackoverflow.com/q/24488727
tags question: http://stackoverflow.com/q/24518353
tags question: http://stackoverflow.com/q/24528418
tags question: http://stackoverflow.com/q/24454822
tags question: http://stackoverflow.com/q/24529572

http://stackoverflow.com/a/24486860
has body: Hash map needs an exact key - accessing by a partial key is not possible, meaning that you would need to iterate all keys, check for match on "element2", and remove elements as you go: Iterator&lt;Map.Entry&lt;String,Object&gt;&gt; iter = map.entrySet().iterator(); while(iter.hasNext()){ Map.Entry&lt;String,Object&gt; entry = iter.next(); if (entry.key().contains("element2")) { iter.remove(); } }
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/24486767
downvote count: 0

http://stackoverflow.com/q/24557135
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: From the Apache Ant introduction it is said that Why another build tool when there is already make, gnumake, nmake, jam, and others? Because all those tools have limitations that Ant's original author couldn't live with when developing software across multiple platforms. Make-like tools are inherently shell-based: they evaluate a set of dependencies, then execute commands not unlike what you would issue on a shell. This means that you can easily extend these tools by using or writing any program for the OS that you are working on; however, this also means that you limit yourself to the OS, or at least the OS type, such as Unix, that you are working on. I don't understand this statement: "This means that you can easily extend these tools by using or writing any program for the OS that you are working on" And "Granted, this removes some of the expressive power that is inherent in being able to construct a shell command such as find . -name foo -exec rm {}," If someone could help me understand this please. Thanks
has title: General thing regarding Apache Ant introduction
tagged with: java
downvote count: 1
type: Question
tagged with: ant
score: -1
has answer: http://stackoverflow.com/a/24558898

http://stackoverflow.com/a/24447567
has comment: http://stackoverflow.com/comment/37830558
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24447193
has body: Since i noticed you're using solr, you need to understand that the query parser will split the query by whitespaces, and it takes precedence to your analyzer : so if you query for "foo bar" you will have the "foo" and "bar" passed separately through your analyzer chain. You can bypass this behavior by making "foo bar" a phrase query, adding the \"foo bar\" EDIT: for clarification, a phrase query will take precedence above the query parser whitespace splitting and is defined by wrapping a sequence of tokens inside quote characters
accepted answer of: http://stackoverflow.com/q/24447193
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37830758

http://stackoverflow.com/comment/37934926
score: 0
comment on: http://stackoverflow.com/q/24503599
type: QuestionComment
type: Comment
has text: possible duplicate of [Loading resources using getClass().getResource()](http://stackoverflow.com/questions/2343187/loading-resources-using-getclass-getresource)

http://stackoverflow.com/comment/37971404
type: QuestionComment
comment on: http://stackoverflow.com/q/24520573
has text: `MainActivity` has the `control` object. `DataActivity` has the `transaction` object that you instantiate with `transaction = new CustomerTransaction();`.
score: 0
type: Comment

spinning
tag name: spinning
type: Tag
tags question: http://stackoverflow.com/q/24544148

http://stackoverflow.com/a/24514600
type: Answer
has comment: http://stackoverflow.com/comment/37954215
downvote count: 0
has body: Obj1.num=null; num cannot be set to null because num is a primitive int, not an object. In Java only object references may be set to null. As for the memory handling. I have annotated your code below to explain what is happening. public class Concept { int num; public static void main(String args[]) { Concept obj1=new Concept(); // A new object is created. Ref stored in obj1 Concept obj2=obj1; // The ref from obj1 is copied to obj2 obj1.num=100; // obj1 and obj2 now hold the same ref to the same object obj2.num=200; // overwrites previous assignment; the java compiler is likely to strip out the previous line as it is redundant System.out.println(obj1.num); System.out.println(obj2.num); //obj1.num=null; obj2.num=500; // as before System.out.println(obj1.num); System.out.println(obj2.num); } } It is worth noting, that Java, unlike some other languages always creates its objects on the heap. A region of memory that is under its management, and it garbage collects for us. It does not create objects on the stack, thus fields and variables of type Object are always references to the object.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24514516

http://stackoverflow.com/q/24574900
upvote count: 4
linked to: http://stackoverflow.com/q/20937362
downvote count: 0
has comment: http://stackoverflow.com/comment/38082756
has title: retrieving client IP address in jax-rs resteasy interceptor
tagged with: java
tagged with: web-services
type: Question
has body: I have a REST Webservice API which I need to secure by several criterias. Here is a stripped example of my interceptor: @Provider @ServerInterceptor public class MySecurityInterceptor implements ContainerRequestFilter { private static final ServerResponse ACCESS_FORBIDDEN = new ServerResponse( "Nobody can access this resource", 403, new Headers&lt;Object&gt;() );; private static final ServerResponse SERVER_ERROR = new ServerResponse( "INTERNAL SERVER ERROR", 500, new Headers&lt;Object&gt;() );; @Override public void filter( ContainerRequestContext requestContext ) throws IOException { ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker)requestContext.getProperty( "org.jboss.resteasy.core.ResourceMethodInvoker" ); Method method = methodInvoker.getMethod(); if ( !method.getDeclaringClass().isAnnotationPresent( ApiKey.class ) ) { requestContext.abortWith( SERVER_ERROR ); RuntimeException e = new RuntimeException("..."); throw e; } if ( method.isAnnotationPresent( PermitAll.class ) ) { //Everyone can call method return; } // -- No one if ( method.isAnnotationPresent( DenyAll.class ) ) { requestContext.abortWith( ACCESS_FORBIDDEN ); return; } //... And so on } } In case of PermitAll I need to add an IP-Check. How can I obtain the caller IP adress at this place?
score: 4
linked to: http://stackoverflow.com/q/4678797
answer count: 1
has answer: http://stackoverflow.com/a/33151360
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
tagged with: rest
type: UnansweredQuestion

http://stackoverflow.com/a/24485605
has comment: http://stackoverflow.com/comment/37972409
has comment: http://stackoverflow.com/comment/37901912
has comment: http://stackoverflow.com/comment/38014413
answers question: http://stackoverflow.com/q/24485478
has body: Three problems: You have set doOutput to true, but you haven't set doInput to true. Your server side seems to be coded for a POST request, but the client side is not setting any method type. (It will send a GET request by default ...) You are not checking the status for the URL connection. If the status indicates an error, then getInputStream() will give you an empty stream. That might happen (for example) if the request never gets to your server-side doPost method ... UPDATE Ah ... I see what you are trying to do. OutputStreamWriter out1 = new OutputStreamWriter(connection.getOutputStream()); I doubt that that will work. When you closed the original output stream, that should have closed the output side of the underlying Socket. It can't be reopened. And if it didn't close the Socket I would expect the getOutputStream() call to throw ProtocolException("Cannot write output after reading input.") Basically, the HttpURLConnection API is not designed to work like this ... What you appear to be trying to do is to implement something like "websockets" ... where the client and the server negotiate that the HTTP socket is kept open after the HTTP request and reply and is then used for "other things". If you want to do that, you should look at the Java EE javax.websocket and javax.websocket.server packages; see here. There are other implementations of websockets too; Google for "java websocket", and a cooperating client and server could do this in other non-standard ways. But this is outside what the HttpURLConnection API or implementation will support.
has comment: http://stackoverflow.com/comment/38015925
upvote count: 1
has comment: http://stackoverflow.com/comment/38015212
has comment: http://stackoverflow.com/comment/37904105
has comment: http://stackoverflow.com/comment/37974209
has comment: http://stackoverflow.com/comment/37939644
type: Answer
has comment: http://stackoverflow.com/comment/37972283
has comment: http://stackoverflow.com/comment/37902763
has comment: http://stackoverflow.com/comment/37972877
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37971937

http://stackoverflow.com/comment/127519134
type: AnswerComment
comment on: http://stackoverflow.com/a/24652827
has text: well correct, but the help is not very informative, it tells only "-noprompt: do not prompt" not telling what to prompt for. If the password is omitted it should fail, not prompt for password.
type: Comment
score: 3

http://stackoverflow.com/q/24541407
has comment: http://stackoverflow.com/comment/38006306
has title: Data stays in local datastore after unpinning
has comment: http://stackoverflow.com/comment/38006520
has body: I can't get the unpinning to work and can't find a solution. I pin the data this way: myGroup = queryGroup.getFirst(); if (myGroup != null) { ParseObject.unpinAllInBackground("Groups", new DeleteCallback() { @Override public void done(ParseException arg0) { myGroup.pinInBackground("Groups", new SaveCallback() { @Override public void done(ParseException arg0) { if (arg0 != null) { Toast.makeText(getApplicationContext(), "ERROR", Toast.LENGTH_SHORT).show(); arg0.printStackTrace(); } } }); } }); } and try to unpin it like this: ParseObject.unpinAllInBackground("Groups", new DeleteCallback() { @Override public void done(ParseException arg0) { if (arg0 == null) { dataDeleted(); } else { arg0.printStackTrace(); } } }); But it doesn't throw an exception and the data is still saved locally when I start a query.
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/48395339
type: Question
upvote count: 7
answer count: 1
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24858799
has comment: http://stackoverflow.com/comment/38006370
tagged with: android

http://stackoverflow.com/q/24500937
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24522125
has answer: http://stackoverflow.com/a/24522267
type: Question
has comment: http://stackoverflow.com/comment/37930043
tagged with: java
has body: I'm trying to implement a MergeSort recursive algorithm to sort an array but I keep getting this problem on the merge part and I don't understand why I'm getting this error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space It marks the error at line 21 Here is the code for just the merge part, the recursive part seems to have no problems public static void Intercala(ArrayList&lt;Alumno&gt; L, int ini, int mitad, int fin){ int i=ini; int j= mitad+1; int k = ini; ArrayList&lt;Alumno&gt; B = new ArrayList &lt;Alumno&gt;(); while(i&lt;=mitad &amp;&amp; j&lt;=fin){ if (L.get(i).get_matri() &lt;= L.get(j).get_matri()){ B.add(k,L.get(i)); i++; } else{ B.add(k,L.get(j)); j++; } k++; } if (i&gt;mitad){ for(int h=j; h&lt;=fin; k++){ B.add(k,L.get(h)); } k++; } else{ for (int h=i; h&lt;=mitad;k++){ B.add(k,L.get(h)); } k++; } for(i=ini; i&lt;=fin; i++){ L.set(i, B.get(i)); } } Can someone help me out? I already tried to recheck the code but nothing seems to be helping EDIT: Already tried extending the memory and still throws this error
has comment: http://stackoverflow.com/comment/37930205
score: 0
answer count: 2
tagged with: mergesort
tagged with: sorting
has title: Mergesort OutOfMemoryError
has comment: http://stackoverflow.com/comment/37930136

http://stackoverflow.com/comment/108846683
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/24564612
has text: tldr; programmers use optional in useful cases outside of the original design and the original designers of optional don't like that.

http://stackoverflow.com/q/24587925
tagged with: java
upvote count: 73
has answer: http://stackoverflow.com/a/35621309
type: Question
linked to: http://stackoverflow.com/q/26513315
has title: SwipeRefreshLayout trigger programmatically
downvote count: 0
answer count: 7
possible better answer: http://stackoverflow.com/a/35621309
has comment: http://stackoverflow.com/comment/38091249
has answer: http://stackoverflow.com/a/59646364
has answer: http://stackoverflow.com/a/28002305
has answer: http://stackoverflow.com/a/56375767
has answer: http://stackoverflow.com/a/40007642
tagged with: android
has comment: http://stackoverflow.com/comment/69627436
favorite count: 0
tagged with: swiperefreshlayout
accepted answer: http://stackoverflow.com/a/28002305
has answer: http://stackoverflow.com/a/39366050
has answer: http://stackoverflow.com/a/62393373
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/69640550
has body: Is there any way to trigger the SwipeRefreshLayout programmatically? The animation should start and the onRefresh method from the OnRefreshListener interface should get called.
score: 73

http://stackoverflow.com/q/24521410
has answer: http://stackoverflow.com/a/32391445
favorite count: 0
type: UnansweredQuestion
has title: compiling jar with different version of jdk using maven
score: 4
tagged with: maven
has body: I'm having client jar which need to be compiled with jdk 1.5 and jdk 1.6. I want to maintain same artifactId and version. I'm planning to use maven classifier to download the artifact from nexus. Although i use jdk5 profile for building the jar (mvn clean install -Pjdk5), by looking at manifest file i find this - Build-Jdk: 1.6.0_51 Is jar's manifest file which will tell the jdk version with which artifact has been compiled ? How to get the both artifact out with one maven build command ? <profiles> jdk5 maven-compiler-plugin 2.3.2 1.5 1.5 true ${JAVA_HOME}/bin/javac maven-jar-plugin jdk5 jdk6 maven-compiler-plugin 2.3.2 1.6 1.6 true maven-jar-plugin jdk6
type: Question
tagged with: java
upvote count: 4
has answer: http://stackoverflow.com/a/24521653
answer count: 2
downvote count: 0

http://stackoverflow.com/a/29108472
has body: It looks like you are trying to connect to the BIRT sample database. Your Derby database is probably already up. You can add a ;shutdown=true and run once then leave off the the create=true and retry your generation.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24453579

http://stackoverflow.com/a/24457781
type: Answer
has body: I am trying to apply an actionListener to display te selected string on a textField Add ActionListener on JComboBox add set the text in JTextField. Sample code: final JTextField jTextField = new JTextField(); final JComboBox<String> comboBox = new JComboBox<String>(); comboBox.setModel(new DefaultComboBoxModel<String>(new String[] { "Select Something", "Selection 1", "Selection 2", "Selection 3", "Selection 4" })); // set first one selected comboBox.setSelectedIndex(0); comboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { // check whether there is any selection if(comboBox.getSelectedIndex()!=-1){ jTextField.setText(comboBox.getSelectedItem().toString()); } } }); It's worth reading How to Use Combo Boxes Few Points: Always try to avoid RAW type. Make it Generic Type. Use JFrame#pack() instead of JFrame#setSize() Never use setPreferredSize() instead use proper layout that is responsible for component size and position, if extremely needed then override JComponent#getPreferredSize(). Read more Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? For example: final JPanel panel = new JPanel(){ @Override public Dimension getPreferredSize() { return new Dimension(...,...); } };
score: 0
answers question: http://stackoverflow.com/q/24457607

http://stackoverflow.com/comment/38071259
type: QuestionComment
comment on: http://stackoverflow.com/q/24576543
score: 0
has text: `ar.get(0)` does not return 8. `ar.get(0).i` will return 8.
type: Comment

http://stackoverflow.com/comment/37894382
type: QuestionComment
has text: @necromancer I gave it a try.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24474838

http://stackoverflow.com/comment/37824958
score: 0
comment on: http://stackoverflow.com/q/24444561
type: QuestionComment
has text: referred [http://www.mapr.com/blog/how-to-avoid-java-heap-space-errors-understanding-and-managing-task-attempt-memory#.U6PBj1HxDNz]
type: Comment

http://stackoverflow.com/q/24514516
has answer: http://stackoverflow.com/a/24514563
has answer: http://stackoverflow.com/a/24514546
answer count: 6
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/24514600
has answer: http://stackoverflow.com/a/24514548
favorite count: 0
tagged with: memory-management
has answer: http://stackoverflow.com/a/24514541
has answer: http://stackoverflow.com/a/24514568
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37954046
accepted answer: http://stackoverflow.com/a/24514568
upvote count: 3
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/40480
has body: public class Concept { int num; public static void main(String args[]) { Concept obj1=new Concept(); Concept obj2=obj1; obj1.num=100; obj2.num=200; System.out.println(obj1.num); System.out.println(obj2.num); //obj1.num=null; obj2.num=500; System.out.println(obj1.num); System.out.println(obj2.num); } } Here, this is simple java program. Output is 200 200 500 500 How does the memory allocation work here? And how can we set null as Obj1.num=null?
tagged with: memory
type: Question
tagged with: object
has title: Need your help understanding java programming concept
possible better answer: http://stackoverflow.com/a/24514541

http://stackoverflow.com/q/24585013
has comment: http://stackoverflow.com/comment/38090063
tagged with: grid-layout
has comment: http://stackoverflow.com/comment/38090017
has comment: http://stackoverflow.com/comment/38086300
has body: Recently I created an internal window template that every window realize. I used GridLayout for the components but I don't like the outcome. So, I decided to create a template using generated code from NetBeans (template pattern so far). A plain window with nothing in it. private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 517, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 307, Short.MAX_VALUE) ); } While reading more about GroupLayout I understood that I cannot add components as easily as with GridLayout or FlowLayout. Maybe I have to replace the components everytime, or change visibility etc...Supposing I still want to use GroupLayout, which is the best pattern to add components to that window? Should I "migrate" from template pattern to decorator? If so, how am I supposed to do this? What is your opinion? Thank you in advance. EDIT: My former code did those things: public abstract class InternalWindowTemplate{ private int internalWindowCounter = 0; private final int xOffset = 30; private final int yOffset = 30; Container container; GridLayout gridLayout; JInternalFrame internalFrame; GroupLayout internalFrameLayout; // overriden methods public InternalWindowTemplate(String title, boolean isResizable, boolean isClosable, boolean isMaximizable, boolean isIconifiable, int width, int height, int gridRows, int gridColumns){ internalFrame = new JInternalFrame(title, isResizable, isClosable, isMaximizable, isIconifiable); setContainer(); setGridLayout(gridRows, gridColumns); setInternalWindowSize(width, height); setInternalWindowLocation(xOffset, yOffset); } public void setContainer(){ container = internalFrame.getContentPa…
tagged with: jinternalframe
has comment: http://stackoverflow.com/comment/38085784
score: 0
has comment: http://stackoverflow.com/comment/38085917
answer count: 0
type: UnansweredQuestion
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/38085853
type: Question
has comment: http://stackoverflow.com/comment/38085984
tagged with: java
has comment: http://stackoverflow.com/comment/38085744
has title: Appropriate design pattern for adding components to InternalFrame with GroupLayout
has comment: http://stackoverflow.com/comment/38085884
tagged with: grouplayout
has comment: http://stackoverflow.com/comment/38085701
has comment: http://stackoverflow.com/comment/38085875
has comment: http://stackoverflow.com/comment/38085792

http://stackoverflow.com/q/24549479
has body: I have a problem, I'm not sure how to save selected option to a file. What the code looks like is: <%@ page import="java.io.PrintWriter" %> <%@ page import="java.time.LocalDateTime" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Combo box to file <%PrintWriter writer; %> Current Date and Time <% writer = new PrintWriter("text.txt", "UTF-8"); writer.println(LocalDateTime.now().toString()); writer.close(); %> Some Text <% writer = new PrintWriter("text.txt", "UTF-8"); writer.println("Some text"); writer.close(); %> An Integer <% writer = new PrintWriter("text.txt", "UTF-8"); writer.println(123); writer.close(); %> And it doesn't do anything. My guess is that the code isn't invoked but I'm very new to this, not sure how to solve this.
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38020356
has comment: http://stackoverflow.com/comment/38019834
score: 0
tagged with: jsp
has title: Saving selected option from combo box to file using JSP
has comment: http://stackoverflow.com/comment/38020586
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/24445207
favorite count: 0
has comment: http://stackoverflow.com/comment/37879485
has answer: http://stackoverflow.com/a/24445859
score: 0
has answer: http://stackoverflow.com/a/24445279
linked to: http://stackoverflow.com/q/2201925
answer count: 4
has title: Convert string to Date
has answer: http://stackoverflow.com/a/24445243
accepted answer: http://stackoverflow.com/a/24445243
type: Question
type: AnsweredQuestion
has body: I have String String ackwardDate="2012-10-30T19:14:58"; i need to convert to date format.then tried like this ackwardDate=ackwardDate.replace("T", " "); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); try { Date date = formatter.parse(ackwardDate); System.out.println(date); System.out.println(formatter.format(date)); } catch (ParseException e) { e.printStackTrace(); } it working fine. Is there any other method?
tagged with: java
possible better answer: http://stackoverflow.com/a/24445279
linked to: http://stackoverflow.com/q/4216745
has comment: http://stackoverflow.com/comment/37879515
has answer: http://stackoverflow.com/a/24445829
has comment: http://stackoverflow.com/comment/37826035
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37826052

http://stackoverflow.com/comment/38069813
comment on: http://stackoverflow.com/a/24576084
type: AnswerComment
score: 0
type: Comment
has text: @IdanArye - Sorry.. The second one is *not* an advantage. changed the answer to reflect the same.

http://stackoverflow.com/q/24471513
accepted answer: http://stackoverflow.com/a/24471669
upvote count: 2
has title: Javafx and Sun.glass robot causing problems IllegalStateException due to use of Threads
answer count: 1
has answer: http://stackoverflow.com/a/24471669
favorite count: 0
has body: I am writing a JavaFX controller which moves the mouse once in every 5 seconds. This controller also does some other work concurrently while doing this. Hence I used separate threads for each of these tasks. Below is my code: Thread dynamicMouseThread = new Thread(new Runnable() { @Override public void run() { boolean isRunning = true; long timeout = 5000; int x = 5; Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot(); while (isRunning) { try { Thread.sleep(timeout); } catch (InterruptedException ex) { isRunning = false; } x = x == 5 ? x + 5 : 5; robot.mouseMove(x, 5); // This line causes the error. } } }); @Override public void initialize(URL url, ResourceBundle rb) { dynamicTimerThread.setName("Dynamic Timer Thread"); dynamicMouseThread.setName("Dynamic Mouse Thread"); dynamicTimerThread.start(); dynamicMouseThread.start(); } This is the error I seem to be getting. Please help me out. what am I doing wrong? Exception in thread "Dynamic Mouse Thread" java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = Dynamic Mouse Thread at com.sun.glass.ui.Application.checkEventThread(Application.java:427) at com.sun.glass.ui.Robot.&lt;init&gt;(Robot.java:52) at com.sun.glass.ui.win.WinRobot.&lt;init&gt;(WinRobot.java:33) at com.sun.glass.ui.win.WinApplication.createRobot(WinApplication.java:205) at main.SubDocumentController$1.run(SubDocumentController.java:56) at java.lang.Thread.run(Thread.java:745)
tagged with: multithreading
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/q/24437594
tagged with: java
has comment: http://stackoverflow.com/comment/37811833
has comment: http://stackoverflow.com/comment/37812180
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37811937
has comment: http://stackoverflow.com/comment/37812426
has body: All I have read these links, Is there a way to get the value of a HashMap randomly in Java? Selecting random key and value sets from a Map in Java using toArray() on keySet and list.get() is not an option. Because these methods take O(n) time. All the methods described in the above links take O(n) worst case to get a random value from hash map. Is it possible to do this in O(1) time?.
has comment: http://stackoverflow.com/comment/37814106
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/9919734
accepted answer: http://stackoverflow.com/a/24438323
has title: Getting random value from java HashMap in O(1) time
linked to: http://stackoverflow.com/q/929554
has answer: http://stackoverflow.com/a/24438323
has comment: http://stackoverflow.com/comment/37814801
type: AnsweredQuestion

http://stackoverflow.com/q/24577267
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24577762
has body: I want to change the colour of the jTabbed Pane header(tab headers) and i want to get rid of the line which is separating the tab header and its body. I also like to have round edges for Tabbed Pane. How to do all these customization in swing? Is there any external jars available with this kind of inbuilt gui features. I don't want to use any look and feel to do this because many of them are also not customizable according to my need. As i am quite new to java please give me a detailed answer. Thanks in advance.
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/24577762
linked to: http://stackoverflow.com/q/7054466
score: 0
has comment: http://stackoverflow.com/comment/38071594
has title: How to change the colour of the jTabbed Pane header
favorite count: 0
tagged with: jtabbedpane
has comment: http://stackoverflow.com/comment/38072176
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/38072153
comment on: http://stackoverflow.com/a/24577433
score: 0
type: Comment
has text: thank you for this solution but still i need some explanation if you can show me conversion of this matrix[2][3]= 5 which means assigning 5 at the row index 2 and column index 3 or some example tutorial i tried to check online different sites i didnt manage to find good solution please! @priyesh
type: AnswerComment

http://stackoverflow.com/q/24573861
has comment: http://stackoverflow.com/comment/38065371
has comment: http://stackoverflow.com/comment/38065314
has body: /* when i am clicking the tree node (EX:WEBLOGIC is selected) the node icon disappears,but the other icons(Non selected) are coming.please help me out to solve this issue.This is a swing based program*/ class ColorRenderer extends DefaultTreeCellRenderer { public ColorRenderer() { super(); } public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { try { Component cell = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); RTGTreeNode treeNode = (RTGTreeNode) value; GraphUniqueKeyDTO graphUniqueKeyDTO = treeNode.getGraphUniqueKeyDTO(); /*Default Icon not needed.*/ setIcon(null); if (graphUniqueKeyDTO == null) { return cell; } String nodeName = treeNode.toString(); if (!leaf) { cell.setFont(NSColor.mediumPlainFont()); if (selected) { cell.setForeground(Color.black); cell.setBackground(new Color(128, 0, 0)); } else { Color color = treeNode.getNodeColor(); if (treeNode.getTreeViewToolTip() != null) nodeName = treeNode.getTreeViewToolTip(); openIcon = treeNode.getImgIcon(); if(openIcon!=null){ setIcon(openIcon); setLeafIcon(openIcon); } if(color == null) cell.setForeground(NSColor.leftPaneGroupTitleColor()); else cell.setForeground(color); } } else { cell.setFont(NSColor.smallPlainFont()); if (selected) { cell.setForeground(Color.black); cell.setBackground(new Color(128, 0, 0)); } else { cell.setForeground(NSColor.leftPaneGraphTitleColor()); } } setToolTipText(nodeName); JLabel currentCell = (JLabel) cell; currentCell.setHorizontalAlignment(JLabel.CENTER); return cell; } catch (Exception ex) { Log.errorLog("ColorRenderer", "getTreeCellRendererComponent", "", "", "Exception - " + ex); return null; } }
type: Question
has comment: http://stackoverflow.com/comment/38065529
tagged with: jtree
answer count: 1
has title: Tree node icon dissappears when i click on it
tagged with: icons
has comment: http://stackoverflow.com/comment/38065433
has answer: http://stackoverflow.com/a/24590091
has comment: http://stackoverflow.com/comment/38065144
has comment: http://stackoverflow.com/comment/38065251
favorite count: 0
has comment: http://stackoverflow.com/comment/38065579
has comment: http://stackoverflow.com/comment/38065414
has comment: http://stackoverflow.com/comment/38065580
has comment: http://stackoverflow.com/comment/38065057
score: -4
accepted answer: http://stackoverflow.com/a/24590091
upvote count: 1
tagged with: treecellrenderer
tagged with: swing
has comment: http://stackoverflow.com/comment/38065102
has comment: http://stackoverflow.com/comment/38068425
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38065691
has comment: http://stackoverflow.com/comment/38066081
has comment: http://stackoverflow.com/comment/38065654
tagged with: java
has comment: http://stackoverflow.com/comment/38065324
downvote count: 5

http://stackoverflow.com/a/24500514
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: Invalid double: "". you are parsing onCreate() value without putting any default value so the exception final double gpaDouble = Double.parseDouble(gpaString); because "" (empty String is not Double)
answers question: http://stackoverflow.com/q/24500503

http://stackoverflow.com/a/24535313
has body: Yeah. Your controller method is mapped to /SpringMVC/welcome relative to your context path. That is, if your context path is /SpringMVC , then the request needs to be sent to /SpringMVC/SpringMVC/welcome
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24534908
downvote count: 0
answers question: http://stackoverflow.com/q/24534908
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37993390
score: 1

boot2docker
type: Tag
tags question: http://stackoverflow.com/q/24584603
tag name: boot2docker

http://stackoverflow.com/comment/46320650
type: AnswerComment
has text: Thanks for the quick response! I realized that I can use blockingConnect on GoogleApiClient and since I'm doing all my work in a background thread I figure I can just use blockingConnect on GoogleApiClient, register for my geofences (assuming a successful result on blockingResult) and disconnect right after. I feel better about doing it this way rather than keeping the client and context around forever.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25190497

http://stackoverflow.com/q/24452376
has body: I would like to use EclipseLink as my JPA engine. We are using a subclass of java.sql.Connection and I would like to know if I can force EclipseLink to use my connection. I would like to set the connection object programmatically. Something like MyConnection conn = new MyConnection(JDBC_URL, USR, PWD); EntityManagerFactory factory = Persistence.createEntityManagerFactory(conn);
favorite count: 0
has title: EclipseLink JPA 2.1 User supplied connection
upvote count: 3
has answer: http://stackoverflow.com/a/24452758
has answer: http://stackoverflow.com/a/24454221
has comment: http://stackoverflow.com/comment/41035993
tagged with: database-connection
downvote count: 0
type: UnansweredQuestion
tagged with: user-defined
score: 3
tagged with: java
type: Question
answer count: 2
tagged with: eclipselink

http://stackoverflow.com/a/27851383
answers question: http://stackoverflow.com/q/24431427
has comment: http://stackoverflow.com/comment/78991789
has body: As of JUnit 4.7 and Mockito 1.10.17, this functionality is built in; there is an org.mockito.junit.MockitoRule class. You can simply import it and add the line @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); to your test class.
type: Answer
score: 60
downvote count: 0
upvote count: 60
has comment: http://stackoverflow.com/comment/116468621
has comment: http://stackoverflow.com/comment/57856082

http://stackoverflow.com/q/24432740
answer count: 1
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11006496
has body: I am learning java as a beginner and I was tasked to make an auto-click tool. I used JFrame as an Interface but now I'm stuck with this problem: - I want to get location of pointer related to screen after user clicked a button (Ctrl for example). I added a button on JFrame, click it and the JFrame will be minimized so user can move the pointer around desktop. - Whenever user pressed Ctrl key, I should println the x,y position of the pointer at that time. - I've been swum around to find a solution, but it seemed like my brain couldn't catch up. It would be a very appreciation if anyone can provide me a simple example. Thanks. My idea so far: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { this.setState(JFrame.ICONIFIED); this.addKeyListener(this); } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.CTRL_DOWN_MASK) { PointerInfo a = MouseInfo.getPointerInfo(); Point b = a.getLocation(); int x = (int) b.getX(); int y = (int) b.getY(); System.out.println(x + ":" + y); } }
tagged with: location
tagged with: point
linked to: http://stackoverflow.com/q/2419555
has title: How to catch a key event when JFrame is minimized?
has comment: http://stackoverflow.com/comment/37805005
duplicate of: http://stackoverflow.com/q/2419555
type: Question
has answer: http://stackoverflow.com/a/24432971
score: 0
has comment: http://stackoverflow.com/comment/37803771
tagged with: swing

http://stackoverflow.com/q/24459832
has comment: http://stackoverflow.com/comment/37853370
tagged with: truetype
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37853148
has comment: http://stackoverflow.com/comment/37853071
score: 0
has comment: http://stackoverflow.com/comment/37853301
answer count: 1
has comment: http://stackoverflow.com/comment/37853331
tagged with: resource-loading
has body: Inside NetBeans my custom font loads properly from this set of code but fails to load when I run my program from the executable jar file code public static void main(String[] args) { Arcanus arc = new Arcanus(); try { Font customFont = Font.createFont(Font.TRUETYPE_FONT, new File("Golden-Sun.ttf")).deriveFont(12f); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("Golden-Sun.ttf"))); arc.setFont(customFont); } catch (IOException e) { e.printStackTrace(); } catch (FontFormatException e) { e.printStackTrace(); } } any help would be apreciated
has comment: http://stackoverflow.com/comment/37853093
has title: Jar file not using custom font
has comment: http://stackoverflow.com/comment/37853358
has answer: http://stackoverflow.com/a/24460069
accepted answer: http://stackoverflow.com/a/24460069
type: AnsweredQuestion

http://stackoverflow.com/a/24558663
downvote count: 1
answers question: http://stackoverflow.com/q/24558456
has comment: http://stackoverflow.com/comment/107714425
type: Answer
has body: Untested, but this is the general idea: public boolean setEqualsIgnoreCase(Set&lt;String&gt; a, Set&lt;String&gt;b) { if (a.size() != b.size()) return false; Iterator&lt;String&gt; ai = a.iterator(); Iterator&lt;String&gt; bi = b.iterator(); while(ai.hasNext()) { if (!ai.next().equalsIgnoreCase(bi.next())) return false; } return true; }
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/134129273

http://stackoverflow.com/a/24451113
has body: You can use this: ^ ?\d+$ which is easier to read like this: ^[ ]?\d+$ See demo. To test if you have a match, you can do (for instance): if (subjectString.matches("[ ]?\\d+")) { // It matched! } else { // nah, it didn't match... } Here you don't need the ^ and $ anchors, because the matches method looks for an exact match. Explanation The ^ anchor asserts that we are at the beginning of the string. Depending on the method used, these anchors may not be needed. [ ]? matches zero or one space. The brackets are not needed, but they make it easier to read. You can remove them. Do not use \s there as it also matches newlines and tabs. \d+ matches one or more digits The $ anchor asserts that we are at the end of the string
score: 4
has comment: http://stackoverflow.com/comment/37837229
has comment: http://stackoverflow.com/comment/37837245
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24451086
type: Answer
has comment: http://stackoverflow.com/comment/37837182
has comment: http://stackoverflow.com/comment/37837183
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24451086

http://stackoverflow.com/comment/37807696
type: Comment
score: 2
type: AnswerComment
has text: This is **not** the singleton pattern. Neither does it restrict object creation by using a non-public constructor, nor does it create one when it's needed the first time.
comment on: http://stackoverflow.com/a/24435278

http://stackoverflow.com/comment/48703296
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24486681
score: 0
has text: u got any solution???

http://stackoverflow.com/a/24488582
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24488050
downvote count: 0
has body: try something similar to suit your requirements: public static void main(String[] args) { List&lt;String&gt; wholeList = new ArrayList&lt;&gt;(); wholeList.add("AAA"); wholeList.add("BBB"); wholeList.add("CCC"); wholeList.add("DDD"); wholeList.add("EEE"); wholeList.add("FFF"); wholeList.add("GGG"); int randomLimit = wholeList.size(); Random r = new Random(); for (int i = 0; i &lt; 1000; i++) { // get three random indices from 0(inclusive) to list max size // (exclusive) int u = r.nextInt(randomLimit); int v = r.nextInt(randomLimit); int w = r.nextInt(randomLimit); // chose your format System.out.print(wholeList.get(u) + "\t"); System.out.print(wholeList.get(v) + "\t"); System.out.println(wholeList.get(w)); } }

http://stackoverflow.com/comment/38058417
comment on: http://stackoverflow.com/q/24569286
score: 0
type: Comment
type: QuestionComment
has text: [Android](http://stackoverflow.com/questions/7282930/android-slow-aes-decryption) [crypto](http://stackoverflow.com/questions/4663912/slow-aes-decryption-in-android) [is slow](http://stackoverflow.com/questions/6257945/aes-decryption-on-android-too-slow-to-be-usable-will-ndk-be-faster-other-ideas?rq=1), [very](http://stackoverflow.com/questions/7713166/speed-up-encryption-decryption) [slow](http://stackoverflow.com/questions/10619770/android-aes-encryption-decryption).

http://stackoverflow.com/comment/70676748
has text: JMockit seems to have had a change of heart with respect to mocking private methods. Regardless of our individual opinions on that, perhaps that should have been done on a major release? On the topic of testing private methods, my opinion is that there is plenty of (legacy) code out there for which we need to write *characterization* tests effectively - mocking private methods being a very useful feature for that. I view JMockit as the tool of choice to deal with those situations - anything can be mocked, regardless of current notions of programming best practices.
type: Comment
comment on: http://stackoverflow.com/a/35055535
type: AnswerComment
score: 2

http://stackoverflow.com/a/24518487
has comment: http://stackoverflow.com/comment/56550140
upvote count: 64
has comment: http://stackoverflow.com/comment/56508543
type: Answer
score: 64
answers question: http://stackoverflow.com/q/24517761
has comment: http://stackoverflow.com/comment/38024849
has comment: http://stackoverflow.com/comment/38023933
has comment: http://stackoverflow.com/comment/38024067
accepted answer of: http://stackoverflow.com/q/24517761
has body: Either update to a newer scala version (2.10.3+) or downgrade java to java 6/7. As you have seen in the output, 2.9.2 was here long before java 8 was introduced (Copyright 2002-2011, LAMP/EPFL), so they don't work well together. This duplicate question contains exact instructions on ubuntu's java downgrade.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24434973
has body: Your question is not clear but could this be what you are looking for? boolean valid = false; private boolean validate() { System.out.println("Validating"); return true; } public void test() { if (valid || (valid = validate())) { System.out.println("Try 1"); } if (valid || (valid = validate())) { System.out.println("Try 2"); } } This will only call validate once. However - a better mechanism would be something like: private boolean valid() { return valid || (valid = validate()); } public void test2() { if (valid()) { System.out.println("Try 1"); } if (valid()) { System.out.println("Try 2"); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24434718

http://stackoverflow.com/a/24576295
has comment: http://stackoverflow.com/comment/38072786
score: 1
has body: Obi Wan has said that only Sith thinks in absolutes or something similar... It's good you know that Java compiler internally replaces "+" on Strings with the usage of the StringBuilder. This is what are the compilers for: to make the life easier. Unless you have loops, as in linked case, or conditionals from Jon Skeet's example, it's primarily the matter of readibility and the ease of maintanance. Replacing return "User " + userName + " said"; with new StringBuilder().append("User ").append(userName).append(" said").toString(); makes the code longer, probably harder to modify, is more likely to force line breaks, and gives you more performance. However, when the addition apply not only to the strings, but there are numbers involved, probably the solution with StringBuilder sometimes may be more readable. return "User" + a + b + " said: " + (c + d); may be more confusing as: return new StringBuilder().append("User ").append(a).append(b) .append(" said: ").append(c+d).toString(); But it's primarily the matter of opinion and coding style. "Should" is not a good word here.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24571463
upvote count: 1

http://stackoverflow.com/comment/38074561
has text: @DavidG Is this because you have used memory mapped files for large data collection before (as most databases do) and can think of better ways of doing it or because you just don't like it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24575239

http://stackoverflow.com/comment/37826400
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24445391
has text: Mockito.mock(A.class) same goes for B. It will give you the mocked object. Is this what you wanted ?

http://stackoverflow.com/comment/37957899
score: 1
comment on: http://stackoverflow.com/q/24516423
has text: Post relevant code here
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38069182
has text: See my new suggestion
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24575448
type: Comment

http://stackoverflow.com/q/24563321
has answer: http://stackoverflow.com/a/24563353
type: Question
has answer: http://stackoverflow.com/a/24563370
possible better answer: http://stackoverflow.com/a/24563370
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/24563353
has answer: http://stackoverflow.com/a/78572886
has body: 4.0.0 com.example.j2eeapp j2eeapplication 0.0.1-SNAPSHOT war J2EE Application Example ** javax.servlet javax.servlet-api 3.1.0 **﻿﻿ That part it marks an error on the opening tag, don't know why? I need it to access httpServlet, I know to add the dependency but its giving me an error with the opening tag?THANKS
tagged with: maven
tagged with: dependencies
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38045837
has title: Can't add dependencies on maven pom.xml file

http://stackoverflow.com/q/24457627
has body: I am creating a complex game, because of this I use System.out.println(); a lot to test to see if something works or to see if something went wrong. To see these messages I have been going to the CMD or terminal and running it from there but I was wondering if there was an easier way. I thought of a couple ways and came up with running with a batch, but I have no idea how to make one, and another way was to put a button in game that opens the console that the game is running in. I don't even know if the second one is possible but I was wondering if there was a way! Thanks in advanced!
answer count: 1
tagged with: console
has answer: http://stackoverflow.com/a/24457676
has title: Java - Open the console or terminal a game is running in
tagged with: terminal
type: UnansweredQuestion
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37848920
type: Question

http://stackoverflow.com/q/24510320
linked to: http://stackoverflow.com/q/19941825
has comment: http://stackoverflow.com/comment/37946413
has body: Okay am just beginning to learn Java and I have a doubt regarding constructors. isn't constructor just another method with same name as class?? If so Why do we need it? Cant we just use methods?
has answer: http://stackoverflow.com/a/24510380
answer count: 2
accepted answer: http://stackoverflow.com/a/24510365
favorite count: 0
possible better answer: http://stackoverflow.com/a/24510380
has comment: http://stackoverflow.com/comment/37946575
has comment: http://stackoverflow.com/comment/37946385
downvote count: 3
score: -3
has answer: http://stackoverflow.com/a/24510365
has title: Need Clarity on Java constructors
upvote count: 0
has comment: http://stackoverflow.com/comment/37947096
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24536480
has title: Jetty Maven can not find dev.properties from parent project
has answer: http://stackoverflow.com/a/24538318
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24568122
linked to: http://stackoverflow.com/q/24104819
score: 0
tagged with: maven-jetty-plugin
accepted answer: http://stackoverflow.com/a/24568122
has body: We have a parent project with multiple sub projects below. Some of them are producing a war and other are producing a jar. Inside the parent project, there is a dev.properties file. It is in the directory /src/main/resources/config/environments/dev.properties This file is used by multiple subprojects correctly withour a problem. The project that causes the error has the following configuration for jetty in pom.xml jetty ${project.artifactId} org.mortbay.jetty maven-jetty-plugin 6.1.16 10 8005 STOP / true start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop This project references with dependency our admin project like this: sample.project sample-project-admin-service 0.1.0-SNAPSHOT Inside the sample project and in the file sample-project-admin-service-context.xml there is this configuration : <bean id="cacheMan" class="org.infinispan.spring.provider.SpringRemoteCacheManagerFactoryBean" p:configurationPropertiesFileLocation="/WEB-INF/classes/config/environments/${SERVER_ENV}.properties" /> This should read the properties file and initialize the cacheMan. The sample-project-admin-service-context.xml lies in the path: /sample-project-admin-service/src/main/resources/META-INF/spring/flash-air-admin-service-context.xml When we make a war file and deploy it to tomcat. the application deployes correctly without any problem. But when I try to load it with jetty I get the following error: Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [META-INF/spring/sample-project-admin-service-context.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/classes/config/environments/dev.properties]: Jetty maven is run using the command: mvn install -Pjetty any help would be apprecia…
tagged with: maven
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24538318

http://stackoverflow.com/q/24468874
score: 1
favorite count: 0
tagged with: android-studio
has answer: http://stackoverflow.com/a/24469059
upvote count: 1
has title: Cannot resolve constructor
type: AnsweredQuestion
tagged with: java
has body: I have an error that I don't know why in my Galaxy Ace Samsung(Android 2.3.6) doesn't work but in my Motorola G (Android 4.4) works perfectly. The exception are so strange this is my code: adapter = new SimpleCursorAdapter(this,R.layout.single_row_profession, cursor,from,to,0); package com.orun.app; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TextView; import android.widget.Toast; import com.orun.database.DataBaseManager; import com.orun.model.Profession; import com.orun.s.SConnection; public class ProfessionsActivity extends Activity { public static SConnection sConnection; public static DataBaseManager manager; private static Cursor cursor; private static ListView listView; private static SimpleCursorAdapter adapter; private static EditText etSearch; private static ImageButton btSearch; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_professions); SharedPreferences sharedPref = getSharedPreferences(getString(R.string.PREFERENCE_FILE_KEY), Context.MODE_PRIVATE); Toast.makeText(getApplicationContext(), "Rol "+sharedPref.getString("ROL","Estudiante"),Toast.LENGTH_LONG).show(); manager = new DataBaseManager(this); listView = (ListView) findViewById(R.id.listView); etSearch = (EditText)findViewById(R.id.etSearch); new LoadTask().execute(); cursor = manager.searchProfession(etSearch.getText().toString()); int[] to = new int[]{R.id.textCode, R.id.textName,R.id.textType}; String…
type: Question
accepted answer: http://stackoverflow.com/a/24469059
downvote count: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/37869860

http://stackoverflow.com/q/24542764
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24548155
tagged with: java
has comment: http://stackoverflow.com/comment/38046638
has title: Store Ordered Entities in Morphia/MongoDB
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/38016949
has comment: http://stackoverflow.com/comment/38055886
score: 0
has body: I'm in the process of learning Morphia/MongoDB, and I had a question regarding ordered entities. I haven't had much luck searching for existing questions on this subject. For the sake of this question, I have three entities: Job, JobStatus and JobPriority. JobStatus and JobPriority instances are defined on the fly by users. These entities are global values which individual Job entities will reference. Both JobStatus and JobPriority need to be orderable, and that order needs to be saved. Instinctively, I started to approach this with the following setup (slimmed down for reading ease): First: The Ordered Entities @Embedded abstract class OrderedEntity { @Indexed(value=IndexDirection.ASC, name="order_ndx", unique=true) Integer oderNdx; } @Embedded class JobStatus extends OrderedEntity { ... } @Embedded class JobPriority extends OrderedEntity { ... } Second: Parent Entities to manage the sort order @Entity abstract class OrderedEntityList&lt;T extends OrderedEntity&gt; { @Embedded List&lt;T&gt; entities; } @Entity class JobStatusList extends OrderedEntityList&lt;JobStatus&gt; { ... } @Entity class JobPriorityList extends OrderedEntityList&lt;JobPriority&gt; { ... } Third: The Job @Entity { @Reference JobStatus status; @Reference JobPriority priority; } My plan was to create an instance of JobStatusList and JobPriorityList on startup, and then use a form in the UI that would let users insert embedded Status/Priority instances and define the order. I'm convinced that this is the wrong way to go about this and wanted to get some input before I dug in too deep. If I understand the Morphia annotations correctly, Job entities can't @Reference JobStatus or JobPriority values because @Embedded entities can't have a reference-able ID. Edit: Based on comments and answers, this question needs to be clarified. I am creating a generic job tracking framework that can be adapted at runtime to fit a variety of business models. JobStatus represents a user-defined state for each job. Ul…
answer count: 1
tagged with: morphia

http://stackoverflow.com/q/24448319
has answer: http://stackoverflow.com/a/24448785
upvote count: 3
answer count: 2
tagged with: pdfptable
tagged with: height
favorite count: 0
has answer: http://stackoverflow.com/a/40816440
has body: I'm facing a problem while trying to generate a PdfPTable and calculate its height before adding it to a document. The method calculateHeights of PdfPTable returned the height a lot greater than the height of a page (while the table is about 1/4 of page's height), so I wrote a method to calculate the height: protected Float getVerticalSize() throws DocumentException, ParseException, IOException { float overallHeight=0.0f; for(PdfPRow curRow : this.getPdfObject().getRows()) { float maxHeight = 0.0f; for(PdfPCell curCell : curRow.getCells()) { if(curCell.getHeight()&gt;maxHeight) maxHeight=curCell.getHeight(); } overallHeight+=maxHeight; } return overallHeight; } where getPdfObject method returns a PdfPTable object. Using debugger I've discovered that lly and ury coordinate difference (and thus the height) of cell's rectangle is much bigger than it looks after adding a table to a document (for example, one cell is 20 and the other is 38 height while they look like the same on a page). There is nothing in the cell except a paragraph with a chunk in it: Font f = getFont(); if (f != null) { int[] color = getTextColor(); if(color != null) f.setColor(color[0],color[1],color[2]); ch = new Chunk(celltext, f); par = new Paragraph(ch); } cell = new PdfPCell(par); cell.setHorizontalAlignment(getHorizontalTextAlignment()); cell.setVerticalAlignment(getVerticalTextAlignment()); A table then has a cell added and setWidthPercentage attribute set to a some float. What am I doing wrong? Why does cell's proportions are different from those I see after generating PDF? Maybe I'm calculating the height wrong? Isn't it the height of a cell on a PDF page should strictly be the difference between lly and ury coordinates Sorry I haven't shown the exact code, because the PDF is being generated of XML using lots of intermediate steps and objects and it is not very useful "as is" I guess... Thanks in advance!
has title: unable to calculate itext PdfPTable/PdfPCell height properly
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: itext
possible better answer: http://stackoverflow.com/a/40816440
type: Question
accepted answer: http://stackoverflow.com/a/24448785

http://stackoverflow.com/a/74105501
has body: You can delete the WS connection to the endpoint through configExactMatchMap after obtaining the container WsServerContainer wsServerContainer = (WsServerContainer) request.getSession().getServletContext().getAttribute(ServerContainer.class.getName()); Class<?> obj = Class.forName("org.apache.tomcat.websocket.server.WsServerContainer"); Field field = obj.getDeclaredField("configExactMatchMap"); field.setAccessible(true); Map<String, Object> configExactMatchMap = (Map<String, Object>) field.get(wsServerContainer); ExactMatch.remove(servletName);
answers question: http://stackoverflow.com/q/24488814
type: Answer
score: 0

http://stackoverflow.com/comment/38075559
comment on: http://stackoverflow.com/q/24579268
score: 0
has text: Your statement of `but i only need to return AddedNodes` doesn't make sense if you have any code following that block.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24487045
answer count: 2
has answer: http://stackoverflow.com/a/24508065
possible better answer: http://stackoverflow.com/a/24495234
tagged with: scala
has body: I'm trying to learn some game development and while I'm recollecting everything about linear algebra and vector maths I learned in my life I also started playing with libgdx. The first thing I wanted to start with is a simple movement with rotation and I came up with an idea how this may be done by calculating angles from current direction to the desired direction. While it worked for still sprite, adding movement to it proved it wrong, as the sprite is doing a U kind of turn (not going to the point, but the direction of the point) The example is implemented here https://github.com/pbuda/libgdx-movement in Scala. The code in question is located in the Spaceship class. Just for quick reference, here is the main part of the class: def update(delta: Float) { rotate(delta) move(delta) } private def move(delta: Float) { velocity.set(direction).scl(movementSpeed) position.add(velocity.scl(delta)) } private def rotate(delta: Float) { val current = direction.angle() val target = targetDirection.angle() if (current != target) { val rotateAngle = rotationSpeed * delta val left = distance(current, target) val right = distance(target, current) if (left &lt; right) rotateLeft(current, left, rotateAngle) else rotateRight(current, right, rotateAngle) } } private def distance(start: Float, end: Float): Float = { val angle = start - end if (angle &lt; 0) angle + 360 else if (angle &gt; 360) angle - 360 else angle } private def rotateLeft(current: Float, target: Float, angle: Float) { if (target - angle &lt; 0) direction.set(targetDirection) else direction.setAngle(direction.angle() - angle) } private def rotateRight(current: Float, target: Float, angle: Float) { if (target - angle &lt; 0) direction.set(targetDirection) else direction.setAngle(direction.angle() + angle) } Now, I feel there's a much cleaner solution for that using some vectors (position, velocity, direction and probably destination) but I'm kind of stuck and don't know where to go from here. I want a behaviour you wou…
accepted answer: http://stackoverflow.com/a/24508065
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/24495234
has title: Smooth movement and turning of a game object using libgdx

http://stackoverflow.com/a/24467401
has comment: http://stackoverflow.com/comment/37867160
has comment: http://stackoverflow.com/comment/37867170
downvote count: 0
answers question: http://stackoverflow.com/q/24467330
type: Answer
score: 2
has body: Your method does almost nothing and no there is no way in this example you gave to know if the method returned before complete execution but if you willing to change the function to a boolean type you can return true at complete execution and false at incomplete. static boolean test() { if(a&gt;10) return false; a++; return true; }
upvote count: 2

http://stackoverflow.com/comment/37830569
type: QuestionComment
comment on: http://stackoverflow.com/q/24446506
type: Comment
has text: Unfortunately, I haven't checked in my TIFF writing code yet (and it's an `ImageIO` plugin, so it would take some rewriting to make it work on Android). But I'm sure you'll find something using the almighty Google. Also, check out my favorite source for anything TIFF related: http://www.awaresystems.be/imaging/tiff.html :-)
score: 0

http://stackoverflow.com/q/24468366
tagged with: android-intent
has answer: http://stackoverflow.com/a/24468447
tagged with: java
has title: Opening my app when built in app is accessed
type: Question
answer count: 1
score: 0
tagged with: android
has body: Because I've read that it's bad practice to have your app running at all time, I'm trying to have it start when specific built in apps start. I believe it has something to do with intent and the following link but I don't know where to start. http://developer.android.com/training/basics/intents/filters.html If this is possible can someone post a code snippet to help me out? I'm wanted my app to start when Media or the camera is accessed and then close when those two apps are closed.
type: UnansweredQuestion

http://stackoverflow.com/comment/37959146
comment on: http://stackoverflow.com/q/24516880
has text: It's a null pointer. Put a breakpoint and check what is null
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24472224
has answer: http://stackoverflow.com/a/24472409
tagged with: java
has comment: http://stackoverflow.com/comment/37876437
type: Question
linked to: http://stackoverflow.com/q/1915166
has body: I have a oracle table defined like this: create table image_table_test (id number primary key, image ordsys.ordimage); when I try to select maximum ID value in that table and return it in java variable, using the code below, it returns a zero value, but the value in a table is set to 1. the rsx.getInt("ID"); method isn't returning an integer value from a table. my table When I execute SELECT MAX(ID) as ID FROM image_table_test;: ID 1 my java code: Statement stmt; try{ stmt = conn.createStatement(); String maxIdStr = ""; int maxIdNum = 0; String maxIdSQL = "SELECT MAX(ID) as ID FROM image_table_test"; ResultSet rsx = stmt.executeQuery(maxIdSQL); while(rsx.next()){ maxIdNum = rsx.getInt("ID"); // Here the value is passed as 0 } maxIdNum = maxIdNum + 1; maxIdStr = Integer.toString(maxIdNum); System.out.println(maxIdStr); rsx.close(); stmt.close(); I would appreciate your help if you know why is this happening?
score: 0
has comment: http://stackoverflow.com/comment/37876850
answer count: 2
tagged with: plsql
accepted answer: http://stackoverflow.com/a/24472409
has comment: http://stackoverflow.com/comment/37876376
has title: getInt method isn't returning a value from a database table
possible better answer: http://stackoverflow.com/a/24472315
has answer: http://stackoverflow.com/a/24472315
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37876304

http://stackoverflow.com/a/24438037
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24437954
has body: forEach javadoc states Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. So the i in (i) -&gt; {System.out.print(ints.get(i-1) + " ");} is each element in the List. If any of those elements minus 1 is bigger or equal to 5 (the size of the List), you try to get an element that is out of bounds.
score: 5

maven
tags question: http://stackoverflow.com/q/24479973
tags question: http://stackoverflow.com/q/24480469
tags question: http://stackoverflow.com/q/24506939
tags question: http://stackoverflow.com/q/24473247
tags question: http://stackoverflow.com/q/24429729
type: Tag
tags question: http://stackoverflow.com/q/24447897
tags question: http://stackoverflow.com/q/24578191
tags question: http://stackoverflow.com/q/24517967
tags question: http://stackoverflow.com/q/24482259
tags question: http://stackoverflow.com/q/24478076
tags question: http://stackoverflow.com/q/24489430
tags question: http://stackoverflow.com/q/24544052
tags question: http://stackoverflow.com/q/24439580
tags question: http://stackoverflow.com/q/24563321
tags question: http://stackoverflow.com/q/24490318
tags question: http://stackoverflow.com/q/24552246
tags question: http://stackoverflow.com/q/24532256
tags question: http://stackoverflow.com/q/24559245
tags question: http://stackoverflow.com/q/24482085
tags question: http://stackoverflow.com/q/24516152
tags question: http://stackoverflow.com/q/24576567
tags question: http://stackoverflow.com/q/24448372
tags question: http://stackoverflow.com/q/24554383
tags question: http://stackoverflow.com/q/24576059
tags question: http://stackoverflow.com/q/24485709
tags question: http://stackoverflow.com/q/24531483
tags question: http://stackoverflow.com/q/24465746
tags question: http://stackoverflow.com/q/24545702
tags question: http://stackoverflow.com/q/24571722
tags question: http://stackoverflow.com/q/24521410
tags question: http://stackoverflow.com/q/24536480
tags question: http://stackoverflow.com/q/24429557
tags question: http://stackoverflow.com/q/24564554
tags question: http://stackoverflow.com/q/24478626
tags question: http://stackoverflow.com/q/24484776
tags question: http://stackoverflow.com/q/24476680
tags question: http://stackoverflow.com/q/24451780
tags question: http://stackoverflow.com/q/24579236
tags question: http://stackoverflow.com/q/24549378
tags question: http://stackoverflow.com/q/24512144
tags question: http://stackoverflow.com/q/24557779
tags question: http://stackoverflow.com/q/24564540
tags question: http://stackoverflow.com/q/24555935
tags question: http://stackoverflow.com/q/24430998
tags question: http://stackoverflow.com/q/24548273
tags question: http://stackoverflow.com/q/24482138
tags question: http://stackoverflow.com/q/24504115
tags question: http://stackoverflow.com/q/24466059
tags question: http://stackoverflow.com/q/24574935
tags question: http://stackoverflow.com/q/24505993
tags question: http://stackoverflow.com/q/24491191
tags question: http://stackoverflow.com/q/24555005
tags question: http://stackoverflow.com/q/24525468
tags question: http://stackoverflow.com/q/24529868
tags question: http://stackoverflow.com/q/24430768
tags question: http://stackoverflow.com/q/24428433
tags question: http://stackoverflow.com/q/24551558
tags question: http://stackoverflow.com/q/24488631
tags question: http://stackoverflow.com/q/24441349
tags question: http://stackoverflow.com/q/24474903
tags question: http://stackoverflow.com/q/24507766
tags question: http://stackoverflow.com/q/24498332
tags question: http://stackoverflow.com/q/24436547
tags question: http://stackoverflow.com/q/24546345
tags question: http://stackoverflow.com/q/24454009
tags question: http://stackoverflow.com/q/24559472
tags question: http://stackoverflow.com/q/24540884
tags question: http://stackoverflow.com/q/24538001
tags question: http://stackoverflow.com/q/24514981
tags question: http://stackoverflow.com/q/24446979
tags question: http://stackoverflow.com/q/24439818
tags question: http://stackoverflow.com/q/24580254
tags question: http://stackoverflow.com/q/24471844
tags question: http://stackoverflow.com/q/24488546
tags question: http://stackoverflow.com/q/24569433
tags question: http://stackoverflow.com/q/24565488
tags question: http://stackoverflow.com/q/24580383
tags question: http://stackoverflow.com/q/24576188
tags question: http://stackoverflow.com/q/24431728

http://stackoverflow.com/a/24531492
type: Answer
has body: width &amp; height of the imageview is "wrap content" however the scaletype is "fitXY". thats kind of saying 2 different things to the device. if that image should be full screen change it's width &amp; height to match/fill parent.
score: 0
answers question: http://stackoverflow.com/q/24531143

http://stackoverflow.com/a/24507281
has comment: http://stackoverflow.com/comment/38022227
has comment: http://stackoverflow.com/comment/38026653
type: Answer
answers question: http://stackoverflow.com/q/24505264
has comment: http://stackoverflow.com/comment/37943165
has body: you can use C#: Example C# or java: Example Java EDIT You can use Boost for ssl and send email via smtp
score: 0

http://stackoverflow.com/a/24511374
upvote count: 5
has body: The intersection of two intervals [s1, s2] and [t1, t2] is empty if and only if: t2 &lt; s1 or s2 &lt; t1 So for two intervals to check if the two are intersecting or not you need to do only the test above. Also once you know that s2 &lt; t1 then there is no point to continue further on the list that brought t1 since the larger intervals will never intersect, which means you should move on. Naive Psuedo Algorithm: given [s1, s2] for each list [t1, t2, ... t(n)] in search_lists for each interval [t(x), t(x+1)] from [t1, t2, ... t(n] (x goes from 0 to n-1) if t(x+1) &lt; s1 continue if s2 &lt; t(x) break saveInterval() This can be improved quite a bit to really use the fact that [t1, t2, .. , t(n)] is sorted. first note that [s1, s2] will intersect with [t(x), t(x+1)] iff t(x+1) &gt;= s1 and s2 &gt;= t(x) However if t(x) &gt;= s1 then for every h&gt;0 `t(x+h) &gt;= s1` also if s2 &gt;= t(x) then for every h&gt;0 `s2 &gt;= t(x-h)` so if we find the smallest i so that t(i+1)>=s1 then all the intervals from [t(i), t(i+1)] on-wards meet the first condition of intersection; i.e. ([t(i+1), t(i+2)] , [t(i+2), t(i+3)] ...) and if we find the largest j so that s2 >= t(j-1) then all the intervals from [t(j-1), t(j)] backwards meet the second condition . i.e. ([t(j-2), t(j-1)], [t(j-3), t(j-2)] ...) All the intervals between i and j meet both criteria and only them. So the final algorithm is: given [s1, s2] for each list [t1, t2, ... t(n)] in search_lists find the smallest i such that t(i+1)&gt;=s1 find the biggest j such that s2&gt;= t(j-1) if j&gt;i then all the intervals between `{t(i)... t(j)}` intersect with [s1, s2] otherwise there is no intersection. Since {t1, t2, t3...t(n)} is sorted we can use binary search to find the indices i and j efficiently EDIT2: The intersection of [s1,s2] and [t1, t2] is: [max(s1, t1), min(s2,t2)] the sizes are: L1 = s2-s1 L2 = t2-t1 L3 = min(s2,t2) - max(s1,t1) The score you are looking for is: L3/ min(L2, L1) a score between 0 and 1. (min(s2…
has comment: http://stackoverflow.com/comment/37948800
downvote count: 0
score: 5
type: Answer
answers question: http://stackoverflow.com/q/24511278

http://stackoverflow.com/comment/37836268
type: Comment
has text: To be honest, this is all very dodgy, both the workaround via reflection, and the actual design of that authentication scheme. I'd suggest you have a word with whoever designed this to get them to reconsider what they're doing. (I've only answered because I know it's not always possible in real life, but there is a generally a strong business case for not using that sort of workaround.)
comment on: http://stackoverflow.com/a/24450730
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38091414
type: QuestionComment
comment on: http://stackoverflow.com/q/24588015
score: 0
has text: Hi Mark, just trying to model files as a tree and use file traversal to visit all files
type: Comment

http://stackoverflow.com/q/24571914
tagged with: database
score: 0
has body: I have been trying to write to a CSV file from a JSON file using NorthConcepts datapipeline library in the following way, however I have problems. The data in the JSON file is either repeated or the fields are Seperated and written in different rows. For instance from the given code below I could have a combination of the following rows : Row 1 : CreatedAt, ID, Row 2 : CreatedAT, ID, IDString, Row 3 : CreatedAt, IDString likewise. I have about 30 fields and about 4 rows in the CSV file writing data for the same record but with split fields filled in. Would anyone know what the problem is? The JSON file I am reading from doesnt have repetitive data. I read data the following way : DataReader reader = new JsonReader(new File(FILE)) .addField("CreatedAt", "//array/object/created_at") .addField("ID", "//array/object/id") .addField("IDString", "//array/object/id_str") .addField("Text", "//array/object/actualTweet") Writing data the following way : DataWriter writer = new CSVWriter(new File("../Twix/files/x.csv" )); JobTemplate.DEFAULT.transfer(reader, writer); The library used : http://northconcepts.com/data-pipeline/ javadocs : http://northconcepts.com/data-pipeline/javadocs/ Example CSV : Name ProfileImageURL Location CreatedAt FollowRequestSent IsTranslator DefaultProfile FavouritesCount ContributorsEnabled The Guardian London The Guardian London The Guardian London Thu Nov 05 23:49:19 +0000 2009 130 The Guardian London Thu Nov 05 23:49:19 +0000 2009 130 The Guardian London Thu Nov 05 23:49:19 +0000 2009 130 http://pbs.twimg.com/profile_images/2814613165/f3c9e3989acac29769ce01b920f526bb_normal.png FALSE FALSE FALSE FALSE Here the URL given above is for the second column.
linked to: http://stackoverflow.com/q/18007858
tagged with: read-write
has title: JSON to CSV : Multiple Data Rows
has comment: http://stackoverflow.com/comment/38061796
has comment: http://stackoverflow.com/comment/38065386
has comment: http://stackoverflow.com/comment/38065359
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/24441999
has comment: http://stackoverflow.com/comment/37820292
type: AcceptedAnswer
downvote count: 0
has body: I don't see a way around using the result set, but you could get around having to set the boolean by just doing return ps.executeQuery().next(); and then close your statement and resultset in the finally block.
type: Answer
has comment: http://stackoverflow.com/comment/37820346
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24441944
answers question: http://stackoverflow.com/q/24441944
has comment: http://stackoverflow.com/comment/37820284

http://stackoverflow.com/a/24507239
answers question: http://stackoverflow.com/q/24505617
type: Answer
has body: First, I am guessing that this List&lt;String&gt; newList = new ArrayList&lt;String&gt;(); should be inside the loop you are updating your HashMap otherwise as @tobias_k mentioned you are inserting the same value to every key. I guess you don't want that. You can use keySet() to get the key of your Map and loop in it: Set&lt;String&gt; set = pmMap.keySet(); for(String key : set) { ArrayList&lt;String&gt; list = null; if(value1.equals(key)) { list = pmMap.get(key); list.add(value2); pmMap.put(key, list); } I haven't checked the code but you got the idea.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24505617

http://stackoverflow.com/comment/37975824
type: AnswerComment
comment on: http://stackoverflow.com/a/24526045
type: Comment
has text: yes brother, i want to make a List, in which each List key contains another List inside it.
score: 0

http://stackoverflow.com/comment/38011395
comment on: http://stackoverflow.com/q/24544699
score: 0
has text: well i tried your rest endpoint dropping it mine, ran on tomcat. It returns the string without any exception, Waiting for other responses.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37831348
has text: I have two contents that I want to switch between.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24437097

http://stackoverflow.com/a/24661488
type: Answer
has body: You may have to change the entity like below. As far as I remember, if you are trying to set the foreign key of a column this works best. @Entity @Table(name="test_details") public class TestDetails implements Serializable { @Id //Generator @Column(name = "id", updatable = false, insertable = false) protected Long id; @Column(name="order_id_fk", updatable = false, insertable = false) private TestOrder orderId; //getters and setters }
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38261544
score: 0
answers question: http://stackoverflow.com/q/24487865

http://stackoverflow.com/q/24560626
has body: Hi I am developing in Android and I want to use my cellphone camera to do something. I am using OpenCV-2.4.9 Java package to extract HOG feature, but I am confused about the output vector. My image size is 480x640. I set the window to be 48x64, blocksize 24x32, cellsize 12x16 and 8 bins for each cell. So for each window, I should get a 128 dimension data to describe it. After running the following code: MatOfFloat keyPoints = new MatOfFloat(); Hog.compute(imagePatch, keyPoints); keyPoints is a array whose length is 172800 (I think it is 1350x128). I think there should be a parameter to set the window stride to control the number of windows. In the library, there also another function to control the window stride: public void compute(Mat img, MatOfFloat descriptors, Size winStride, Size padding, MatOfPoint locations) but I dont know the meaning of the parameters. Could anyone help me to figure this out?
has title: HOG parameters in OpenCV Java Version
type: Question
score: 4
has answer: http://stackoverflow.com/a/24562589
accepted answer: http://stackoverflow.com/a/24562589
answer count: 1
favorite count: 0
tagged with: android
upvote count: 4
tagged with: opencv
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/37985760
type: Comment
comment on: http://stackoverflow.com/a/24531340
type: AnswerComment
has text: It don't works.. theValue variable text value is gas.id, not the real id
score: 0

http://stackoverflow.com/a/24571370
accepted answer of: http://stackoverflow.com/q/24549971
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I think the best two options are: 1) Modify your JS object to have only simple objects. If you look at your request URL before your update, you had: {your IP:port}/contracts/?dateFrom=02-07-2014&amp;dateTo=02-07-2014&amp;season%5BseasonCode%5D=SO03 That is not JSON at all, is a simple request with three parameters: dateFrom = 02-07-2014 dateTo = 02-07-2014 season%5BseasonCode%5D= SO03 // %5B and %5D are '[' and ']' escaped So your javascript is transforming a JS object (not JSON) in plain parameters. 2) Send a parameter, a string, with your JSON structure and then use some JSON library to parse it: http://localhost:8080/contracts/?myJson=&lt;JSON_String&gt; and then modify your controller as: @RequestMapping(value="/", method=RequestMethod.GET, headers="Accept=text/plain") public ResponseEntity&lt;String&gt; getVertagFromSearch(@RequestParam String myJson, ModelMap model){ JSONObject myJSON= new JSONObject (myJson); ... } Usually sending a JSON is easier with a POST (just adding it to the body), but as your request seems to ask for data, a POST request is not a good idea. Most of the rest APIs use the first approach, JSON tends to be part of a response more than part of a GET request.
answers question: http://stackoverflow.com/q/24549971
upvote count: 1
has comment: http://stackoverflow.com/comment/38064031
score: 1

http://stackoverflow.com/q/24575203
has comment: http://stackoverflow.com/comment/38067760
score: 1
tagged with: java
tagged with: javadoc
has comment: http://stackoverflow.com/comment/38067680
has comment: http://stackoverflow.com/comment/38074127
type: Question
downvote count: 0
tagged with: stack-overflow
tagged with: netbeans-8
has comment: http://stackoverflow.com/comment/38067486
has comment: http://stackoverflow.com/comment/38069155
favorite count: 0
has title: Netbeans 8.0 JavaDoc java.lang.StackOverflowError
has comment: http://stackoverflow.com/comment/38068435
type: UnansweredQuestion
upvote count: 1
has body: I have a problem with JavaDoc. I try to generate the JavaDoc for my project, but Netbeans 8 returns this error: This is the error code: http://paste2.org/XaGpfs0t I'm on Ubuntu 14. any idea? Thank you for help! EDIT: ant -f /home/mex/NetBeansProject/web_search/web_engines_evaluator -Dnb.internal.action.name=javadoc javadoc init: Generating Javadoc Javadoc execution Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/ConnectYahoo.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/DistanceComparator.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/GsonBingItem.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/GsonDistanceItem.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/GsonGoogleItem.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/GsonYahooItem.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/ParserStimoli.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/SLemmatizer.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/SearchItem.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/SemanticDistance.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/StHttpRequestYahoo.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluator/Stopwords.java... Loading source file /home/mex/NetBeansProject/web_search/web_engines_evaluator/src/web_engines_evaluat…
answer count: 0

http://stackoverflow.com/comment/38074713
has text: For about the millionth time, don't wait for stuff in GUI event-hanler threads, ever.
comment on: http://stackoverflow.com/q/24578517
type: Comment
type: QuestionComment
score: 0

sshj
tags question: http://stackoverflow.com/q/24519462
tag name: sshj
type: Tag

http://stackoverflow.com/q/24436932
has answer: http://stackoverflow.com/a/24437226
score: 0
has comment: http://stackoverflow.com/comment/37810712
answer count: 1
has comment: http://stackoverflow.com/comment/37817922
tagged with: ubuntu-13.10
has comment: http://stackoverflow.com/comment/37818797
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37816175
has body: Ok i am running a webapp in eclipse using tomcat6. The problem is the application needs to create a subfolder in opt/resources. When i run : new File("/opt/resources"+resource_name).mkdir(); then new File("/opt/resources"+resource_name+'img/').mkdir(); I get an ioexception :error creating directories when i run only new File("/opt/resources"+resource_name).mkdir(); I get no errors but folder is not created, this only happens in ubuntu I tried changing the owner of /opt/resources to tomcat and 777 none worked.
tagged with: java
has comment: http://stackoverflow.com/comment/37810626
type: Question
tagged with: jakarta-ee
has title: Ubuntu IOException creating directories

http://stackoverflow.com/q/24432174
tagged with: java
tagged with: special-characters
has answer: http://stackoverflow.com/a/71729857
tagged with: printing
has answer: http://stackoverflow.com/a/24433504
downvote count: 0
favorite count: 0
tagged with: dbf
possible better answer: http://stackoverflow.com/a/24436667
has title: Changing the Character set of a .dbf file
answer count: 5
has answer: http://stackoverflow.com/a/29772984
linked to: http://stackoverflow.com/q/4750806
has answer: http://stackoverflow.com/a/24455990
accepted answer: http://stackoverflow.com/a/24455990
type: AnsweredQuestion
has body: I have this java application that should load and print data with french special characters from a .dbf or dBase3 file but it doesn't work; the characters are not showing. I asked this question thinking that the problem was related only to the printing, but if you see the comments you can understand that i figured out that the problem was related to the database and not to the printing, since when adding a special character to my JTextPane, it prints normally... and i tried changing the character set of the textPane but still the same problem. Also, to complicate even more the question for those out there that love solving difficult problems, when i use MS Access to open my .dbf file, the characters are there. So i'm thinking, the error probably happens while loading the data from the database... By the way, to do data fetching, i'm using this API called xBaseJ that doesn't use sql, but it's own implementation. I hope i have given all the necessary details and also i'd really appreciate any help, really.. any idea could help me figure out the solution (and the problem too). Edit Now, with the Answer of Ethan Furman, we know that the problem is related to the encoding of database wich is Plain old Ascii and it's not related to the xBaseJ API. Now, the question should be: Is it possible to change the encoding of a dBase database? And how can i do it? Thank you @Ethan Furman, And thanks in advance for any help related to this question.
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/24429009
has answer: http://stackoverflow.com/a/24436667
score: 1

http://stackoverflow.com/q/24469459
accepted answer: http://stackoverflow.com/a/24712498
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I have to implement a scanline algorithm from our professor but I don't really understand how I get the intersection points from the scanline with a polygon. Here is the algorithm: I implemented my own polygon(with methods like paint(), contains() and so on) already and I have all edges from the polygon saved in an array like this: int[] pointsX; int[] pointsY; and I have the min and max values for x and y saved in int ymin, ymax, xmin, xmax; So my first thought is that I have to create a scanline starting from 0,ymin and check in a loop if the next point is inside the polygon. I implemented this method like this: public boolean contains(Point test) { boolean result = false; java.awt.Polygon polygon = new java.awt.Polygon(pointsX, pointsY, pointsX.length); if (polygon.contains(test)) { result = true; } return result; } So when the next point is inside the polygon, I have a intersection point and so on. For this i have this loop: ArrayList&lt;Point&gt; intersectionPoints = new ArrayList&lt;&gt;(); wasInside = false; for (int yTemp = ymin; yTemp &lt;= ymax; yTemp++) { for (int xTemp = xmin; xTemp &lt;= xmax; xTemp++) { if (wasInside != this.contains(new Point(xTemp, yTemp))) { intersectionPoints.add(new Point(xTemp, yTemp)); wasInside = !wasInside; } } } But I got a hint that this is no proper solution from my stackoverflow question. Can someone give me a hint, how I can start implementing the algorithm from my professor? Where do I get the x1,y1,x2,y2,c points? I know that these are the edges but how do I know which edges do I have to take? EDIT: OK, now I have all Edges sorted by their y values. Can I calculate the intersection points with the given formula Sx=x1+(x2-x1)/...? My first try looks like this: for (int c = ymin; c &lt;= ymax; c++) { for (int xTemp = xmin; xTemp &lt;= xmax; xTemp++) { for (int currentEdge = 0; currentEdge &lt; edges.size() - 1; currentEdge++) { int x1 = edges.get(currentEdge).x; int x2 = edges.get(currentEdge + 1).x; int y1 = edges.get(cu…
has comment: http://stackoverflow.com/comment/37884841
has comment: http://stackoverflow.com/comment/37874836
linked to: http://stackoverflow.com/q/24467457
has answer: http://stackoverflow.com/a/24712498
has comment: http://stackoverflow.com/comment/37884923
upvote count: 1
type: AnsweredQuestion
tagged with: scanline
has title: Scanline algorithm: how to calculate intersection points
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37884791

http://stackoverflow.com/q/24508424
tagged with: javascript
tagged with: jquery
linked to: http://stackoverflow.com/q/15201071
favorite count: 0
type: Question
downvote count: 8
duplicate of: http://stackoverflow.com/q/15201071
answer count: 1
tagged with: java
has title: how to get uploaded file full path in javascript. Always it returns c:\fakepath. I want full path for my servlet
type: UnansweredQuestion
score: -8
has body: How can I get the full path of an uploaded file in javascript? It always returns c:\fakepath. This file path is sent directly to the controller using jquery. So, I want the full path for my servlet. Is there any other way?
has answer: http://stackoverflow.com/a/24508557
upvote count: 0

http://stackoverflow.com/a/24560437
answers question: http://stackoverflow.com/q/24560223
has body: In Chrome you can right click -> Inspect Element and go to the Network tab. Refreshing the page will begin tracking the page you are on. When you send out requests, the request log will record them.
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/24533889
type: Answer
has comment: http://stackoverflow.com/comment/37991485
accepted answer of: http://stackoverflow.com/q/24533811
score: 1
has comment: http://stackoverflow.com/comment/37991611
upvote count: 1
answers question: http://stackoverflow.com/q/24533811
has comment: http://stackoverflow.com/comment/37991518
has body: You are continuously updating the same object. You just need to create the UserCountry and UserLanguage inside the loop. As of now you are creating outside the loop. Just move them inside the loops. For ex : for (String s : user_country) { UserCountry userCountry = new UserCountry(); userCountry.setUserId(intIdUser); userCountry.setCountryId(Integer.parseInt(s)); session.getTransaction().begin(); session.persist(userCountry); session.getTransaction().commit(); }
has comment: http://stackoverflow.com/comment/37991741
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37991558
has comment: http://stackoverflow.com/comment/37992323

http://stackoverflow.com/a/33152133
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24498345
upvote count: 1
has body: When you define a column with DOUBLE PRECISION Oracle automatically converts it to FLOAT which could be verified with the SQL statement DESCRIBE &lt;TABLE&gt;;. By default, there is no mapping of Types.DOUBLE to float. See Hibernate: Found: float, expected: double precision for adding this mapping via extending the class Oracle10gDialect.
score: 1

http://stackoverflow.com/q/24540894
tagged with: libgdx
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24541272
type: Question
upvote count: 0
answer count: 1
has title: How can I access a class other than though passing in a method?
has body: Let us say we have a class called World. Which contains a class called Data. We also have a third class called Input. If Input.clicked(Event event, int x, int y) were to be called I would not be able to access World which means I can't access Data. How do you go about resolving this? Another way to ask this might be: How can you access something in a method from another class that can't be changed when what you need to access is not final? Sorry, I am having a hard time explaining this. Update bit: The world class already exists, can't create a new one. It would be inside the Game class. Here is a code example, not working code. More pseudo. public class World { Data data = new Data(); Input input = new Input(); public void update(float delta) { input.getInput(); input.makeChangesBasedOnInput(); } public void render(float delta) { } } public class Data { public int importantNumber; // Static is not an option // For me I have to get a user name... but same idea here public Data() { Random ran = new Random(); importantNumber = ran.nextInt(1000); } } public class Input { Button button = new Button(); public Input() { // passing the World class does not work, ex. public Input(World world) { button.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { // I can't add world here... // HERE IS ISSUE System.out.println(World.Data.importantNumber); } } } public void getInput() { // MAGIC } public void makeChangesBasedOnInput() { // MAGIC } } Update 2: Here is another example of what I am trying to do with TextButton &amp; ClickListener from libgdx. statsButton is a TextButton() from libgdx.
has answer: http://stackoverflow.com/a/24541272
favorite count: 0
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/24545645
has title: How to write the output of reducer once
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/38070670
upvote count: 1
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
has body: I am new to hadoop.While working on the samples I came to know that OutputCollector of reducer write the output(part-0000) for each key and value pair by appending it. For eg: my k-v pair for reducer is sachin#mumbai then reducer will write at part-0000 as sachin mumbai Then other k-v pair is rajni#chennai then reducer append part-0000 as sachin mumbai rajni chennai What my doubt is ..is it possible to write the output(all k-v pairs)only once
score: 1
tagged with: java

http://stackoverflow.com/comment/37966695
type: AnswerComment
comment on: http://stackoverflow.com/a/24520559
type: Comment
has text: With that knowledge, then it is pretty hard to create a multi-threaded console app, when multiple threads are using readline, there will be a lot of blocking and thus defeating the purpose of multithreaded.
score: 0

http://stackoverflow.com/comment/38025306
comment on: http://stackoverflow.com/q/24551989
score: 0
type: Comment
type: QuestionComment
has text: "Which is best?", in situations like this, is very much in the eye of the beholder. In many cases you should just use the literal string inline in your code and not define a "variable" to hold it. In other cases what you do is pretty well defined by translation concerns. And if the variable needs to be easily modified (eg, it's a URL or some such) then placing it at the top makes it easier to find, even if only used in one place.

http://stackoverflow.com/comment/37904832
has text: Have you used `finish()` whole starting new activity?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24487327

http://stackoverflow.com/q/24453515
has answer: http://stackoverflow.com/a/24471895
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
score: 0
answer count: 1
has body: A am trying to save data from MapReduce job into HBase. We made script which work great on older versions of Hadoop (CDH3u4). Now we upgraded to the newest version (CDH 5.0.2) and script is not working. When I run the program on newest version, I get following error: Exception in thread "main" java.lang.RuntimeException: java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.hadoop.hbase.mapreduce.TableOutputFormat.setConf(TableOutputFormat.java:211) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:73) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:455) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:343) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1295) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1292) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1292) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1313) at com.nrholding.t0_mr.main.ELogHBaseImport.main(ELogHBaseImport.java:89) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) Caused by: java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:389) at org.apache.hadoop.hbase.client.HConnectionManager.createConnection(HConnectionManager.java:366) at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(HConn…
accepted answer: http://stackoverflow.com/a/24471895
tagged with: hbase
has title: Import data from MapReduce to HBase (TableOutputFormat error)

http://stackoverflow.com/q/24471104
score: 0
has comment: http://stackoverflow.com/comment/37874208
has comment: http://stackoverflow.com/comment/37874123
has comment: http://stackoverflow.com/comment/37874172
tagged with: arrays
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/390181
has comment: http://stackoverflow.com/comment/37874149
has title: May I shrink an array to save memory in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24471191
accepted answer: http://stackoverflow.com/a/24471191
has comment: http://stackoverflow.com/comment/37874204
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37874166
type: Question
has body: For instance, I have a 2-D array: 1 2 3 4 5 6 7 8 9 10 11 12 It's an 3 by 5 array. However, in the third row, I only need to fill two cells. The remaining ones are unnecessary, but it's created when initializing the array. The reason I want to so this is that my actual array's row is very long, so that potentially wastes a big chunk of memory, because i only need to use two cells in the 3rd row. Is there a way to shorten the third row to contain two cells only after the array is filled up? I am not sure it's possible, or it's the best way to do it. Thank you.
tagged with: java

http://stackoverflow.com/comment/38033306
has text: Don't confuse "import" with "class loading". All you're doing here is saving keystrokes: ResultSet versus java.sql.ResultSet. I prefer NOT using the * notation - ever. A good IDE (e.g. IntelliJ) will insert import statements for you. Spell them out.
score: 1
comment on: http://stackoverflow.com/q/24556814
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37895773
type: Comment
type: QuestionComment
has text: What i want is to send data to the url, and then open it according the parameters. To get the screen in the android web browser to add the information of the user, like credit card, stuff like that
comment on: http://stackoverflow.com/q/24482379
score: 0

http://stackoverflow.com/q/24531606
has comment: http://stackoverflow.com/comment/38011755
tagged with: eclipse
has title: Java.lang.nullPointerException in android eclipse when make calculator
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37986691
has answer: http://stackoverflow.com/a/24531955
tagged with: calculator
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24532071
has comment: http://stackoverflow.com/comment/37986007
has body: i develop apps android calculator, but when i try to run, i just found error on logCat 07-02 19:41:00.152: ERROR/AndroidRuntime(577): Caused by: java.lang.NullPointerException this my coding : package kalkulator.stekom; 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 kalkulator extends Activity { /** Called when the activity is first created. */ Button btnReset, btnSatu, btnDua, btnTiga, btnEmpat, btnLima, btnEnam, btnTujuh, btnDelapan, btnSembilan, btnNol, btnKali, btnBagi, btnKurang, btnTambah, btnSamadengan ; EditText txtDisplay; private double total1=0.0; private double total2=0.0; private char operasi_matematika; private String temp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txtDisplay = (EditText)findViewById(R.id.txtDisplay); btnSatu = (Button)findViewById(R.id.btnSatu); btnDua = (Button)findViewById(R.id.btnDua); btnTiga = (Button)findViewById(R.id.btnTiga); btnEmpat = (Button)findViewById(R.id.btnEmpat); btnLima = (Button)findViewById(R.id.btnLima); btnEnam = (Button)findViewById(R.id.btnEnam); btnTujuh = (Button)findViewById(R.id.btnTujuh); btnDelapan = (Button)findViewById(R.id.btnDelapan); btnSembilan = (Button)findViewById(R.id.btnSembilan); btnNol = (Button)findViewById(R.id.btnNol); btnKali = (Button)findViewById(R.id.btnKali); btnBagi = (Button)findViewById(R.id.btnBagi); btnTambah = (Button)findViewById(R.id.btnTambah); btnKurang = (Button)findViewById(R.id.btnKurang); btnReset = (Button)findViewById(R.id.btnReset); //tombol satu btnSatu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String btnSatuText = txtDisplay.getText().toString() + btnSatu.getText().toString(); txtDisplay.setText(btnSatuText); } }); //tombol dua btnDua.setOnClickListener(new View.OnClickL…
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java

http://stackoverflow.com/a/24456776
downvote count: 0
score: 24
type: AcceptedAnswer
has body: Only two things are required in Eclipse for this: One In Eclipse, Window -> Preferences -> Server -> Runtime Environment Specify your Web Server or Application Server path, by adding a "New Server Runtime Environment". Update Initially, there are only few Server Runtime Environments available with Eclipse like: Apache Basic ObjectWeb On an additional note, you can add more Server Adapters using the link Download additional server adapters in Server Runtime Environments dialog screen. Two In Project Properties (Right Click on Project -> Properties), in Java Build Path, add Library "Server Runtime". On adding Server Runtime to Project Library will add servlet-api.jar and jsp-api.jar jars to project dependencies.
type: Answer
upvote count: 24
has comment: http://stackoverflow.com/comment/37847456
has comment: http://stackoverflow.com/comment/37847570
has comment: http://stackoverflow.com/comment/37847504
accepted answer of: http://stackoverflow.com/q/24456446
answers question: http://stackoverflow.com/q/24456446

http://stackoverflow.com/q/24524920
type: Question
has body: I have beeen trying to run a Google Bigquery Query from my java eclipse, using the Complete Source Code that is presented in the BigQuery API Quickstart page: https://developers.google.com/bigquery/bigquery-api-quickstart#authorizing The code was changed to fit my project, all the client libraries are installed, and I keep getting this error message after running : Exception in thread "main" java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.(Lcom/google/api/client/http/HttpTransport;Lcom/google/api/client/json/JsonFactory;Ljava/lang/String;Ljava/lang/String;Lcom/google/api/client/http/HttpRequestInitializer;Z)V at com.google.api.services.bigquery.Bigquery.(Bigquery.java:108) at com.google.cloud.helix.samples.BigQuery.main(BigQuery.java:61) the code Im using is this: package com.google.cloud.helix.samples; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson.JacksonFactory; import com.google.api.client.util.Data; import com.google.api.services.bigquery.Bigquery; import com.google.api.services.bigquery.BigqueryScopes; import com.google.api.services.bigquery.model.GetQueryResultsResponse; import com.google.api.services.bigquery.model.QueryRequest; import com.google.api.services.bigquery.model.QueryResponse; import com.google.api.services.bigquery.model.TableCell; import com.google.api.services.bigquery.model.TableRow; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.…
tagged with: google-bigquery
has comment: http://stackoverflow.com/comment/37975786
has comment: http://stackoverflow.com/comment/37978647
tagged with: api
has comment: http://stackoverflow.com/comment/37987088
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37978877
has comment: http://stackoverflow.com/comment/37979661
has comment: http://stackoverflow.com/comment/37987490
has answer: http://stackoverflow.com/a/24532629
score: 2
has comment: http://stackoverflow.com/comment/37987214
has title: BigQuery API Quickstart Complete Source Code (Java) error
tagged with: java
has comment: http://stackoverflow.com/comment/37973729
has comment: http://stackoverflow.com/comment/37987576

http://stackoverflow.com/comment/37883199
comment on: http://stackoverflow.com/q/24475737
score: 0
has text: @OliCharlesworth same?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24577640
has body: I have an activitiy where I have a button and when a click on this button I want to set a TextView with some value, so I used onClickListening and it is working: ButtonPlus.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { ponts = ponts + 1; resultadoTextView.setText(Integer.toString(ponts)); } }); But the problem is that I want to keep increasing this textView's value while the button keep being pressed so I tried to use the OnTouchLister: ButtonPlus.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { ponts = ponts + 1; resultTextView.setText(Integer.toString(ponts)); } }); the problem is that when I give a fast click in the button it increments the TextView's value too much and I want the onTouchListener to be activated just after some time that the button was pressed. any help please?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/38072314
score: 1
tagged with: java
tagged with: ontouchlistener
type: Question
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24577818
tagged with: click
favorite count: 0
tagged with: android
has title: Android - OnTouchListener() is triggered too early
has answer: http://stackoverflow.com/a/24577947
accepted answer: http://stackoverflow.com/a/24577947
has answer: http://stackoverflow.com/a/24577818

http://stackoverflow.com/q/24428029
has title: Best way to perfectly hash a three letter lowercase String in Java?
type: Question
downvote count: 0
tagged with: string
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24428134
has answer: http://stackoverflow.com/a/24428522
tagged with: perfect-hash
tagged with: hash
upvote count: 2
type: UnansweredQuestion
has body: My current solution uses a multi-dimensional array, does a simpler solution exist? I want to access the hashed objects in O(1) time and want to make best use of memory space hence the need for a perfect hash. public final class PerfectHash { private Object[][][] hashtable = new Object[26][26][26]; public void storeObjectAgainst3letterStringKey(Object o, String s){ int[] coord = stringToCoord(s); hashtable[coord[0]][coord[1]][coord[2]] = o; } public Object get(String s){ int[] coord = stringToCoord(s); return hashtable[coord[0]][coord[1]][coord[2]]; } private int[] stringToCoord(String s){ if (!s.matches("[a-z][a-z][a-z]")){ throw new IllegalStateException("invalid input, expecting 3 alphabet letters"); } // 1-26 // 1-26 // 1-26 String lowercase = s.toLowerCase(); // 97-122 integers for lower case ascii int[] coord = new int[3]; for (int i=0;i&lt;lowercase.length();++i){ int ascii = (int)lowercase.charAt(i); int alpha = ascii - 97; // 0-25 coord[i] = alpha; } return coord; } }
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/24428294

http://stackoverflow.com/comment/37989054
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24526128
has text: Thank you very much ! This works fine, now I'll try to figure out why it does so I'm gonna dive deeper in the documentation but thanks to you I know which way to look :D

http://stackoverflow.com/comment/37869040
score: 0
type: AnswerComment
has text: Well, yes, you're setting the position there. But then it gets updated by the `put()` calls. You need to reset the position to 0 **after** making the `put()` calls.
type: Comment
comment on: http://stackoverflow.com/a/24468267

http://stackoverflow.com/q/24520602
has answer: http://stackoverflow.com/a/24531432
type: Question
has comment: http://stackoverflow.com/comment/37985225
has comment: http://stackoverflow.com/comment/132761983
has answer: http://stackoverflow.com/a/51123749
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/67683824
has answer: http://stackoverflow.com/a/50832816
has answer: http://stackoverflow.com/a/78030275
possible better answer: http://stackoverflow.com/a/52679560
has comment: http://stackoverflow.com/comment/37972315
tagged with: java
has answer: http://stackoverflow.com/a/52679560
tagged with: spring-data
has comment: http://stackoverflow.com/comment/37985391
accepted answer: http://stackoverflow.com/a/24531432
has answer: http://stackoverflow.com/a/57643432
has comment: http://stackoverflow.com/comment/87863403
has answer: http://stackoverflow.com/a/24520760
tagged with: jpa
has answer: http://stackoverflow.com/a/53614557
score: 90
tagged with: spring-data-jpa
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/48416927
downvote count: 0
has comment: http://stackoverflow.com/comment/87236526
answer count: 10
has title: Spring data jpa- No bean named 'entityManagerFactory' is defined; Injection of autowired dependencies failed
has body: I'm developing application using spring data jpa,hibernate,mysql,tomcat7,maven and it's create error.I'm trying to figure it out but i failed. error are Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; No bean named 'entityManagerFactory' is defined; Injection of autowired dependencies failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initDbService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.wahid.cse.repository.RoleRepository org.wahid.cse.service.InitDbService.roleRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleRepository': Cannot create inner bean '(inner bean)#c08f81' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#c08f81': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:30…
upvote count: 90
favorite count: 0
has answer: http://stackoverflow.com/a/52435768

http://stackoverflow.com/a/24486718
score: 0
has body: i think you adapter contains the total data before loading again,,, Can you use your clearList() method before loading the adapter in your list.. OR: clear the adapter before loading like: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //Here clear the adapter if it contains simething if(listAdapter != null){ listAdapter.clear(); } listAdapter = new WiFiPeerListAdapter(this.getActivity(), android.R.layout.simple_list_item_2, peers); setListAdapter(listAdapter); } Check it once
type: Answer
answers question: http://stackoverflow.com/q/24485839

http://stackoverflow.com/q/24466480
tagged with: delphi
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24469043
has comment: http://stackoverflow.com/comment/37865457
has title: Java can't parse the datetime value which from Datasnap server
linked to: http://stackoverflow.com/q/24428075
has comment: http://stackoverflow.com/comment/37869292
type: UnansweredQuestion
has body: This question derive from "DataSnap return empty dataset" I think it is a another question, so I create a new thread in here. I write a DataSnap rest server which return a dataset with a TDateTime field. function TServerMethods1.GetDataSet: TDataset; begin FDQuery1.SQL.Clear; FDQuery1.SQL.Text := 'select EmployeeID, LastName, FirstName, BirthDate from Employees'; FDQuery1.Open(); Result := FDQuery1; end; But my android client(Java) can't parse the datetime value which get from server. I tracking the Json data from server, and found the TDatetime type value: "BirthDate":["1948-12-08.0","1952-02-19.0","1963-08-30.0"] Every date value append with a ".0" tail. So, Java can't transform back to Date type: Then, I add a new server method to test return TDateTime type: function TServerMethods1.GetDateTime: TDateTime; begin Result := int(Now); end; DataSnap also put it into the style below: {"result":["2014-06-27.0"]} So, How to fix this bug in Java client? [Update, A temporary solution]---------------------- @BasilBourque, Thank you. You gave me some inspiration. I think it is a big workload If replace Java classes or class libraries. So I chose a simple solution. Now, I fixed the Java code file "DBXDefaultFormatter.java" which automatically generated by DataSnap server. DBXDefaultFormatter.java, Line 257, The original code: public Date StringToDateTime(String value) throws ParseException { return datetimeFormatter.parse(value); } The fixed code: public Date StringToDateTime(String value) throws ParseException { if ((value.length() == 12) &amp; (value.endsWith(".0"))) { return dateFormatter.parse(value); } else { return datetimeFormatter.parse(value); } } I know, this is not a perfect solution, but it's basically will be enough.
has comment: http://stackoverflow.com/comment/37866913
has comment: http://stackoverflow.com/comment/37867308
tagged with: java
has answer: http://stackoverflow.com/a/24480373
has comment: http://stackoverflow.com/comment/37870200
has comment: http://stackoverflow.com/comment/37877379
type: Question
tagged with: datasnap
has comment: http://stackoverflow.com/comment/37867403
has comment: http://stackoverflow.com/comment/37878126

http://stackoverflow.com/q/24451207
type: Question
has comment: http://stackoverflow.com/comment/37837266
has comment: http://stackoverflow.com/comment/37837317
score: 0
has comment: http://stackoverflow.com/comment/37836876
has answer: http://stackoverflow.com/a/24451615
answer count: 1
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/37836916
type: UnansweredQuestion
tagged with: interface
has body: I have created a async task which does all the background task.In that async task class i have made a interface with method finish.It is used to let me noe that the background task is over.But when ever i am using that interface i am getting it null Async Class public static class SearchJobsAsync extends AsyncTask&lt;String, String, String&gt; { String response; boolean value; Context c; finished finished; public SearchJobsAsync(Context c, SearchJobsAsync.finished finished,boolean value) { this.c = c; this.finished = finished; this.value=value; } public static interface finished { void Finish(boolean finish); } SearchJobsAsync(Context c, boolean value) { this.value = value; this.c = c; } @Override protected String doInBackground(String... strings) { if (spYears.getSelectedItemPosition () == 0 &amp;&amp; spMonths.getSelectedItemPosition () == 0 &amp;&amp; spToYears.getSelectedItemPosition () == 0 &amp;&amp; spToMonths.getSelectedItemPosition () == 0) { response = HttpRequest.post ("https://beta135.hamarisuraksha.com/web/WebService/HsJobService.asmx/FindJobForVendor").send ("Vendor_IEntity_Code=" + "34588A34-E969-4723-84FE-E5409B66A5B7" + "&amp;Job_Code=" + "" + "&amp;Job_Category=" + strCategory + "&amp;Exp_Years_From=0" + "&amp;Exp_Months_From=0" + "&amp;Exp_Years_To=99" + "&amp;Exp_Months_To=99").body (); } else if (spYears.getSelectedItemPosition () == 0) { response = HttpRequest.post ("https://beta135.hamarisuraksha.com/web/WebService/HsJobService.asmx/FindJobForVendor").send ("Vendor_IEntity_Code=" + "34588A34-E969-4723-84FE-E5409B66A5B7" + "&amp;Job_Code=" + "" + "&amp;Job_Category=" + strCategory + "&amp;Exp_Years_From=0" + "&amp;Exp_Months_From=" + strMnths + "&amp;Exp_Years_To=" + strToYrs + "&amp;Exp_Months_To=" + strToMnths).body (); } else if (spMonths.getSelectedItemPosition () == 0) { response = HttpRequest.post ("https://beta135.hamarisuraksha.com/web/WebService/HsJobService.asmx/FindJobForVendor").send ("Vendor_IEntity_Code=" + "34588A34-E969-4723-84F…
tagged with: android
has title: Getting null while using interface method
tagged with: java
has comment: http://stackoverflow.com/comment/37836821

semaphore
type: Tag
tags question: http://stackoverflow.com/q/24517891
tag name: semaphore

http://stackoverflow.com/q/24447193
has title: What is the beginning and end of a Lucene token stream when parsing a query?
has answer: http://stackoverflow.com/a/24447567
type: AnsweredQuestion
tagged with: java
tagged with: solr
has comment: http://stackoverflow.com/comment/37829931
type: Question
accepted answer: http://stackoverflow.com/a/24447567
has body: We're trying to implement a custom filter that needs to remember past tokens that were processed before within the same query. We tried overriding the end() and/or reset() methods from TokenFilter but found out that these methods were called between each token. This was contrary to our expectation of the end() and/or reset() methods only being called at the beginning or end of the token stream representing the query. This unexpected behavior can be reproduced by the following example code below. (solr) schema snippet: &lt;fieldType name="text_general" class="solr.TextField"&gt; &lt;analyzer type="index"&gt; ... &lt;/analyzer&gt; &lt;analyzer type="query"&gt; &lt;tokenizer class="solr.WhitespaceTokenizerFactory"/&gt; &lt;filter class="com.foobar.solr.CustomFilterFactory" /&gt; &lt;/analyzer&gt; &lt;/fieldType&gt; Filter implementation: public class CustomFilter extends TokenFilter { CharTermAttribute termAttribute = addAttribute(CharTermAttribute.class); public CustomFilter(TokenStream in) { super(in); } @Override public boolean incrementToken() throws IOException { System.out.println("### increment token pre loop: " + termAttribute.toString()); while (input.incrementToken()) { System.out.println("### increment token looping through input: " + termAttribute.toString()); } return false; } @Override public void end() throws IOException { System.out.println("### end"); super.end(); } @Override public void reset() throws IOException { System.out.println("### reset"); super.reset(); } } Log output for the query "foo bar": ### reset ### increment token pre loop: ### increment token looping through input: foo ### end ### reset ### increment token pre loop: ### increment token looping through input: bar ### end Why are the end() and reset() methods called for each token instead of for the complete query? Edit: Or why is input.incrementToken() returning false after the first token was processed?
has comment: http://stackoverflow.com/comment/37829725
tagged with: lucene
has comment: http://stackoverflow.com/comment/37830040
score: 0
has comment: http://stackoverflow.com/comment/37829567
answer count: 1

http://stackoverflow.com/comment/37847485
comment on: http://stackoverflow.com/q/24456605
has text: Are you sure you call it as an object method (non-static) instead of class method (static)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24516003
has comment: http://stackoverflow.com/comment/37957837
has comment: http://stackoverflow.com/comment/37957865
score: 4
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38031826
has comment: http://stackoverflow.com/comment/37958187
has body: You need to override toString method on your Keys object. Otherwise you will get the default toString provided by java.lang.Object. You could implement the toString method to look something like this: public class Keys { private final Integer i; private final String s; public Keys(Integer i, String s) { this.i = i; this.s = s; } @Override public String toString() { return i + "," + s; } } if you want the quotes to be displayed then you'd need to provide those: return i + ",\"" + s + "\""; You'll also need to override the equals and hashCode for this object to be used as a key in a map: @Override public boolean equals(Object o) { if (!(o instanceof Keys)) { return false; } Keys other = (Keys)o; return other.s.equals(s) &amp;&amp; other.i.equals(i); } @Override public int hashCode() { return toString().hashCode(); } If you don't override equals and hashcode, then the map uses the default implementations, which results in two Keys objects with the same values being unequal.
answers question: http://stackoverflow.com/q/24515940
has comment: http://stackoverflow.com/comment/37976401

http://stackoverflow.com/comment/37992343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24532256
has text: If you have to you should set JAVA_HOME to `export JAVA_HOME=$(/usr/libexec/java_home)` i.e. get the OS to reference the most up-to-date version of java.
score: 0

http://stackoverflow.com/comment/37870014
score: 0
has text: when i run the project in eclipse
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24468875

http://stackoverflow.com/comment/37897574
score: 0
type: AnswerComment
type: Comment
has text: When I run the code and just print out what is returned from `doc.select("#tr_51187955")` (before narrowing it down further) in `getPrice` it prints the html as if it didn't login.
comment on: http://stackoverflow.com/a/24483175

http://stackoverflow.com/comment/37861377
type: Comment
score: 3
comment on: http://stackoverflow.com/a/24464308
type: AnswerComment
has text: @alfasin by answering with my own solution, i'm implicitly claiming this way is more efficient.

http://stackoverflow.com/comment/37928916
score: 0
type: Comment
has text: Why would using CharSequence be better?
type: AnswerComment
comment on: http://stackoverflow.com/a/24500260

http://stackoverflow.com/comment/37979993
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24527457
has text: The options for second doubleselect are created in js so OGNL evaluation will NOT be done for `doubleHeaderKey` and `doubleHeaderValue`.
score: 0

http://stackoverflow.com/q/24487805
linked to: http://stackoverflow.com/q/70724490
has comment: http://stackoverflow.com/comment/37905587
downvote count: 2
has comment: http://stackoverflow.com/comment/37935799
has comment: http://stackoverflow.com/comment/63591757
has comment: http://stackoverflow.com/comment/37907251
has answer: http://stackoverflow.com/a/77396757
favorite count: 0
tagged with: side-effects
upvote count: 178
has title: Lambda expression vs method reference
has comment: http://stackoverflow.com/comment/100322856
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/78352269
score: 176
has answer: http://stackoverflow.com/a/24488060
has body: IntelliJ keeps proposing me to replace my lambda expressions with method references. Is there any objective difference between both of them?
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37906064
has answer: http://stackoverflow.com/a/65772624
has answer: http://stackoverflow.com/a/24493905
type: Question
has comment: http://stackoverflow.com/comment/37907172
has comment: http://stackoverflow.com/comment/100318368
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/37909006
has comment: http://stackoverflow.com/comment/37905837
has comment: http://stackoverflow.com/comment/89844681
has comment: http://stackoverflow.com/comment/37915172
answer count: 6
has answer: http://stackoverflow.com/a/71194241
has comment: http://stackoverflow.com/comment/37905876

http://stackoverflow.com/comment/37919494
comment on: http://stackoverflow.com/q/24495111
score: 0
type: Comment
type: QuestionComment
has text: If you have a parse error, we may need to see more of the code, especially the signature of the method this snippet comes from.

optimization
tags question: http://stackoverflow.com/q/24485687
tags question: http://stackoverflow.com/q/24527232
tags question: http://stackoverflow.com/q/24441855
tag name: optimization
tags question: http://stackoverflow.com/q/24499620
type: Tag

http://stackoverflow.com/comment/37885981
comment on: http://stackoverflow.com/a/24477105
has text: your updated edit is exactly what I'm looking for, however, the request you sent is all text data. My unclarity is how that request will change if I was sending a file (say, an image file)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37957225
has text: The parameter is just what it says in the Javadoc: the number of characters you want to be able to read while still retaining the mark. It's not a line count. The 'hang' and the rest of it are hard to believe. Are you sure there is no exception?
comment on: http://stackoverflow.com/a/24481236
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38013974
type: QuestionComment
score: 1
has text: I'm sorry, this is going to be messy, but you're using an IDE with auto formatting, it should just about fix it... `public void add(E item) { // Note the lack of a need for null checks ListNode<E> next = null; if (head == null) { head = new ListNode<E>(item); tail = head; next = head; } else { next = new ListNode<E>(item, tail.getNext()); } tail.setNext(next); tail = tail.getNext(); numItems++; }`
comment on: http://stackoverflow.com/q/24545363
type: Comment

http://stackoverflow.com/comment/38043306
comment on: http://stackoverflow.com/q/24559871
has text: Then test only the non-GUI behavior. If necessary, refactor your code to make it testable. Sounds like your method is doing way too much anyway.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24552100
has comment: http://stackoverflow.com/comment/38025933
score: 0
has body: Typically constants are not instance specific. It is thus a better practice to store constants as static variables rather than as member variables. The advantages are: There is only one allocation of the variable instead of one allocation per object. You don't need to create an instance variable to access a constant, e.g. PI is declared to be static in the java Math class.
answers question: http://stackoverflow.com/q/24551989
type: Answer

http://stackoverflow.com/q/24522049
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24522580
tagged with: java
has body: I have looked quite a few places but can't seem to find this specific solution. I am interested in creating a menu that will always be visible across every layout/view of the application. This menu would act much like the header/menu of a website that is fixed and always exists across all pages of the site. I assume I can simply create a menu and have it's visibility shown from initialization but I'm not sure if that's the best way. I don't want the user to have to click any other buttons to open the menu, I just want it fixed and constantly visible from the start of the app. Thank you. Any help is appreciated.
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37968588
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24522580
has title: How to have a Menu always visible across multiple layouts?
tagged with: menu

http://stackoverflow.com/a/24504014
downvote count: 0
has comment: http://stackoverflow.com/comment/37935776
has body: To set focus on your edittext you can call requestFocus on it. if(spinnerText2.equalsIgnoreCase("CASH")) { amountedittxt.setVisibility(View.VISIBLE); amountedittxt.requestFocus(); amountedittxt.setText(spinnerText2); } Make sure you have added android:focusable="true" in xml for edittext like this: &lt;EditText android:id="@+id/amount" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true"/&gt;
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24503162
answers question: http://stackoverflow.com/q/24503162
type: Answer
score: 2

http://stackoverflow.com/a/24492510
accepted answer of: http://stackoverflow.com/q/24490751
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24490751
type: Answer
upvote count: 4
has body: You say you need to run the command: param1=abc param2=xyz /home/abhijeet/sample1.sh In this case, the "param1" and "param2" strings aren't command-line arguments. This is shell syntax to set the two environment variables param1 and param2 and then invoke sample1.sh. To accomplish this with ProcessBuilder, you need to access the builder's environment variables: ProcessBuilder pb2=new ProcessBuilder("/home/abhijeet/sample1.sh"); pb2.environment().put("param1", "abc"); pb2.environment().put("param2", "xyz"); Process script_exec = pb2.start(); As an alternative, the command that you're trying to run uses shell syntax, so you could pass it to a shell to execute it: ProcessBuilder pb2=new ProcessBuilder( "/bin/sh", "-c", "param1=abc param2=xyz /home/abhijeet/sample1.sh"); Process script_exec = pb2.start();
score: 4

http://stackoverflow.com/comment/37899571
score: 0
has text: while this is likely true for most implementations of the method, there is nothing in the docs guaranteeing that behavior
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24484411

http://stackoverflow.com/q/24477491
has title: Java - Copying to new txt file
type: Question
has answer: http://stackoverflow.com/a/24478642
has body: The new test1.txt file this program creates is completely empty, the original file test.txt is filled with something like "50 3 21 57 10 20", basicly integers with whitespace between them. import java.util.*; import java.io.*; class AddOneToInts { public static void main(String [] args) throws IOException { Scanner scan = new Scanner(new BufferedReader(new FileReader( "test.txt" ))); BufferedWriter writer = new BufferedWriter(new FileWriter( "text1.txt" )); boolean cont = true; String temp; while (cont) { if (scan.hasNextInt()) { temp = (scan.nextInt()+1) + " "; writer.write(temp); } else break; } } }
downvote count: 0
has answer: http://stackoverflow.com/a/24477652
tagged with: copy
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24477519
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37886076
upvote count: 1
tagged with: text
score: 1
tagged with: java

http://stackoverflow.com/comment/37807396
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24435126
has text: Asking for external resources is off-topic. Why does the example have to apply to enums? The strategy pattern is completely independent of enums. Do you understand the pattern itself? Do you understand what an enum is?
type: Comment

http://stackoverflow.com/comment/38203567
type: Comment
has text: That call to setStreamVolume looks suspicous. Can you validate your device's volume settings and then remove the call to `mAudioManager.setStreamVolume`?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24496671

http://stackoverflow.com/a/24448088
has body: Put frame.setVisible(true); after adding components to JFrame, and it will show all the added components. Moreover, you should use specific layout rather than setting bounds for components. You can use a Layout Manager.
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/24448031
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37862935
answers question: http://stackoverflow.com/q/24448031
type: Answer

http://stackoverflow.com/a/34129846
has body: The solution is you should extends one of your app classes from upper classes (that extended itself from application class or from some app class that extended itself from application class (these are in chain). In question, you should make a appp class that extended from soomla, and then extend soomla from push, and then push from Application class and then set push class in manifest. public appp extends Soomla{ } public soomla extends Push{ } public push extends Application{ } In mainfest.xml : &lt;application android:name=".push" android:icon="@drawable/ijoomer_luncher_icon" android:label="@string/app_name"&gt;
score: -1
answers question: http://stackoverflow.com/q/24452509
accepted answer of: http://stackoverflow.com/q/24452509
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/82011583
has comment: http://stackoverflow.com/comment/57704227
downvote count: 2
upvote count: 1

http://stackoverflow.com/q/24526450
answer count: 4
type: AnsweredQuestion
tagged with: java
has body: I have a string: String testString= "For the time being, programming is a consumer job, assembly line coding is the norm, and what little exciting stuff is being performed is not going to make it compared to the mass-marketed cräp sold by those who think they can surf on the previous half-century's worth of inventions forever" like this: For the time being, programmi \n........\n.......\n After each length of 20 characters in this string, I want to put a newline character \n for display in a TextView in Android.
has answer: http://stackoverflow.com/a/24526651
accepted answer: http://stackoverflow.com/a/24526651
type: Question
has answer: http://stackoverflow.com/a/24526523
has answer: http://stackoverflow.com/a/24526716
has answer: http://stackoverflow.com/a/24527199
score: 4
downvote count: 0
tagged with: string
favorite count: 0
possible better answer: http://stackoverflow.com/a/24526523
has title: How do you add a newline character in a string at specific indices?
tagged with: android
upvote count: 4

http://stackoverflow.com/q/24578741
tagged with: java
possible better answer: http://stackoverflow.com/a/24578832
tagged with: jtextpane
type: Question
accepted answer: http://stackoverflow.com/a/24578815
has comment: http://stackoverflow.com/comment/38074877
linked to: http://stackoverflow.com/q/218384
tagged with: undo-redo
has title: java.lang.NullPointerException when trying to add undos to JTextPane
has comment: http://stackoverflow.com/comment/38074405
answer count: 3
has body: I used this website to try to add undos and redos to my JTextPane, but I get this error: Exception in thread "main" java.lang.NullPointerException at guiWithSwing.TextEditor.main(TextEditor.java:137). At line 137, it says menuEdit.add(menuItemUndo);, which is the part that adds the "Undo" button to the menu. I think the error means that the button has no properties, or something is missing, but I don't know what it is, as it has an action and text. package guiWithSwing; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.StyledDocument; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; @SuppressWarnings("serial") public class TextEditor extends JPanel { static Container pane; static Container paneText; static BasicFrame frame; static JTextPane textArea; static JScrollPane areaScrollPane; static FileFilter textFile; static Fi…
has comment: http://stackoverflow.com/comment/38074499
has comment: http://stackoverflow.com/comment/38074266
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38074467
upvote count: 2
tagged with: undo
has answer: http://stackoverflow.com/a/24579059
has answer: http://stackoverflow.com/a/24578832
has comment: http://stackoverflow.com/comment/38074446
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24578815
has comment: http://stackoverflow.com/comment/38154631
has comment: http://stackoverflow.com/comment/38075525

http://stackoverflow.com/comment/38052690
has text: What operating system are you on? Also, what are your intentions with Inline-Java if you haven't used java anytime?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24566899

http://stackoverflow.com/a/24519578
has comment: http://stackoverflow.com/comment/37964294
score: 1
upvote count: 1
has body: Your application crashes because of this line: LinearLayout glayout = (LinearLayout) findViewById(R.id.gameLayout); The crash occurs because you cannot find a View before the contentView has been set, which happens in the onCreate(...) method of your Activity. Move the initialization of "glayout" below the setContentView(...) call. In addition to that, i'd go with yygyt's suggestion.
has comment: http://stackoverflow.com/comment/37964260
answers question: http://stackoverflow.com/q/24519455
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38080242
comment on: http://stackoverflow.com/q/24581661
score: 1
type: Comment
type: QuestionComment
has text: libgdx documentation doesn't have any of this because it's done exactly the same as any other Android app. I think you can just follow the Windows 7 instructions. The OEM USB driver is only for certain devices. For most devices you just need the USB driver from the phone/tablet manufacturer's web site.

http://stackoverflow.com/comment/38068305
comment on: http://stackoverflow.com/a/24570357
type: Comment
has text: Are you also required to have an `@IdClass` defined due to the composite PK? Or is there a way around that? I'm getting compile time errors requiring me to specify a composite PK id class. Can you post an example of an IdClass? I'm having trouble getting this to compile successfully.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37881573
type: AnswerComment
comment on: http://stackoverflow.com/a/24469868
type: Comment
has text: The OP doesn't need to typecast. The object already is of that class. Your remarks about Object.toString() are nonsensical.
score: 0

http://stackoverflow.com/q/24489759
has comment: http://stackoverflow.com/comment/37911311
tagged with: generics
has body: As you know, there is a new feature in Spring 4: autowiring based on generic types. It's very useful, but I wonder, how Spring developers were able to bypass type erasure, which had prevented them to develop such feature before.
upvote count: 13
has title: Autowiring based on generic types in Spring. How does it work?
score: 13
has comment: http://stackoverflow.com/comment/37909767
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24489957
accepted answer: http://stackoverflow.com/a/24489957
tagged with: java
has answer: http://stackoverflow.com/a/24490049
type: Question
answer count: 2
downvote count: 0
favorite count: 0
tagged with: type-erasure
possible better answer: http://stackoverflow.com/a/24490049

http://stackoverflow.com/a/24526045
upvote count: 2
has body: You mean something like a List in a List?? May be something like... List&lt;List&lt;...&gt;&gt; twoDList = new ArrayList&lt;&gt;(); i want to make a List, in which each List key contains another List inside it It should more like you want some kind of Map, which is basically a key/value pair. Map&lt;String, List&lt;String&gt;&gt; mapValues = new HashMap&lt;&gt;(25); List&lt;String&gt; listOfValues = ...; //... mapValues.put("A unique key for this list", listOfValues); //... List&lt;String&gt; thatListOfValues = mapValues.get("A unique key for this list");
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24526019
score: 2
has comment: http://stackoverflow.com/comment/37975898
answers question: http://stackoverflow.com/q/24526019
has comment: http://stackoverflow.com/comment/37975824

http://stackoverflow.com/q/24529205
has comment: http://stackoverflow.com/comment/37981890
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37981592
has body: Example: String t; String j ="j2se"; Scanner sc =new Scanner(System.in); System.out.println("enter the search key:"); t=sc.next(); if (j.contains(t)) { System.out.println("yes"); } else System.out.println("no"); If the user enters 'j2', 'se' or 'j2s' as an input the output is 'yes'. If the input is 'jse' the output is 'no'. Is there a method to ignore the number stored in string search like ignoring upper or lower case letters?
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37981746
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24529297
has answer: http://stackoverflow.com/a/24529247
tagged with: string
has title: Ignore numbers in a string
has comment: http://stackoverflow.com/comment/37982253
favorite count: 0

http://stackoverflow.com/comment/38061639
type: Comment
comment on: http://stackoverflow.com/q/24571839
type: QuestionComment
has text: Why not you use single sql query `UPDATE table_name SET active_flag=NULL WHERE id IN (SELECT id FROM table_name JOIN tbl_2 ON tbl_name.pk_id = tbl_2.fk_name_id where active_flag=1 and updated_at <= NOW() - INTERVAL 3 MINUTE)`?
score: 0

http://stackoverflow.com/q/24584831
accepted answer: http://stackoverflow.com/a/24585841
has comment: http://stackoverflow.com/comment/38085537
has comment: http://stackoverflow.com/comment/38085452
score: -1
has body: I am just refactoring some project using a pattern "I made up". I am sure there is some cool name for it - do you know which one it is? Btw, I know its not the best way, but to reduced entaglement and get at least SOME control in the code (fast, like 900+ classes, got one day) I can live with "half ugly stuff" which cant break anything :-) public class PreferenceSetter { private static PreferenceSetter accessLimitClass = new PreferenceSetter(); private PreferenceSetter() { } public static void setPreferenceBoolean(APP_PREFERENCE key, Boolean value) { RealPrefClass.setPreferenceBoolean(key, value, accessLimitClass); }
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/71530394
favorite count: 0
has title: How is the "access instance pattern" named really
tagged with: design-patterns
type: AnsweredQuestion
upvote count: 0
tagged with: refactoring
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24585841

http://stackoverflow.com/comment/37904643
has text: iknow, i have not procedure code. i have not idea about what doing this procedure -_-
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24484709

http://stackoverflow.com/comment/38017115
comment on: http://stackoverflow.com/q/24548004
type: Comment
type: QuestionComment
has text: +1 I don't have any ideas (since I have never encountered the problem and thus cannot reproduce it), but the issue is very interesting!
score: 0

http://stackoverflow.com/comment/37794587
comment on: http://stackoverflow.com/a/24428134
has text: I'm not sure how this works, how does (coord[0]*26 + coord[1])*26 + coord[2]; map the coord values to a perfect hash value in a single array? it looks like there will be spaces between the hash indices?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43632644
score: 0
has text: Thats a tricky one. I had that in javascript developing for a windows 8 app.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24521358

http://stackoverflow.com/comment/37981449
type: Comment
type: QuestionComment
score: 0
has text: @PratikButani, i did't get your mean, what actually i want is if i swipe right or left it increase or decrease and show in text-view.
comment on: http://stackoverflow.com/q/24528745

http://stackoverflow.com/comment/38090476
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24587552
has text: What are you trying to read? Some specific hardware?
type: Comment

http://stackoverflow.com/q/24533430
type: Question
has comment: http://stackoverflow.com/comment/37998975
score: 0
answer count: 1
tagged with: build-error
has answer: http://stackoverflow.com/a/24556621
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38461174
tagged with: android-studio
has body: There are some questions like this one but none of the solutions provided does the trick. Build outputs the error from the title when building the app with two modules in it. One of the modules has the native code file. I checked a lot of threads, all of them suggesting inclusion of the -llog. Similar thread here. my Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := com_couchbase_touchdb_TDCollateJSON LOCAL_SRC_FILES := com_couchbase_touchdb_TDCollateJSON.cpp LOCAL_LDLIBS := -landroid -llog -ldl -L$(LOCAL_PATH) include $(BUILD_SHARED_LIBRARY) I also have the header &lt;android/log.h&gt; included into the .cpp file, but I still get the same error.
tagged with: java
linked to: http://stackoverflow.com/q/18154245
tagged with: android-ndk
has title: undefined reference to __android_log_print error

http://stackoverflow.com/q/24446078
tagged with: java
downvote count: 3
type: UnansweredQuestion
has title: could parent object be created using super to call parent method
upvote count: 0
score: -3
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37827549
tagged with: super
has comment: http://stackoverflow.com/comment/37827770
answer count: 1
has comment: http://stackoverflow.com/comment/37827552
has answer: http://stackoverflow.com/a/24456037
has body: Would the parent object be created , if we use the super keyword to call the method of the parent class in child object? Outcomes show that both Mybase and MySub have the same reference address. Not sure whether it is a good demo. class Mybase { public void address() { System.out.println("super:" + this); System.out.println( this.getClass().getName()); } } class MySub extends Mybase { public void address() { System.out.println("this:" + this); System.out.println( this.getClass().getName()); } public void info() { System.out.println("this:" + this); super.address(); } } public class SuperTest { public static void main(String[] args) { new MySub().info(); } }

http://stackoverflow.com/comment/38008646
comment on: http://stackoverflow.com/a/24480342
score: 0
type: AnswerComment
type: Comment
has text: @JonasH you can add this to the Play java docs at https://github.com/playframework/playframework/blob/master/documentation/manual/javaGuide/main/async/JavaAsync.md -- that's how most of the documentation gets written.

http://stackoverflow.com/a/44094978
has body: I had the same issue, I tried closing android studio and open it again and it works!
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24485012
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37982206
comment on: http://stackoverflow.com/a/24529297
score: 0
type: AnswerComment
has text: @clem It replaces all numbers in the string to the empty string. `replaceAll` gets a regular expression `\\d` which means any number, and replaces it to "".
type: Comment

http://stackoverflow.com/q/24475064
type: AnsweredQuestion
tagged with: ports
has answer: http://stackoverflow.com/a/24486024
score: 1
tagged with: java
tagged with: eclipse
type: Question
has title: How to test connectivity to ports
answer count: 2
tagged with: network-programming
favorite count: 0
possible better answer: http://stackoverflow.com/a/24487470
accepted answer: http://stackoverflow.com/a/24486024
has answer: http://stackoverflow.com/a/24487470
upvote count: 2
has body: I'm still a beginning programmer but I like to experiment and learn while practicing. I play League of Legends a lot, this is the biggest online game today. Sometimes the server of this game are offline and my idea was to make a java programm that checks wether the game is online (ports are open) and then tells me if the game is online or not. Due to me being a beginner programmer and my understanding of ports/network adresses still lack a bit, I wonder if someone could explain or help me achieving my goal. If it is by explaining or providing helpfull links, I'm open to everything! Thanks in advance, Boris
downvote count: 1

http://stackoverflow.com/q/24547856
answer count: 2
tagged with: casting
tagged with: types
has title: How to find out if a Type implements an interface in Java?
has comment: http://stackoverflow.com/comment/38016802
has comment: http://stackoverflow.com/comment/38016758
tagged with: interface
has body: This seems to be very easy, but I was not able to solve it for days now... I must be too stupid, and so I hope to get some help here (couldn't find the answer though). I simply want to know if a given Type implements some interface. For example, does type X implement the Serializable interface? It should give true for types X like JComponent.class, and false for Thread.class. Or, stated differently, can an object of type X be cast to the given interface? I tried instanceof and isAssignableFrom, but nothing seems to work. EDIT: Ok, maybe I really was too stupid :-( I have tried the following: This code does not compile: Type t1 = JComponent.class; Type t2 = Thread.class; Serializable.class.isAssignableFrom(t1); Serializable.class.isAssignableFrom(t2); This code yields true for both t1 and t2 (which makes sense, of course): Type t1 = JComponent.class; Type t2 = Thread.class; Serializable.class.isAssignableFrom(t1.getClass()); Serializable.class.isAssignableFrom(t2.getClass()); (And similar things with instanceOf do not work either.) But what DOES seem to work is this: Type t1 = JComponent.class; Type t2 = Thread.class; Serializable.class.isAssignableFrom((Class&lt;?&gt;) t1); Serializable.class.isAssignableFrom((Class&lt;?&gt;) t2); As a Type that implements an interface should always be a Class (right?), the cast should work in all cases... (EDIT: There is an even simpler solution - I used the wrong method for retreiving the constructor parameters (getGenericParameterTypes); using just getParameterTypes gives a list of Class objects rather than Type objects and there is no problem at all.) Thank you for the very quick help! Lukas
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38016957
has comment: http://stackoverflow.com/comment/38016724
type: Question
has answer: http://stackoverflow.com/a/24547934
tagged with: java
has comment: http://stackoverflow.com/comment/38016617
possible better answer: http://stackoverflow.com/a/24547945
accepted answer: http://stackoverflow.com/a/24547934
has answer: http://stackoverflow.com/a/24547945
score: 0

http://stackoverflow.com/a/24581359
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/38079336
has comment: http://stackoverflow.com/comment/38079538
has comment: http://stackoverflow.com/comment/38079323
has comment: http://stackoverflow.com/comment/38079469
score: 1
has body: extends is used to Inheritence purposes in Java. You can inherit others classes in your class using this keyword. Java documentation has a great tutorial for this: http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html You extend the class when you want to implement the data from other class to your own class. Like the example in the comment section of the post. Cat extends Mammal. Mammal extends Animal You don't need to recreate the whole entire methods and data for the Cat, so you extend the Mammal class, Mammal which in turn has the properties and data for the Animals. This way, you can get all the properties and data of the animals in the Cat. Then if you're having it like this Animal Class public Animal { private int type; private int height; private int width; // other private or public stuff } Animal inheritance by Mammal public Mammal extends Animal { // here you'll have the type, height and width provided // to you as properties for the Mammal. You can use them // Mammal mammal = new Mammal(); // int someType = mammal.type; } Mammal inheritence for Cat public Cat extends Mammal { // since mammal has properties of Animal, // cat would automatically get all the properties for Animal. } This way, you use the extend keyword. To get (inherit in Java) the properties of other classes.
upvote count: 1
answers question: http://stackoverflow.com/q/24581337

http://stackoverflow.com/comment/38129612
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24492366
has text: Made the following changes: X509Certificate[] certs= (X509Certificate[])certFactory.generateCertificate(in); Now, I got the following error: "X509Certificate cannot be resolved to a type"

http://stackoverflow.com/comment/37905350
type: Comment
comment on: http://stackoverflow.com/a/24487248
has text: The only thing I am confused about is How can I get theListFromTheMethod as the method does not return anything
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37858320
score: 2
has text: Ermm ... you can't measure complexity empirically. You can only estimate it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24462605
type: Comment

http://stackoverflow.com/q/24551804
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/24552387
tagged with: eclipse
has body: While running the project into eclipse (ADT) I am getting following error: [2014-07-03 16:21:50 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/parse/ParseAuthenticationProvider; [2014-07-03 16:21:50 - SimpleNexus] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/parse/ParseAuthenticationProvider; I googled it but i am not getting specific solution. Any body knows about it then please help me
type: Question
has title: Getting Error: conversion to Dalvik format failed: Unable to execute dex:
answer count: 2
tagged with: adt
upvote count: 3
has answer: http://stackoverflow.com/a/28104185
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
score: 3
downvote count: 0

http://stackoverflow.com/a/24438825
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24438521
type: Answer
answers question: http://stackoverflow.com/q/24438521
has body: final JPanel content = new JPanel(new BorderLayout()); content.add(chartPanel); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(button1, BorderLayout.NORTH); buttonPanel.add(button2, BorderLayout.SOUTH); content.add(buttonPanel, BorderLayout.SOUTH); setContentPane(content);
score: 0

http://stackoverflow.com/q/24428567
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37795329
has body: I developed an application a few months ago and everything was working fine. Yesterday I was trying to compile my code again on a different computer and as soon as I openned up my project with netbeans (the IDE I developed my application) a pop-up window appeared saying that the default plataform has changed. Whn I try to run my application it said that are no available classes to run my application, although there really is (there's a static main function and everything is fine with it). Besides this problem, I tried to run manually the file (right-click and run file) and the application started but it didn't work properly throwing a bunch of warnings that I have no ideia why Today I tried to open the project on my work computer. IT also said that the java platform changed and if I try to run the same problem happens: it says there are no available classes to run the application. Now here is the weirdeist part: If I run manually the file containing the main function it works propperly. Any Ideias? Best Regards.
upvote count: 1
has title: JavaFX application main function not working
answer count: 1
has comment: http://stackoverflow.com/comment/37795673
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37798229
has comment: http://stackoverflow.com/comment/42110651
has comment: http://stackoverflow.com/comment/37795224
has answer: http://stackoverflow.com/a/24431199
score: 1
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/56580557
downvote count: 1
score: 0
has body: For kotlin handle click on RecyclerView answer based on Jacobs answer Create class RecyclerItemClickListener: class RecyclerItemClickListener(context: Context, recyclerView: RecyclerView, listner: OnItemClickListener) : RecyclerView.OnItemTouchListener { var mGestureDetector: GestureDetector var mListner: OnItemClickListener interface OnItemClickListener { fun onItemClick(view: View, position: Int) fun onLongItemClick(view: View, position: Int) } init { this.mListner = listner mGestureDetector = GestureDetector(context, object : GestureDetector.SimpleOnGestureListener() { override fun onSingleTapUp(e: MotionEvent?): Boolean = true override fun onLongPress(e: MotionEvent?) { val child: View? = recyclerView.findChildViewUnder(e!!.getX(), e.getY()) if (child != null &amp;&amp; mListner != null) { mListner.onLongItemClick(child, recyclerView.getChildAdapterPosition(child)) } } }) } override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) = Unit override fun onInterceptTouchEvent(view: RecyclerView, e: MotionEvent): Boolean { val childView: View? = view.findChildViewUnder(e!!.getX(), e.getY()) if (childView != null &amp;&amp; mListner != null &amp;&amp; mGestureDetector.onTouchEvent(e)) { mListner.onItemClick(childView, view.getChildAdapterPosition(childView)) return true } return false } override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) = Unit } Get click on Any RecyclerView (inside activity/fragment): recyclerView.addOnItemTouchListener( RecyclerItemClickListener(this, recyclerView, object : RecyclerItemClickListener.OnItemClickListener { override fun onItemClick(view: View, position: Int) { // TODO catch click } override fun onLongItemClick(view: View, position: Int) { // TODO catch click } }) )
type: Answer
answers question: http://stackoverflow.com/q/24471109
has comment: http://stackoverflow.com/comment/132234578
upvote count: 1

http://stackoverflow.com/comment/38013532
type: Comment
score: 0
has text: Then you need to change `else` to `else if(!"".equals(line))`
comment on: http://stackoverflow.com/a/24532092
type: AnswerComment

http://stackoverflow.com/comment/78001439
score: 0
type: AnswerComment
type: Comment
has text: why you have the phase=none for maven-compiler ?
comment on: http://stackoverflow.com/a/39881116

http://stackoverflow.com/q/24451517
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37839967
type: Question
has comment: http://stackoverflow.com/comment/37899734
has comment: http://stackoverflow.com/comment/37841087
has body: I had an application accessing an Oracle Database working. Then, I wanted to configure database access using spring, and here's the result. It cannot find the context values: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: El nombre myDB no este asociado a este contexto at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.S…
upvote count: 2
has answer: http://stackoverflow.com/a/24451584
answer count: 1
tagged with: applicationcontext
has comment: http://stackoverflow.com/comment/37837385
tagged with: tomcat
favorite count: 0
has title: Exception loading a really simple context
has comment: http://stackoverflow.com/comment/37849953
has comment: http://stackoverflow.com/comment/37840027
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37837660

http://stackoverflow.com/q/24566829
upvote count: 1
possible better answer: http://stackoverflow.com/a/24567077
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24567077
has body: Java Thread has a property named threadStatus. During my debug , I found it have a value of 225, but cannot find any explanations in Java API document. So who can help me? I mean this private member of Class java.lang.Thread private int threadStatus = 0;
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38052644
has answer: http://stackoverflow.com/a/24567249
has comment: http://stackoverflow.com/comment/38053707
favorite count: 0
has title: threadStatus have a value of "225", what does it mean?
has comment: http://stackoverflow.com/comment/38052602
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24567249

http://stackoverflow.com/a/24532697
type: Answer
has comment: http://stackoverflow.com/comment/38027053
score: 0
type: AcceptedAnswer
has body: First you have to know the name of the package containing the class. If you know it, you can try the following: String className = packageName + ".Test"; Class cls = Class.forName(className); cls.getMethod("main", String[].class).invoke(null); Note that, if the class is in (default) package then you can use "Test" as className without the package name.
accepted answer of: http://stackoverflow.com/q/24532585
has comment: http://stackoverflow.com/comment/38097765
answers question: http://stackoverflow.com/q/24532585

http://stackoverflow.com/q/24457607
type: Question
has body: I have a comboBox that contains selections. I am trying to apply an actionListener to display te selected string on a textField. I am not sure how to complete this and all I have read is confusing me even more. Here is the code for the comboBox: JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] {"Select Something", "Selection 1", "Selection 2", "Selection 3", "Selection 4"})); panelTop.add(comboBox); comboBox.setPreferredSize(new Dimension(160, 20)); comboBox.addItem("Select Something"); textField Code: textField = new JTextField(); panelTop.add(textField); textField.setColumns(40); What I have so far on the actionListener: public void actionPerformed(ActionEvent e) { JComboBox comboBox = (JComboBox)e.getSource(); String newSelection = (String)comboBox.getSelectedItem(); currentPattern = newSelection; } Full Code: package SwingAssign2; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import java.awt.BorderLayout; import javax.swing.JComboBox; import javax.swing.JTextField; import java.awt.FlowLayout; import javax.swing.SwingConstants; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.DefaultComboBoxModel; public class SwingAssign2 { private JFrame frame; private JTextField textField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { SwingAssign2 window = new SwingAssign2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public SwingAssign2() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setSize(600, 500); frame.…
has answer: http://stackoverflow.com/a/24457781
tagged with: combobox
possible better answer: http://stackoverflow.com/a/24457706
has answer: http://stackoverflow.com/a/24457706
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/24457697
tagged with: java
linked to: http://stackoverflow.com/q/7229226
answer count: 4
has answer: http://stackoverflow.com/a/24457814
type: AnsweredQuestion
has title: Action listener on comboBox to display selection in textField
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24457697

http://stackoverflow.com/q/24550757
tagged with: calendar
tagged with: simpledateformat
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24550788
has body: I am using below simple date format in backend java to format the date which was given by user through user interface. SimpleDateFormat sdf = new SimpleDateFormat("MMM"); SimpleDateFormat sdfMonthYear = new SimpleDateFormat("MMM-yyyy"); SimpleDateFormat sdfMonthYearDisplay = new SimpleDateFormat("MMM yyyy"); When It's deployed in my local machine It populates correct month value as Jan , Feb, Mar,Apr etc.But The proj now deployed in other server ex in Swedan's system .So now I am getting the month value as Maj instead of May and Okt instead of Oct.I have verifed that this month format is swedan based.I want a generic way of month format even Its deployed in any country like Jan ,Feb,may,Oct etc. Please help me on this issue.
has answer: http://stackoverflow.com/a/24550816
has title: Date format Issue in Java
score: 0
has answer: http://stackoverflow.com/a/24550834
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24551121

http://stackoverflow.com/q/24540377
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24577262
has title: No available bundle exports package 'org.restlet.resource'
tagged with: java
type: UnansweredQuestion
tagged with: manifest
tagged with: restlet
has body: I tried to do this tutorial : http://ntabakov.wordpress.com/2011/12/ I have a problem in step 4 of the tutorial. I have downloaded and added in the build path org.restlet.jar In the manifest file I have this error : &gt; No available bundle exports package 'org.restlet.resource' in this line : in this line : Import-Package: example.restlet.hello.service, org.restlet.resource my manifest file is : Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: HelloBundleRestService Bundle-SymbolicName: HelloBundleRestService Bundle-Version: 1.0.0.qualifier Bundle-Vendor: ntabakov.wordpress.com Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: example.restlet.hello.service, org.restlet.resource Service-Component: OSGI-INF/HelloServiceResource.xml

http://stackoverflow.com/a/24438900
type: Answer
has comment: http://stackoverflow.com/comment/37815577
has body: public static void main(String[] args){ // TODO code application logic here String str = "(test)"; String replaced= str.replaceAll("\\(", "").replaceAll("\\)", ""); System.out.println(replaced); }
score: 0
answers question: http://stackoverflow.com/q/24438714

http://stackoverflow.com/comment/56405325
type: Comment
comment on: http://stackoverflow.com/a/24491814
score: 11
has text: Shame that there isn't a mutable clock that allows me to set it to non-ticking time, but modify that time later (you can do this with joda). This would be useful for testing time-sensitive code, e.g. a cache with time-based expiries or a class that schedules events in the future.
type: AnswerComment

http://stackoverflow.com/comment/37845046
type: Comment
type: QuestionComment
has text: You're sure you're generating the correct output - that's really why your program is failing, right? The reason I ask is that you not only restrict changing values to ASCII printable characters, but you restrict *printing* to ASCII printable characters, minus 7. Should you be subtracting first, and then printing if the result is within the correct range?
score: 0
comment on: http://stackoverflow.com/q/24455255

http://stackoverflow.com/a/24459776
type: Answer
score: 8
downvote count: 0
upvote count: 8
has body: Here's a ready-made implementation from my project. I have an abstract spliterator which handles splitting into fixed-size batches and allows for efficient parallelization of processing of any kind of I/O-based stream source: import static java.util.Spliterators.spliterator; import java.util.Comparator; import java.util.Spliterator; import java.util.function.Consumer; public abstract class FixedBatchSpliteratorBase&lt;T&gt; implements Spliterator&lt;T&gt; { private final int batchSize; private final int characteristics; private long est; public FixedBatchSpliteratorBase(int characteristics, int batchSize, long est) { characteristics |= ORDERED; if ((characteristics &amp; SIZED) != 0) characteristics |= SUBSIZED; this.characteristics = characteristics; this.batchSize = batchSize; this.est = est; } public FixedBatchSpliteratorBase(int characteristics, int batchSize) { this(characteristics, batchSize, Long.MAX_VALUE); } public FixedBatchSpliteratorBase(int characteristics) { this(characteristics, 64, Long.MAX_VALUE); } @Override public Spliterator&lt;T&gt; trySplit() { final HoldingConsumer&lt;T&gt; holder = new HoldingConsumer&lt;&gt;(); if (!tryAdvance(holder)) return null; final Object[] a = new Object[batchSize]; int j = 0; do a[j] = holder.value; while (++j &lt; batchSize &amp;&amp; tryAdvance(holder)); if (est != Long.MAX_VALUE) est -= j; return spliterator(a, 0, j, characteristics()); } @Override public Comparator&lt;? super T&gt; getComparator() { if (hasCharacteristics(SORTED)) return null; throw new IllegalStateException(); } @Override public long estimateSize() { return est; } @Override public int characteristics() { return characteristics; } static final class HoldingConsumer&lt;T&gt; implements Consumer&lt;T&gt; { Object value; @Override public void accept(T value) { this.value = value; } } } And here's the opencsv spliterator based on it: public class CsvSpliterator extends FixedBatchSpliteratorBase&lt;String[]&gt; { private final CSVReader cr; CsvSpliter…
answers question: http://stackoverflow.com/q/24458961

http://stackoverflow.com/comment/37957773
type: Comment
comment on: http://stackoverflow.com/a/24515299
score: 0
type: AnswerComment
has text: Thank you! It looks like I didn't understand how to use pattern correctly, problem has gone since I implemented your tips

http://stackoverflow.com/q/24568735
accepted answer: http://stackoverflow.com/a/24602307
has comment: http://stackoverflow.com/comment/38121577
has title: how to send byte array in json post request?
has comment: http://stackoverflow.com/comment/38107031
has comment: http://stackoverflow.com/comment/38107101
answer count: 1
favorite count: 0
score: 8
tagged with: wcf
has answer: http://stackoverflow.com/a/24602307
has comment: http://stackoverflow.com/comment/38092095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38110309
upvote count: 9
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a wcf service which accepts byte[] serialData, now am developing a java client which needs to consume the same method. When i sent bytearray to the service as a json post request , it is getting an exception as java.io.IOException: Server returned HTTP response code: 400 Here is my code: wcf method: [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "saveSerialNumbers", BodyStyle = WebMessageBodyStyle.WrappedRequest)] Dictionary&lt;string, object&gt; saveSerialNumbers(byte[] serialData); Java Client: for (int i = 1; i &lt; 100; i++) { sb.append(String.valueOf(gen())); } byte[] bytesEncoded = Base64.encodeBase64(sb.toString().getBytes()); String json = "{\"serialDataByte\":\""+sb.toString()+"\"}"; This is my postrequest method: public String getResultPOST(String jsonObject,String uri,String method) throws Exception{ try { URL url = new URL(uri+method); System.out.println(url.toString()); URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json"); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); OutputStreamWriter out; try { out = new OutputStreamWriter(connection.getOutputStream()); out.write(jsonObject); out.close(); } catch (Exception e) { / // TODO Auto-generated catch block e.printStackTrace(); } String line = ""; StringBuilder builder = new StringBuilder(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); while ((line = in.readLine()) != null) { builder.append(line); } in.close(); return builder.toString(); } catch (Exception e) { throw e; //here is the exception } } Here is my method call: String json = "{\"serialData\":\""+ new String(bytesEncoded) +"\",\"guProductID\":\""+guProductID+"\",\"guStoreID\":\""+guStoreID+"\",\"securityToken\":\""+SecurityToken+"\"}"; String serialContract = serialClient.getResultPOST(json, "http://localhost:3361/EcoService.svc/J…
has comment: http://stackoverflow.com/comment/38056671
downvote count: 1
type: Question

http://stackoverflow.com/q/24548464
has title: Hibernate DELETE Statement in JPA?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38018495
has comment: http://stackoverflow.com/comment/38020874
type: Question
has comment: http://stackoverflow.com/comment/38017905
tagged with: java
tagged with: hibernate
tagged with: persistence
has comment: http://stackoverflow.com/comment/38019516
has comment: http://stackoverflow.com/comment/38020571
score: 0
has body: How to delete a row in JPA? I have found some examples on the internet, but I did not fina any good solution. I have tried so far: Session session = null; Query query1 = null; Query query2 = null; String[] parts = userId.split("="); userId = parts[1]; parts = userId.split(" "); userId = parts[0]; int intIdUser = Integer.parseInt(userId); query1= session.getNamedQuery("UserCountry.removeAssoc"); query1.setParameter("userId", userId); query1.executeUpdate(); query2= session.getNamedQuery("UserLanguage.removeAssoc"); query2.setParameter("userId", userId); query2.executeUpdate(); But I get HTTP Status 500: java.lang.Exception com.se.pl.actions.user.UserAction.saveAssoc(UserAction.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) And the Named Query are: @NamedQuery(name = "UserCountry.removeAssoc", query = "DELETE FROM UserCountry u WHERE u.userId = :userId"), EDIT: Here the error is generated by the invoke method saveAssoc(): public String saveAssoc() throws Exception { try { HttpSession httpSession = request.getSession(); iUserDAO.saveUserAssoc(httpSession.getAttribute("selectedUser").toString(), countryId, langId); } catch (Exception e) { throw new Exception(e.getMessage()); } return SUCCESS; } It goes straight to catch when it reaches query1= session.getNamedQuery("UserCountry.removeAssoc"); line. Stack trace: type Exception report message description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.Exception com.se.pl.actions.user.UserAction.saveAssoc(UserAction.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActio…
answer count: 0

http://stackoverflow.com/comment/37800326
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24431330
has text: It is all on conventions and namings.. There is nothing people can do here with it to help you. Read the naming conventions in java and coding standards.

http://stackoverflow.com/comment/37833466
type: Comment
has text: Yes, it seems that scala-maven-plugin is a new version of maven-scala-plugin. Anyway I checked the pom and it works fine with the new version.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24449121

http://stackoverflow.com/a/24486938
has body: On a swing Timer call repaint(50L, x*16, y*16, 16, 16);. Use fields for the current state (x, y), and on every paintComponent draw only that state/tile.
upvote count: 2
answers question: http://stackoverflow.com/q/24486705
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24491726
has comment: http://stackoverflow.com/comment/37914560
has comment: http://stackoverflow.com/comment/76503899
downvote count: 0
score: 38
upvote count: 38
type: Answer
answers question: http://stackoverflow.com/q/24491243
has comment: http://stackoverflow.com/comment/37914987
has body: The documentation says: This returns a value for each of the two supported units, SECONDS and NANOS. All other units throw an exception. So, best guess answer -- that's the way they designed it. You can use some of the other methods to get it in hours: long hours = duration.toHours(); or minutes: long minutes = duration.toMinutes();

http://stackoverflow.com/q/24583305
has answer: http://stackoverflow.com/a/24583452
has body: So I set the setSize(500,500).. add some panels, the sum of panels Y is 500 like the JFrame but executing it shows an count Y of 525 am I missing something? JPanel panel = new JPanel(); panel.setLayout(null); getContentPane().add(panel); //-------------------- JPanel top_panel = new JPanel(); top_panel.setLayout(null); top_panel.setBackground(Color.blue); top_panel.setBounds(0, 0, 500, 40); panel.add(top_panel); //------------------------------ JPanel middle_panel = new JPanel(); middle_panel.setLayout(null); middle_panel.setBackground(Color.yellow); middle_panel.setBounds(0, 40, 500, 385); panel.add(middle_panel); //----------------------------- JPanel bottom_panel = new JPanel(); bottom_panel.setLayout(null); bottom_panel.setBackground(Color.black); bottom_panel.setBounds(0, 425, 500, 75); panel.add(bottom_panel); setSize(500,500); setDefaultCloseOperation(EXIT_ON_CLOSE); setResizable(false); setLocationRelativeTo(null); 40+385+75 = 500 but to show all the panels i must setSize(500,525); then it fits here's an image:
tagged with: jframe
tagged with: swing
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24583452
possible better answer: http://stackoverflow.com/a/24583596
tagged with: java
has answer: http://stackoverflow.com/a/24583596
has title: Strange JFrame size
answer count: 2
score: 0
linked to: http://stackoverflow.com/q/21242626
tagged with: size

http://stackoverflow.com/comment/37951373
type: AnswerComment
has text: This does not fix the problem for me with Windows/Eclipse.
comment on: http://stackoverflow.com/a/24503051
type: Comment
score: 3

http://stackoverflow.com/q/24450641
has comment: http://stackoverflow.com/comment/37835934
score: 0
has body: My coding is below beginner at this stage and I need help, My lecturer asked me to " use a loop to calculate the total of all annual rents in the array" which means that the user enters what the rent would be over 12 months, How is it that I would make a loop to calculate the Sum of numbers that are not even entered in the code and are going through an array, I will put the code for the array in here and any help would be appreciated. Scanner keyboardScanner = new Scanner(System.in); double[] array = new double[12]; for (int i = 0; i &lt; 12; i++) { System.out.println("Enter Rental for month[" + i + "]"); array[i] = keyboardScanner.nextDouble(); } for (int i = 0; i &lt; array.length; i++) { System.out.println(array[i]); }
has comment: http://stackoverflow.com/comment/37836069
has comment: http://stackoverflow.com/comment/37835858
has comment: http://stackoverflow.com/comment/37836071
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37835904
has comment: http://stackoverflow.com/comment/37835815
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37835808
has comment: http://stackoverflow.com/comment/37836142
has comment: http://stackoverflow.com/comment/37836036
has comment: http://stackoverflow.com/comment/37836008
has comment: http://stackoverflow.com/comment/37836489
tagged with: java
has comment: http://stackoverflow.com/comment/37836912
has comment: http://stackoverflow.com/comment/37835944
type: Question
has answer: http://stackoverflow.com/a/24450714
accepted answer: http://stackoverflow.com/a/24450714
tagged with: arrays
has title: Looping to Calculate a total of String array? Java
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40496279
type: QuestionComment
comment on: http://stackoverflow.com/q/24455144
score: 0
has text: if the class is not serializable it will return, for instance with class Teacher, Class com.test.Teacher is not Serializable.
type: Comment

http://stackoverflow.com/a/24483868
downvote count: 1
has comment: http://stackoverflow.com/comment/37898556
has comment: http://stackoverflow.com/comment/37900427
score: 0
answers question: http://stackoverflow.com/q/24483551
has body: I do not whether using stack was mandatory, yet you could accomplish this in easier way like this Code: String s = "AAAACCCAAABBBBBCCAAAACA"; StringBuilder result = new StringBuilder(); String[] sToArray = s.split(""); for (String sIndex : sToArray) { switch (sIndex) { case "A": result.append("A "); break; case "B": result.append("B "); break; default: continue; } } for (String v : result.toString().split(" ")) { System.out.print(v); } output: AAAAAAABBBBBAAAAA
has comment: http://stackoverflow.com/comment/37898587
type: Answer
has comment: http://stackoverflow.com/comment/37898802
upvote count: 1

http://stackoverflow.com/a/24455497
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/24455381
has body: If you don't want to instantiate the object, you can keep it in a byte[] buffer. To instantiate it, you need to do it like RMI: provide a remote class loader by the sender. But typically solutions using a different serialisation mechanism are better for that case. Think Protobuf, JSON or similiar.
type: Answer
accepted answer of: http://stackoverflow.com/q/24455381
has comment: http://stackoverflow.com/comment/37845618

http://stackoverflow.com/a/24458103
score: 1
answers question: http://stackoverflow.com/q/24457937
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24457937
has comment: http://stackoverflow.com/comment/37849895
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Microsoft has Visio 2012 which has a template specifically for UML diagrams allowing you to plan out your program's structure. I love this software, makes your diagrams look very good and professional. Also, it's super easy to learn. You could easily learn to make UML diagrams within a day with this. You can also create use-cases, and other goodies that will allow you to map out your plan of attack on your project! Hope that helps!

http://stackoverflow.com/comment/37877669
score: 0
type: AnswerComment
has text: Thanks for reply but isReachable method returns always false. I don't know how to manage this issue. :(
type: Comment
comment on: http://stackoverflow.com/a/24472885

http://stackoverflow.com/a/24531639
score: 0
type: Answer
has body: 1) Change System.out.println("The code throws an exception"); System.out.println(ex.getMessage()); To get detailed description for cause of exception. System.out.println("The code throws an exception"); ex.printStackTrace(); 2) From code &amp; exception message it seems like there is a NullPointerException as ur array matrix is initialized to null and not to array of matching size. So solution to the exception is[Assuming your core logic is fine] , before assigning any values to matrix array, initialize with relevant size i.e with max rows &amp; columns
answers question: http://stackoverflow.com/q/24531396

http://stackoverflow.com/comment/37938887
comment on: http://stackoverflow.com/q/24505911
score: 0
type: Comment
type: QuestionComment
has text: Which line is ShowGoogleMap.java:159

http://stackoverflow.com/a/24532119
has body: I can't tell if this is the exact cause of the problem, because you haven't provided a MCVE but this method public void renderChip(Chip chip, int x, int y) { g.drawImage(chip.getImage(), x, y, null); } Just looks wrong. All custom painting should be done within the context of the provided Graphics object in the overridden paintComponent method. If you have not overriden paintComponent in a JPanel or a JComponent then you are likely not painting correctly. You may be doing something like public class SomePanel extends JPanel { private Graphics g; public SomePanel() { g = getGraphics(); } } Which is completely wrong. You should instead be doing something like public class SomePanel extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // do painting here } } You Classes can then have it's own render method that takes a Graphics object as an argument. Then can be called in the paintComponent method. Maybe something like public class Chip { private JComponent imageObserver; private BufferedImage chipImage; int x, y; public Chip(BufferedImage chipImage, int x, int y, JComponent imageObserver){ this.chipImage; this.x = x; this.y = y; this.imageObserver = imageObserver; } public void renderChip(Graphics g) { g.getImage(chipImage, x, y, imageObserver); } } And your panel public class SomePanel extends JPanel { private List&lt;Chip&gt; chips; public SomePanel() { chips = new ArrayList&lt;Chip&gt;(); // add new Chips } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); for (Chip chip: chips) { chip.renderChip(g); } } }
score: 1
answers question: http://stackoverflow.com/q/24530693
has comment: http://stackoverflow.com/comment/37990419
upvote count: 1
has comment: http://stackoverflow.com/comment/37990592
has comment: http://stackoverflow.com/comment/37990957
has comment: http://stackoverflow.com/comment/37990644
has comment: http://stackoverflow.com/comment/37990201
has comment: http://stackoverflow.com/comment/37990868
downvote count: 0
has comment: http://stackoverflow.com/comment/37990531
has comment: http://stackoverflow.com/comment/37990712
type: Answer
has comment: http://stackoverflow.com/comment/37991266
has comment: http://stackoverflow.com/comment/37991196

http://stackoverflow.com/comment/38466390
score: 0
type: Comment
type: QuestionComment
has text: Can you please paste the same Jsch client code here?? I need to fix it urgently. That wud be a great help!
comment on: http://stackoverflow.com/q/24519462

http://stackoverflow.com/comment/38094963
has text: @DmitryGinzburg Sorry I have taken it in wrong way. I was thinking from sorting perspective as well. As per sorting logic it should be []2, 3, 4, null, null, null] but I was wrong. I think OP just want to move the items and not interested in sorting.
comment on: http://stackoverflow.com/a/24586408
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24441788
has body: I am trying to get the information about which browser the user used to call the API. I searched online and it seems that I should use the "user-agent" from the request header. Code: @RequestMapping(value = "/headerTest", method = RequestMethod.GET) public @ResponseBody DummyAPI dummyApi( @RequestHeader ("User-Agent") String userAgent, HttpServletRequest request, HttpServletResponse response) { System.out.println("User-Agent : " + userAgent); String browserName = request.getHeader("User-Agent"); System.out.println("BrowserName : " + browserName); return "test"; } However, when I test it: Firefox gives me: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:25.0) Gecko/20100101 Firefox/25.0! Chrome gives me: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36! Safari gives me: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.76.4 (KHTML, like Gecko) Version/7.0.4 Safari/537.76.4! What could be the problem here? Why would the header be wrong? Thank you in advance!
score: 1
upvote count: 1
tagged with: google-chrome
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/24446232
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/37820633
has title: Spring Java servlet return incorrect user agent
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37824707
tagged with: firefox
downvote count: 0
accepted answer: http://stackoverflow.com/a/24446232
favorite count: 0
has comment: http://stackoverflow.com/comment/37820278
type: Question

http://stackoverflow.com/comment/38018444
comment on: http://stackoverflow.com/a/24546872
has text: again the same . cursor != null but cursor.getCound() = 0
score: 0
type: Comment
type: AnswerComment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/24483233

http://stackoverflow.com/a/24572848
answers question: http://stackoverflow.com/q/24572767
score: 1
accepted answer of: http://stackoverflow.com/q/24572767
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Either fill in the "Server", "Host" etc options otherwise available or just post a URI in the form of: mongodb://[user]:[password]@[hostname]:[port]/[database] Various driver documentation samples have examples of this. For example the Java driver: http://api.mongodb.org/java/current/com/mongodb/MongoClientURI.html
type: Answer
has comment: http://stackoverflow.com/comment/38063613

http://stackoverflow.com/a/44426523
upvote count: 1
answers question: http://stackoverflow.com/q/24468339
type: Answer
downvote count: 0
score: 1
has body: If you're using maven for build automation, add the latest jsf-api dependency to your pom.xml: javax.faces jsf-api 2.1 Or the latest javax.faces-api implementation: javax.faces javax.faces-api 2.3 However, note that JSF is integrated into most Java EE application servers, such as JBoss. See also this answer.

http://stackoverflow.com/comment/37862803
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24465106
has text: I have more or less understood what was meant. But to better understand it I just need examples of code, not description.

http://stackoverflow.com/q/24478798
downvote count: 0
type: UnansweredQuestion
tagged with: apn
tagged with: mms
score: 1
tagged with: connection
favorite count: 0
type: Question
tagged with: android
upvote count: 1
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24479220
has body: I have used this code to send an mms and all parameters are correct, but the connection is refused.. And the netWork is connected on mobile mms. HttpUtils is a class from a library downloaded here : https://github.com/android/platform_packages_apps_mms HttpUtils.httpConnection(getApplicationContext(), 4444L, MMSCenterUrl, bytesToSendFromPDU, HttpUtils.HTTP_POST_METHOD, !TextUtils.isEmpty(MMSProxy), MMSProxy, port); 06-29 19:51:26.208: I/Log MMSCenterUrl(13071): http: //mmsnrj 06-29 19:51:26.208: I/Log MMSProxy(13071): 10.143.156.5 06-29 19:51:26.208: I/Log MMSPort(13071): 8080 06-29 19:51:26.288: E/Mms:transaction(13071): Url: http: //mmsnrj 06-29 19:51:26.288: E/Mms:transaction(13071): Connection to http: //10.143.156.5:8080 refused Manifiest file : &lt;uses-permission android:name="android.permission.WRITE_SMS" /&gt; &lt;uses-permission android:name="android.permission.SEND_SMS"/&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; &lt;uses-permission android:name="android.permission.READ_SMS" /&gt; &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/&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.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
has title: HttpUtils.httpConnection() refused

http://stackoverflow.com/comment/37918763
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24494133
type: Comment
has text: Thanks for the answer Mike, I like your answer, I would Vote up your answer if only I have 15 reputations

http://stackoverflow.com/comment/38066217
comment on: http://stackoverflow.com/q/24574462
has text: [Click](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) me...!!!!!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24587919
tagged with: listener
score: 0
answer count: 2
tagged with: swing
tagged with: jbutton
tagged with: java
has answer: http://stackoverflow.com/a/24587939
has title: My JButton action listener is not working
has answer: http://stackoverflow.com/a/24587971
has body: My ActionListener codes for a JButton to go to another JPanel, but it's not working properly, though it used to work before. My code is as follows: JButton btnNext = new JButton("Next"); btnNext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JPanel contentPane = new ListofDuties2(myFrame); myFrame.getContentPane().removeAll(); myFrame.setContentPane(contentPane); myFrame.setVisible(true); } }); btnNext.setBounds(194, 381, 89, 23); add(btnNext); I'm not really sure what's wrong with it.
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/38091189
tagged with: action

http://stackoverflow.com/a/24464695
answers question: http://stackoverflow.com/q/24449215
upvote count: 1
has body: You can create a RiakObject using a RiakObjectBuilder, and then add the index on that: val obj = RiakObjectBuilder.newBuilder(bucketName, myKey) .withValue(myValue) .addIndex("timestamp_index", timestamp) .build myBucket.store(obj).execute
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24449215
downvote count: 0
score: 1

http://stackoverflow.com/comment/37840651
score: 0
type: Comment
type: QuestionComment
has text: Put the mappedBy on the Role entity and remove it from User, if it is the User that owns the Role.
comment on: http://stackoverflow.com/q/24452915

http://stackoverflow.com/q/24444565
answer count: 2
has comment: http://stackoverflow.com/comment/37824908
has answer: http://stackoverflow.com/a/24444718
has comment: http://stackoverflow.com/comment/37825089
has comment: http://stackoverflow.com/comment/37824900
has comment: http://stackoverflow.com/comment/37825211
has comment: http://stackoverflow.com/comment/37825068
favorite count: 0
has body: When we create and compile a .java file .class file created on same folder. How to save .class files in different folder and run it?
has comment: http://stackoverflow.com/comment/37824899
has comment: http://stackoverflow.com/comment/37824925
has comment: http://stackoverflow.com/comment/37824944
possible better answer: http://stackoverflow.com/a/24444613
has comment: http://stackoverflow.com/comment/37825055
has answer: http://stackoverflow.com/a/24444613
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37825468
has comment: http://stackoverflow.com/comment/37824929
has comment: http://stackoverflow.com/comment/37824937
accepted answer: http://stackoverflow.com/a/24444718
downvote count: 3
upvote count: 1
type: Question
score: -2
has comment: http://stackoverflow.com/comment/37825003
tagged with: java
has title: How to save .class file in different directory in java
has comment: http://stackoverflow.com/comment/37824976

http://stackoverflow.com/comment/37817013
score: 0
type: AnswerComment
type: Comment
has text: ok Im trying this now. i'll leave here a comment if it works or not.
comment on: http://stackoverflow.com/a/24439992

http://stackoverflow.com/q/24561802
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/38043360
has comment: http://stackoverflow.com/comment/38243817
has answer: http://stackoverflow.com/a/24562196
answer count: 1
has comment: http://stackoverflow.com/comment/38042852
favorite count: 0
has title: How to count duplicates of words/do case insensitive comparisons in user inputted text?
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/38043494
has comment: http://stackoverflow.com/comment/38043510
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38043190
has body: Positive words are considered: "good" or "awesome and negative words are considered: "bad" or "terrible". I want to count every time a positive or negative word is used and add it to the total pos/neg counts. The issue with the present code is it fails to count duplicates. What logic can i use to efficiently return the tallies for pos and neg words? In addition how can i disregard the case of the user input? package practice; import java.io.*; public class SentimentAnalyser { public static String analyse(String text) { int posCount = 0; int negCount = 0; String positive = "good"; String pos1 = "awesome"; String negative = "bad"; String neg1 = "terrible"; if(text.contains(positive) | text.contains(pos1)){ posCount++; } if(text.contains(negative) | text.contains(neg1)){ negCount++; } String res = Integer.toString(posCount); String res1 = Integer.toString(negCount); String result = (posCount+"P"+negCount+"N"); return result; } public static void main(String arg[]) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the text with spaces(press enter to done):"); String text=br.readLine(); System.out.println("Line:\n"+analyse(text)); } }
accepted answer: http://stackoverflow.com/a/24562196

http://stackoverflow.com/comment/37937169
comment on: http://stackoverflow.com/q/24504304
type: Comment
type: QuestionComment
score: 0
has text: @damienhawks I really appreciate the help, is there a way I can rep you for your comment or can you only rep for posted answers/solutions?

http://stackoverflow.com/q/24449780
score: 0
tagged with: matrix
has comment: http://stackoverflow.com/comment/37834636
answer count: 0
type: UnansweredQuestion
tagged with: colt
tagged with: java
has comment: http://stackoverflow.com/comment/37834181
has title: Does Colt provide "d-dimensional" matrices?
type: Question
has comment: http://stackoverflow.com/comment/37836934
tagged with: arrays
has body: Colt library is pretending to provide "Dense and sparse fixed sized (non-resizable) 1,2, 3 and d-dimensional matrices" (Section Features / Templated Multidimensional matrices). But in API itself I see no any implementation, higher than 3: http://acs.lbl.gov/ACSSoftware/colt/api/cern/colt/matrix/package-summary.html Please cure my tired eyes :)

http://stackoverflow.com/a/24441764
score: 0
type: Answer
has body: The JAVA_HOME directory you provided is of JRE. Please ensure that there is a folder like this in your computer: C:\Program Files\Java\jdk1.8.0 If it is not there please install JDK. Then, Reset the environment variable of the JAVA_HOME to correct location.
answers question: http://stackoverflow.com/q/24441504

http://stackoverflow.com/q/24550783
has answer: http://stackoverflow.com/a/25137247
type: Question
tagged with: aidl
possible better answer: http://stackoverflow.com/a/24551080
has answer: http://stackoverflow.com/a/24551080
tagged with: java
answer count: 2
has body: I am new to android. I am trying using AIDL. What I am tryng is take initial value i.e 0 from the Textview and tryng to increment its value by calling a method defined in aidl file(using service.) But the TextView is not updating on button click. Kindly Help. Here is my code. CounterService.aidl package com.example.counter; interface CounterService { int updateCounter(in int var); } CounterServ.java (Exposing service) package com.example.counter; public class CounterServ extends Service { @Override public void onCreate() { super.onCreate(); } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return new CounterService.Stub() { @Override public int updateCounter(int var) throws RemoteException { // TODO Auto-generated method stub return var + 1; } }; } @Override public void onDestroy() { super.onDestroy(); } } User Activity using service. public class MainActivity extends Activity { CounterService myservice; AdditionServiceConnection connection; class AdditionServiceConnection implements ServiceConnection { public void onServiceConnected(ComponentName name, IBinder Service) { myservice = CounterService.Stub.asInterface(Service); Toast.makeText(MainActivity.this, "Service connected", Toast.LENGTH_LONG) .show(); } public void onServiceDisconnected(ComponentName name) { myservice = null; Toast.makeText(MainActivity.this, "Service connected", Toast.LENGTH_LONG) .show(); } } private void initService() { connection = new AdditionServiceConnection(); Intent i = new Intent(); i.setClassName("com.example",com.example.counter.MainActivity.class.getName()); boolean ret = bindService(i, connection, Context.BIND_AUTO_CREATE); } private void releaseService() { unbindService(connection); connection = null; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initService(); Button update = (Button)findViewById(R.id.button1); update.setOnClickListener(new View.OnCl…
accepted answer: http://stackoverflow.com/a/25137247
downvote count: 0
has title: How to use AIDL services for updating counter value?
favorite count: 0
tagged with: android
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/24460923
has comment: http://stackoverflow.com/comment/37855340
has title: Export as Executable Jar File in Eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/37855092
has answer: http://stackoverflow.com/a/24460986
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37855103
has answer: http://stackoverflow.com/a/38743442
has comment: http://stackoverflow.com/comment/37855368
has comment: http://stackoverflow.com/comment/37855381
score: -1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37855311
answer count: 2
has comment: http://stackoverflow.com/comment/37855415
possible better answer: http://stackoverflow.com/a/38743442
upvote count: 0
linked to: http://stackoverflow.com/q/423938
tagged with: executable-jar
accepted answer: http://stackoverflow.com/a/24460986
has comment: http://stackoverflow.com/comment/37855166
has comment: http://stackoverflow.com/comment/37855104
has comment: http://stackoverflow.com/comment/37855101
has comment: http://stackoverflow.com/comment/37855175
tagged with: macos
has comment: http://stackoverflow.com/comment/37855211
favorite count: 0
has comment: http://stackoverflow.com/comment/37855222
has comment: http://stackoverflow.com/comment/37855439
has body: I just want to export a simple application in to a runnable jar or Mac OS X .app format. It is exporting fine but both don't run. The app runs without any errors in Eclipse. The applications loads data from Userdata.dat file. MainScreen is the Main Class.

http://stackoverflow.com/q/24565641
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: formatting
type: Question
has answer: http://stackoverflow.com/a/24624612
has answer: http://stackoverflow.com/a/24569631
score: 4
tagged with: struts2
has comment: http://stackoverflow.com/comment/38133327
answer count: 3
tagged with: jpa
linked to: http://stackoverflow.com/q/20511845
has title: How to show formatted contact numbers?
favorite count: 0
has comment: http://stackoverflow.com/comment/38117833
has comment: http://stackoverflow.com/comment/38157792
has comment: http://stackoverflow.com/comment/38125360
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38055989
has body: I have a field called phone number which has values such as 0833888999 that I want to format as following 0833 888 999. The answer that Rachana offered blew is true for few countries but not all countries. Therefore, I am using this Google library to format contact numbers from different countries; however, the problem is that after persisting the contact numbers in database I can not search for them on database, for example the library would format contact numbers of different countries in different format, for example add space or "-" between them that makes hibernate unable to find them. +18182223333 &gt;&gt;&gt; +1 818-222-3333 +441135558888 &gt;&gt;&gt; +44 113 555 8888 Hibernate .add(Restrictions.ilike("user.phone","+18182223333");
upvote count: 4
has answer: http://stackoverflow.com/a/24658130

http://stackoverflow.com/comment/37970450
score: 0
type: AnswerComment
has text: I need to do this in server side. Not in localhost. And without using any external library. I need to use it bro as like excel.
type: Comment
comment on: http://stackoverflow.com/a/24523116

http://stackoverflow.com/a/24510037
has body: You do not need any regular expression comparison in this scenario. A simple algorithm will work. Remove characters based on wild card from both the strings and then use equals() method to check. Something like this might help you if there is no more than one occurrence of wild card in each string: final String WILD_CARD = "(.)"; String str1 ="(.)01"; String str2 ="2(.)1"; int index = -1; if((index=str1.indexOf(WILD_CARD))!=-1) { str1 = str1.replace(WILD_CARD, ""); str2 = str2.replace(String.valueOf(str2.charAt(index)),""); } if((index=str2.indexOf(WILD_CARD))!=-1) { str2 = str2.replace(WILD_CARD, ""); str1 = str1.replace(String.valueOf(str1.charAt(index)), ""); } if(str1.equals(str2)) { System.out.println("Yes"); } else { System.out.println("No"); }
score: 0
has comment: http://stackoverflow.com/comment/37946197
answers question: http://stackoverflow.com/q/24509627
type: Answer
has comment: http://stackoverflow.com/comment/37946981
has comment: http://stackoverflow.com/comment/37946125
has comment: http://stackoverflow.com/comment/37946790

http://stackoverflow.com/q/24429578
has answer: http://stackoverflow.com/a/24437827
score: 0
has comment: http://stackoverflow.com/comment/37796917
answer count: 1
tagged with: heroku
tagged with: rhino
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37811163
has title: How can I resolve this IllegalAccessError in org.mozilla.javascript.optimizer.BodyCodegen running on Heroku?
tagged with: javascript
type: Question
has body: I have googled far and wide and not found any references to this issue, so any help would be much appreciated. I can regularly generate an illegal access error when using the Java Less compiler (https://github.com/marceloverdijk/lesscss-java), but not on my development machine - only on Heroku (and dokku it seems - same issue there). The compiler calls compile on some javascript code, which goes through the optimiser, and fails with the following stack trace: java.lang.IllegalAccessError: tried to access method org.mozilla.classfile.ClassFileWriter.getLabelPC(I)I from class org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager at org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager.endCatch(Codegen.java:4051) at org.mozilla.javascript.optimizer.BodyCodegen$ExceptionManager.removeHandler(Codegen.java:3952) at org.mozilla.javascript.optimizer.BodyCodegen.visitTryCatchFinally(Codegen.java:3705) at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1897) at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1873) at org.mozilla.javascript.optimizer.BodyCodegen.generateStatement(Codegen.java:1858) at org.mozilla.javascript.optimizer.BodyCodegen.generateBodyCode(Codegen.java:1289) at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:306) at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:166) at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:75) at org.mozilla.javascript.Context.compileImpl(Context.java:2377) at org.mozilla.javascript.Context.compileReader(Context.java:1296) at org.lesscss.LessCompiler.init(LessCompiler.java:295) at org.lesscss.LessCompiler.compile(LessCompiler.java:357) at org.lesscss.LessCompiler.compile(LessCompiler.java:450) This is particularly odd since the method it fails to call is public (https://github.com/mozilla/rhino/blob/master/src/org/mozilla/classfile/ClassFileWriter.java#L1260-L1268). As mentioned, I think this has s…

http://stackoverflow.com/comment/37972632
comment on: http://stackoverflow.com/a/24524232
has text: @laune the method `writeBytes()` is not appropriate to send a java String (have a look at the internal code and you'll see why) using `getBytes(...)` is not risky as an encoding is being specified
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38056355
score: 0
type: Comment
has text: Can you show us the method that you're trying to test?
type: QuestionComment
comment on: http://stackoverflow.com/q/24568972

http://stackoverflow.com/q/24546444
answer count: 4
has answer: http://stackoverflow.com/a/24546565
has comment: http://stackoverflow.com/comment/38014362
tagged with: java
has comment: http://stackoverflow.com/comment/38014238
has comment: http://stackoverflow.com/comment/38014777
type: Question
has answer: http://stackoverflow.com/a/24546620
has comment: http://stackoverflow.com/comment/38014289
score: 0
has comment: http://stackoverflow.com/comment/38015170
has body: I'm trying to understand Threads in Java. I've created a thread implementing the Runnable interface, which executes a certain function of a certain class. The following are the Java classes: MyThread Class public class MyThread implements Runnable { private DataContainer dataContainer; private Thread thread; public MyThread(DataContainer dataContainer) { this.dataContainer = dataContainer; thread = new Thread(this); thread.start(); thread.setName("Thread 2"); } @Override public void run() { System.out.println("MyThread : "+dataContainer.toString()); } public void runThread() { thread.run(); } } The DataContainer Class. The function of which I execute in the thread public class DataContainer { private static DataContainer instance = null; private DataContainer() {} public static DataContainer getInstance() { if(null == instance) instance = new DataContainer(); return instance; } @Override public String toString() { return Thread.currentThread().getName()+" : __Data__"; } } The main class public class Launcher { public static void main(String[] args) { DataContainer dataContainer = DataContainer.getInstance(); MyThread myThread = new MyThread(dataContainer); int i =0; while(i++&lt;10) { System.out.println("Launcher : "+ dataContainer.toString()); myThread.runThread(); } } } The problem is, in the while loop where is execute the dataContainer.toString() from the main class and the myThread instance, I get the output as they are all running in one thread: main thread. None of the executions in the loop are executed from Thread 2. My aim is that, in the while loop, I want myThread.runThread() to be executed under the thread Thread 2. EDIT: Added thread.start(). However, now it gets executed only once? I can't create a new thread every time I want to execute myThread.runThread(). By creating a new thread in the loop, I'd end up creating a bunch of threads. Is this advisable? I want a certain piece of code(say Y) to be executed by a thread(say X). Every time Y has to be ex…
has comment: http://stackoverflow.com/comment/38015053
has comment: http://stackoverflow.com/comment/38014202
has answer: http://stackoverflow.com/a/24555790
tagged with: runnable
has comment: http://stackoverflow.com/comment/38014708
has title: Understanding Threads implementing Runnable in java
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/24546500

http://stackoverflow.com/comment/37946833
type: QuestionComment
score: 0
has text: iterate over all objects?
comment on: http://stackoverflow.com/q/24510412
type: Comment

http://stackoverflow.com/a/24544187
has comment: http://stackoverflow.com/comment/38010827
upvote count: 1
type: Answer
has body: A static field would be a property shared by all mugs. For example numberOfMugsInTheCloset. Non final static fields are often a bad practice though...
has comment: http://stackoverflow.com/comment/38016293
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24544133
has comment: http://stackoverflow.com/comment/38010928

http://stackoverflow.com/q/24536056
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37999696
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37994897
duplicate of: http://stackoverflow.com/q/21881992
type: Question
has comment: http://stackoverflow.com/comment/37995544
has body: I am trying to use sqlite in Android programming . This is my DBAdapter code. package com.vahe_muradyan.notes; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DBAdapter { private static final String TAG = DBAdapter.class.getSimpleName(); public static final String COLUMN_ID = "_id"; public static final String COLUMN_TITLE = "title"; public static final String COLUMN_BODY = "notes"; private DatabaseHelper DbHelper; public static SQLiteDatabase Db; private static final String DATABASE_NAME = "notes.db"; private static final String TABLE_NAME = "notes"; private static final int DATABASE_VERSION = 1; private final Context context; private static class DatabaseHelper extends SQLiteOpenHelper { public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase arg0) { String sql = String .format("create table %s (%s int primary key, %s text, %s text)", TABLE_NAME, COLUMN_ID, COLUMN_TITLE, COLUMN_BODY); arg0.execSQL(sql); } @Override public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) { arg0.execSQL("DROP TABLE IF EXISTS notes"); onCreate(arg0); } } public DBAdapter(Context contextArg) { context = contextArg; } public DBAdapter open() throws SQLException { DbHelper = new DatabaseHelper(context); Db = DbHelper.getWritableDatabase(); return this; } public void close(){ Db.close(); } public long insertNote(String title, String text) { ContentValues values = new ContentValues(); values.put(COLUMN_TITLE, title); values.put(COLUMN_BODY, text); return Db.insertWithOnConflict(TABLE_NAME, null, values, SQLiteDatabase.CONFLICT_IGNORE); } public boolean deleteNote(long rowId) { return Db.delete(TABLE_NAME, COLUMN_ID + "=" + rowId, null) &gt; 0; } public Cursor getAllNotes() { return Db.query(TABLE_NA…
has comment: http://stackoverflow.com/comment/38012939
has title: Android Java SQLite
score: 0
tagged with: sqlite
linked to: http://stackoverflow.com/q/21881992
has comment: http://stackoverflow.com/comment/37995798

http://stackoverflow.com/a/24551121
type: Answer
answers question: http://stackoverflow.com/q/24550757
score: 0
has body: You basically need this constructor SimpleDateFormat(String pattern, Locale locale) of java.text.SimpleDateFormat

http://stackoverflow.com/comment/37937451
comment on: http://stackoverflow.com/q/24503299
has text: @ChrisK Please check updated part.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24463734
favorite count: 0
tagged with: android
has body: Somehow I couldn't find the answer to this. I am running a query to parse.com and want to download all of the rows that contain an empty value in one of my columns. ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery(Constants.myTestTable); query.whereEqualTo("MyColumn", ""); When I upload a csv to parse where MyColumn does not have any value the column cells on parse show "(undefined)" and I cannot retrieve the data. However, when I delete all content in the cell I am able to retrieve it. I want to be able to retrieve the data if the cell has the default "(undefined)" value from parse. I tried... ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery(Constants.myTestTable); query.whereEqualTo("MyColumn", null); But that did not work either. I'm sure there is an easy solution to this, I just can't get the dang thing to work.
score: 2
type: AnsweredQuestion
has title: Queries with empty values from parse.com
tagged with: parse-platform
has answer: http://stackoverflow.com/a/24470088
upvote count: 2
tagged with: multithreading
type: Question
accepted answer: http://stackoverflow.com/a/24470088
tagged with: java
downvote count: 0
answer count: 1
tagged with: synchronization

http://stackoverflow.com/q/24503053
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/24503208
downvote count: 6
has comment: http://stackoverflow.com/comment/37933893
has title: How to check a string to see if it contains an 8 or a 9 in Java
upvote count: 1
has body: I have a project for school where I have to check an octal number and reject it if it's not octal, and I've no clue how to run a loop to do this. I'm a beginner. Scanner in = new Scanner(System.in); String octalNum; System.out.print("Please enter a postive octal number: "); octalNum = in.next(); for (int i = 0; i &lt; octalNum.length(); i++) { if (octalNum.charAt(i) == 8 || octalNum.charAt(i) == 9) { System.out.print("Please enter a postive octal number: "); octalNum = in.next(); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37934006
has answer: http://stackoverflow.com/a/24503208
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/37933850
has comment: http://stackoverflow.com/comment/37933929
tagged with: contains
score: -5

http://stackoverflow.com/a/24470547
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24470491
answers question: http://stackoverflow.com/q/24470491
type: Answer
has body: You should define the toString() method in the Holding class. As it is not defined there, nor in the super class (GeoUnit), then the super-super class method is used (Object)
downvote count: 0
score: 1

http://stackoverflow.com/a/24438239
has body: Change your controller to be like this: @Controller @RequestMapping("/student") @SessionAttributes({"studentForm", "gradeList", "genderList", "extraSubjects"}) public class StudentController { private Logger logger = Logger.getLogger(StudentController.class); @ModelAttribute("studentForm") Student getStudent() { Student student = new Student(); student.setGender("Male"); List&lt;String&gt; extraSubjectsStd = new ArrayList&lt;String&gt;(); extraSubjectsStd.add("Math II"); extraSubjectsStd.add("Population"); student.setExtraSubjects(extraSubjectsStd); return student; } @ModelAttribute("gradeList") GradeList getGradeList() { LinkedHashMap&lt;Integer, String&gt; gradeList = new LinkedHashMap&lt;Integer, String&gt;(); gradeList.put(1, "Class 1"); gradeList.put(2, "Class 2"); gradeList.put(3, "Class 3"); gradeList.put(4, "Class 4"); gradeList.put(5, "Class 5"); return gradeList; } @ModelAttribute("genderList") List&lt;String&gt; getGenderList() { List&lt;String&gt; genderList = new ArrayList&lt;String&gt;(); genderList.add("Male"); genderList.add("Female"); return genderList; } @ModelAttribute("extraSubjects") List&lt;String&gt; getExtraSubjects() { List&lt;String&gt; extraSubjects = new ArrayList&lt;String&gt;(); extraSubjects.add("Math II"); extraSubjects.add("Population"); extraSubjects.add("Computer"); return extraSubjects; } @RequestMapping("/home") public String getHomePage() { return "home"; } @RequestMapping(value = "/add", method = RequestMethod.GET) public String addStudentForm() { return "addstudent"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String addStudent( @Valid @ModelAttribute("studentForm") Student student, BindingResult result, SessionStatus sessionStatus) { if (result.hasErrors()) { logger.info("Returning add page with errors"); return "addstudent"; } sessionStatus.setComplete(); //Stuffs to save in database return "redirect:add"; } } While we're at it: Your data like gradeList should probably be in a database. /student URL…
score: 0
answers question: http://stackoverflow.com/q/24428930
has comment: http://stackoverflow.com/comment/37897054
type: Answer

antlr
tags question: http://stackoverflow.com/q/24520689
tags question: http://stackoverflow.com/q/24495811
tags question: http://stackoverflow.com/q/24471394
tag name: antlr
type: Tag
tags question: http://stackoverflow.com/q/24528512

http://stackoverflow.com/a/24493467
answers question: http://stackoverflow.com/q/24493378
has comment: http://stackoverflow.com/comment/37918065
score: 1
has comment: http://stackoverflow.com/comment/37949749
has comment: http://stackoverflow.com/comment/37919469
type: AcceptedAnswer
downvote count: 0
has body: Your fragment element in your layout XML can only ever refer to that single fragment and can't be swapped out in the way you intend. Instead, you need to remove the fragment element from your layout XML entirely and add your Fragment01 into your container FrameLayout in code in the onCreate() method of your activity. So, remove the fragment element, like so; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" &gt; &lt;FrameLayout android:id="@+id/button_fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/LinearLayout&gt; Then you can perform your transaction in the beginning of your onCreate() override, like so; FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); transaction.replace(R.id.button_fragment_container, new Fragment01()); transaction.commit(); You will want to instantiate a new FragmentTransaction for each new transaction, which means you'll probably want to remove the FragmentManager and FragmentTransaction from your instance members and declare them fresh each time you need to make a fragment transaction. I hope this helps. Further reading: Official Fragments API Tutorial
type: Answer
accepted answer of: http://stackoverflow.com/q/24493378
upvote count: 1

http://stackoverflow.com/q/24541106
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/38005700
tagged with: ejb
downvote count: 0
has comment: http://stackoverflow.com/comment/38005314
answer count: 1
has comment: http://stackoverflow.com/comment/38005379
has answer: http://stackoverflow.com/a/56478022
favorite count: 0
has comment: http://stackoverflow.com/comment/38004833
has body: I am trying to invoke methods of an EJB Facade from another but I am facing some errors then I ask your help to do this in correct way. I will post the current code to try to explain. The JSF Bean front end object starts the sequence of calls: @RequestScoped public class FrontEndBean { @EJB private SomeFacade someFacade; public String submit() { MyEntityObject myobj = new MyEntityObject(); myobj.setStringProperty("somestring"); someFacade.businessMethodOnSomeFacade(myobj); } } The first Façade source looks like this: @Stateless public class SomeFacade { @EJB private AnotherFacade anotherFacade; public void businessMethodOnSomeFacade(MyEntityObject obj) { if (obj.getStringProperty() != null) { anotherFacade.businessMethodOnAnotherFacade(obj); } } } And the Another Façade: @Stateless public class AnotherFacade { public void businessMethodOnAnotherFacade(MyEntityObject obj) { if (obj.getStringProperty().equals("somestring")) { // null pointer exception } } } Is it correct? Can I invoke an EJB façade from another using @EJB? If not, What is the correct way to do this?
has comment: http://stackoverflow.com/comment/38005563
has comment: http://stackoverflow.com/comment/38010185
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: facade
has title: EJB Façade calling methods in another EJB
upvote count: 1
accepted answer: http://stackoverflow.com/a/56478022
type: Question

http://stackoverflow.com/comment/37820633
score: 0
type: QuestionComment
type: Comment
has text: I think these user agent strings are true, I checked mine on http://www.whatsmyuseragent.com/ (I am using Chrome 35 on Windows 8.1) It seems like my user agent is very similar to your Chrome user agent (except OS part) string `Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36`. So, don't get confused by all these Mozilla-Safari words etc.
comment on: http://stackoverflow.com/q/24441788

http://stackoverflow.com/q/24466451
tagged with: java
tagged with: servlets
tagged with: tdd
type: AnsweredQuestion
has body: The current approach is creating HTML in a ServletTest, run the test, change the Servlet until the test turns into green. However, it feels like that this approach to TDD in Servlets is devious and more time-consuming than TDD ordinary Java classes as HTML created in the ServletTest is copied to the Servlet for the most part and subsequently changed regarding the format (e.g. removing backslashes) instead of testing the output in a Test for ordinary Java Classes and writing most of the code in the main. ServletTest: HttpServletRequest mockedHttpServletRequest = mock(HttpServletRequest.class); HttpServletResponse mockedHttpServletResponse = mock(HttpServletResponse.class); HttpSession mockedHttpSession = mock(HttpSession.class); StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); private final String doGetHtmlStringPartOne = " " + " "; private final String doGetHtmlStringPartTwo = "<\\/h1><\\/td>" + " " + " " + " <input type=\"hidden\" name=\"fractionBoolean\"" + " value=\""; private final String doGetHtmlStringPartThree = " (\\d)+(\\s\\/\\s(\\d)+)?<\\/td>"; private final String doGetHtmlStringPartFour = "<\\/tr> " + " " + "<\\/td><\\/tr><\\/table><\\/form><\\/body><\\/html>" + " " + " <\\/form>"; @Test public void testBooleanFractionTrue() throws IOException, ServletException { mockDoGet(); assertTrue(stringWriter.getBuffer().toString().trim().matches(expectedDoGetHtmlString("1 \\/ 1 \\+ 1 \\/ 1", true))); } public String expectedDoGetHtmlString(String assignment, Boolean fractionBoolean) { return doGetHtmlStringPartOne + assignment + doGetHtmlStringPartTwo + "" + fractionBoolean + "" + "\" \\/>" + "\\n" + doGetHtmlStringPartThree + "\\n" + doGetHtmlStringPartFour; } public void mockDoGet() throws IOException, ServletException { when(mockedHttpServletRequest.getSession()).thenReturn( mockedHttpSession); when(mockedHttpServletResponse.getWriter()).thenReturn(printWriter); when(mockedHttpServletRequest.getParameter(…
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37872604
favorite count: 0
has comment: http://stackoverflow.com/comment/37868507
type: Question
has comment: http://stackoverflow.com/comment/38268812
has answer: http://stackoverflow.com/a/24681780
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24681780
has comment: http://stackoverflow.com/comment/37872586
has comment: http://stackoverflow.com/comment/37865354
upvote count: 1
answer count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/38269070
has comment: http://stackoverflow.com/comment/37865307
has title: Could current approach to TDD in Servlets be optimized?

http://stackoverflow.com/a/24538206
upvote count: 4
answers question: http://stackoverflow.com/q/24537769
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24537769
has body: First of all, use binary distribution -- it's ready to be consumed as soon as you unpack it. Secondly, you can't find sbt file because recently (0.8.1+) kafka project migrated to gradle (a different build tool) and now you have to use gradle commands: ./gradlew clean ./gradlew releaseTarGz (this will produce the very same binary release I've mentioned above). Check out README.md file inside the project for a full guide on gradle tasks.
type: Answer
score: 4

http://stackoverflow.com/comment/37864774
has text: I have a textview with already defined text how should I do
comment on: http://stackoverflow.com/a/24465910
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37897242
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24483176
has text: This question might help you http://stackoverflow.com/questions/6690745/converting-integer-to-long
score: 0

http://stackoverflow.com/comment/37891614
comment on: http://stackoverflow.com/a/24479998
has text: Im asking about **other** applications, not just the one being ran. For example changing the icon of **a single** .doc
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37956296
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24515067
has text: how can I send a toast instead of change text of button?
type: AnswerComment

http://stackoverflow.com/comment/37921618
type: AnswerComment
score: 0
has text: as you said, i edit my code and post all you want. thanks a lot for your time and your help :))
type: Comment
comment on: http://stackoverflow.com/a/24496107

http://stackoverflow.com/a/24493502
answers question: http://stackoverflow.com/q/24493220
has body: You must specify the encoding when reading the file, in your case probably is UTF-16. Reader reader = new InputStreamReader(new FileInputStream(fileName), "UTF-16"); BufferedReader br = new BufferedReader(reader); Check the documentation for more details: InputStreamReader class.
upvote count: 4
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/37973803
has text: The problem is, `p1` is wanting to paint something, you've solved one problem by creating another
comment on: http://stackoverflow.com/a/24524897
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/36378756
type: Answer
score: 2
upvote count: 2
has body: You can check this link as it helps me. Click here There is a table called release_ which contains a column build number. This has build number. I faced same issue so I deleted only this table and then restart server again. I have back up for my db for version liferay 6.2 cega2. I tried to install same version in different machine and I got this error.
downvote count: 0
answers question: http://stackoverflow.com/q/24568775

http://stackoverflow.com/a/24465415
accepted answer of: http://stackoverflow.com/q/24465349
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24465349
has comment: http://stackoverflow.com/comment/37884383
type: Answer
has comment: http://stackoverflow.com/comment/37879603
has comment: http://stackoverflow.com/comment/37867702
upvote count: 1
has body: class A&lt;T extends interfaceA &amp; interfaceB&gt; means that T is bounded by two interfaces. Thus,any type argument passed to T must implement interfaceA and interfaceB. Sample program for your understanding :- interface X{ public void eat(); } interface Y{ public void drink(); } class XYZ implements X,Y{ @Override public void eat(){ System.out.println("I am eating."); } @Override public void drink(){ System.out.println("I am drinkin too!"); } } class A&lt;T extends X &amp; Y&gt; { public void display(){ XYZ x=new XYZ(); x.eat(); x.drink(); System.out.println("Type of XYZ is "+x.getClass().getName()); } } public class Sample1{ public static void main(String[] args) { A&lt;XYZ&gt; a=new A&lt;&gt;(); a.display(); } } This means that type which argument passed to T must implement interfaces X and Y. Like shown in the given code :- A&lt;XYZ&gt; a=new A&lt;&gt;(); //here only XYZ(substituted in place of T) can be passed because it implements both interface X and interface Y I hope this much helps you understand and point out the differences!!!
has comment: http://stackoverflow.com/comment/37864601
type: AcceptedAnswer

http://stackoverflow.com/comment/75708017
type: Comment
comment on: http://stackoverflow.com/a/24438766
has text: @Faakhir This answer is based on OP requirement which states that `The number is formatted like this (123) 123 1111` so it excludes `+XX` part representing country code. But answer also contains version which describes how to remove *only* whitespaces and parenthesis, so it should leave other characters like `+` : `replaceAll("[\\s()]+","")`. Pick version which matches your needs.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37839773
comment on: http://stackoverflow.com/q/24452332
score: 0
type: Comment
type: QuestionComment
has text: @blgt Ok please help me with the flush part. I tried what the other question says. Now that I have a BufferedImage, how to save that as a jpg image here "C:\\ImagenesAlmacen\\QR\\olaKeAse.jpg"?

http://stackoverflow.com/comment/37921709
comment on: http://stackoverflow.com/q/24496342
has text: can you post a log cat?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37812591
score: 1
has text: Priorities really only come into play when there's contention for CPU time. On a quad core system, that's not even all that significant a factor til the system's trying to do 4 CPU-bound tasks simultaneously.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24437871

http://stackoverflow.com/comment/37855337
score: 0
comment on: http://stackoverflow.com/q/24460934
type: Comment
type: QuestionComment
has text: This jar: http://jdbc.postgresql.org/download.html

http://stackoverflow.com/comment/89076207
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24492218
score: 0
has text: don't include images of text. copy and paste the text instead.

multithreading
tags question: http://stackoverflow.com/q/24471513
tags question: http://stackoverflow.com/q/24441751
tags question: http://stackoverflow.com/q/24531375
tags question: http://stackoverflow.com/q/24477316
tags question: http://stackoverflow.com/q/24483093
tags question: http://stackoverflow.com/q/24529070
tags question: http://stackoverflow.com/q/24580769
tags question: http://stackoverflow.com/q/24438030
tags question: http://stackoverflow.com/q/24494656
tags question: http://stackoverflow.com/q/24568749
tags question: http://stackoverflow.com/q/24531686
tags question: http://stackoverflow.com/q/24480382
tags question: http://stackoverflow.com/q/24565648
type: Tag
tags question: http://stackoverflow.com/q/24585279
tags question: http://stackoverflow.com/q/24531252
tags question: http://stackoverflow.com/q/24468356
tags question: http://stackoverflow.com/q/24540610
tags question: http://stackoverflow.com/q/24498181
tags question: http://stackoverflow.com/q/24444614
tags question: http://stackoverflow.com/q/24507326
tags question: http://stackoverflow.com/q/24503191
tags question: http://stackoverflow.com/q/24469063
tags question: http://stackoverflow.com/q/24573027
tags question: http://stackoverflow.com/q/24578523
tags question: http://stackoverflow.com/q/24575239
tags question: http://stackoverflow.com/q/24587908
tags question: http://stackoverflow.com/q/24547873
tags question: http://stackoverflow.com/q/24428376
tags question: http://stackoverflow.com/q/24573269
tags question: http://stackoverflow.com/q/24493811
tags question: http://stackoverflow.com/q/24587420
tags question: http://stackoverflow.com/q/24520921
tags question: http://stackoverflow.com/q/24570005
tags question: http://stackoverflow.com/q/24520129
tags question: http://stackoverflow.com/q/24536900
tags question: http://stackoverflow.com/q/24484558
tags question: http://stackoverflow.com/q/24442506
tags question: http://stackoverflow.com/q/24565679
tags question: http://stackoverflow.com/q/24527419
tags question: http://stackoverflow.com/q/24574059
tags question: http://stackoverflow.com/q/24478423
tags question: http://stackoverflow.com/q/24488091
tags question: http://stackoverflow.com/q/24508567
tags question: http://stackoverflow.com/q/24487928
tags question: http://stackoverflow.com/q/24479155
tags question: http://stackoverflow.com/q/24587822
tags question: http://stackoverflow.com/q/24512909
tags question: http://stackoverflow.com/q/24430308
tags question: http://stackoverflow.com/q/24427592
tags question: http://stackoverflow.com/q/24585283
tags question: http://stackoverflow.com/q/24429943
tags question: http://stackoverflow.com/q/24503299
tags question: http://stackoverflow.com/q/24541672
tags question: http://stackoverflow.com/q/24471543
tags question: http://stackoverflow.com/q/24508093
tags question: http://stackoverflow.com/q/24434566
tags question: http://stackoverflow.com/q/24539516
tags question: http://stackoverflow.com/q/24569229
tags question: http://stackoverflow.com/q/24451052
tags question: http://stackoverflow.com/q/24462146
tags question: http://stackoverflow.com/q/24465421
tags question: http://stackoverflow.com/q/24537911
tags question: http://stackoverflow.com/q/24433595
tags question: http://stackoverflow.com/q/24522363
tags question: http://stackoverflow.com/q/24579445
tags question: http://stackoverflow.com/q/24516534
tags question: http://stackoverflow.com/q/24448460
tags question: http://stackoverflow.com/q/24437871
tags question: http://stackoverflow.com/q/24440084
tags question: http://stackoverflow.com/q/24433538
tags question: http://stackoverflow.com/q/24561596
tags question: http://stackoverflow.com/q/24451194
tags question: http://stackoverflow.com/q/24481515
tags question: http://stackoverflow.com/q/24485255
tags question: http://stackoverflow.com/q/24523650
tags question: http://stackoverflow.com/q/24508768
tags question: http://stackoverflow.com/q/24520431
tags question: http://stackoverflow.com/q/24579683
tags question: http://stackoverflow.com/q/24548624

http://stackoverflow.com/q/24555689
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24670671
tagged with: java
has body: I want to lsit all the files form a directory i get as a paramter that end in .java and have a certain text in them,I have issues when i want to do this for all of it's ssubfolders. Using filenamefilter on a folder only returns the files in the folder not in it's subfolders. Any ideea how I can make it work on the subfolders too?
type: UnansweredQuestion
tagged with: filter
has title: Filtering all files from a folder and it's subfolders in java using FilenameFilter
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/38023616
comment on: http://stackoverflow.com/a/24537396
type: AnswerComment
score: 0
has text: threads are *no* instances of SmartQueue. Never. That’s the whole point, making `SmartQueue` a subclass of `Thread` makes you think there was a relationship that simply doesn’t exist. Using `Runnable` helps you to understand that threads are only executing an *action*, i.e. the code inside the `run` method, nothing more. Whether the contained variables are accessed by one or more threads depends on your entire application logic. And as said, your (vague) description indicates that you *want* access the data by multiple threads. So you must make them thread safe.
type: Comment

http://stackoverflow.com/q/24449145
tagged with: rows
type: Question
tagged with: cell
has body: I have come across need to add table or rows inside cell in excel. I googled but did't found any thing. Please help me know how to do it.
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
upvote count: 1
has title: Apache POI create rows or table inside cell in excel
has comment: http://stackoverflow.com/comment/37833612
has answer: http://stackoverflow.com/a/24449301
score: 1
tagged with: java

http://stackoverflow.com/q/24511856
tagged with: jmap
has title: How represent Routing in JMapViewer
tagged with: java
type: Question
tagged with: openstreetmap
has body: I use JMapViewer to draw the map in my java desktop application. I would know if exists some methods that I can use to draw the shortest path between to Point following the car path.
score: 0
answer count: 1
tagged with: jmapviewer
type: UnansweredQuestion
tagged with: dictionary
has answer: http://stackoverflow.com/a/24512096

http://stackoverflow.com/comment/38069355
type: QuestionComment
has text: Both are valid, but often enough, if you find yourself creating objects to call a single method, your method should be static
score: 2
comment on: http://stackoverflow.com/q/24576028
type: Comment

http://stackoverflow.com/q/24584258
score: -1
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/38084352
tagged with: object
has title: How can one relate two objects in java?
type: UnansweredQuestion
has body: What I would like to know is how one can set an object to react in a certain way to another specific object. For example: There could be a class called swordInStone and it only reacts when someone from the class royalty tries to grab it. IE: public class swordInStone{ if(swordHilt.isPulledBy(royalty.grab)){ releaseSword(); } } but in the example code, royalty would have to be a named and active object, such as Arthur. I would like to be able to replace it with any object from the class royalty
has comment: http://stackoverflow.com/comment/38084362
has answer: http://stackoverflow.com/a/24584287
favorite count: 0
type: Question
answer count: 1

http://stackoverflow.com/comment/63882120
type: AnswerComment
has text: Don't forget to make your `JNI_OnLoad_X` function returns at least `JNI_VERSION_1_8` or the library will be silently ignored.
score: 3
type: Comment
comment on: http://stackoverflow.com/a/24544960

http://stackoverflow.com/a/24434146
answers question: http://stackoverflow.com/q/24433985
type: Answer
score: 0
has body: One possibility would be to throw an exception from the failing check, which would then be caught in the calling method. Another option would to have myMethod return a boolean of true if all of the checks pass and the modification/calculation is done, and false otherwise. As new_web_programmer said, though, it completely depends on what you are trying to do.

http://stackoverflow.com/comment/51663395
has text: @GabrieleMariotti FAB not showing fully in lollipop(Moto G). Image link https://i.sstatic.net/qmR0f.png
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24548910
type: AnswerComment

http://stackoverflow.com/q/24570858
type: Question
upvote count: 5
tagged with: appfog
has title: Appfog - Spring application - Disk usage
answer count: 1
has body: I have a Spring application running on Appfog. App is connected to a Mysql DB and doesn't use disk storage (it only perform select or insert queries). I noticed that the disk usage increased constantly in time (My database is very small, it can't be over 300MB). This is a screenshot: Why disk usage doesn't remain fixed? Thanks
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 4
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/25621769
downvote count: 1

http://stackoverflow.com/comment/37916315
score: 0
has text: Its saved as .txt i'm using sublime editor.. could that be why?.. furthermore i have two other files which are saved in the same way using sublime but this issue doesnt appear on those files
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24493220

http://stackoverflow.com/comment/38056025
comment on: http://stackoverflow.com/a/24563874
type: Comment
score: 0
type: AnswerComment
has text: I used Scanner to pass InputStream, the result is the same

http://stackoverflow.com/comment/38055565
has text: @RandyGilman if you are using netbeans then you need to disable that error because it is a bug, follow this thread http://stackoverflow.com/questions/4122959/usage-of-eclipse-warning-field-declaration-hides-another-field-or-variable
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24568398

http://stackoverflow.com/comment/37822455
comment on: http://stackoverflow.com/q/24437105
score: 0
has text: Not having source code != having to change it at runtime. You're much better off modifying the library statically if at all possible, since dynamic code modification is not only more complicated, but it looks suspicious to virus scanners too.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24444561
has body: I am Facing Error: Java heap space and Error: GC overhead limit exceeded So i started looking into hadoop-env.sh. so thats what i understand so far, Please correct me if i am wrong. if HADOOP_HEAPSIZE=7168 in hadoop-env.sh this will invoke datanode daemon and tasktracker daemon on datanode with 7GB memory assigned to each(datanode(7GB)+ tasktracker(7GB) = 14GB) and mapred.tasktracker.reduce.tasks.maximum = 3 mapred.tasktracker.map.tasks.maximum = 6 and mapred.child.java.opts -Xmx1024m So this will invoke 9 child JVMs with 1GB memory, so total of 9GB But tasktracker is invoked with 7GB memory, so this wil conflict. as max memory for tasktracker and child JVMS invoked by tasktracker is 7GB, but they are consuming 9G. So the heap space error occured, is my calculation correct?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37824958
answer count: 0
score: 0
tagged with: java
type: Question
tagged with: hadoop
tagged with: hadoop2
tagged with: hadoop-partitioning
tagged with: hadoop-streaming
has comment: http://stackoverflow.com/comment/37825190
has title: Querstion regarding hadoop-env.sh

spdy
tag name: spdy
tags question: http://stackoverflow.com/q/24472814
type: Tag
tags question: http://stackoverflow.com/q/24544699

http://stackoverflow.com/comment/38108300
type: Comment
type: QuestionComment
has text: Yeah i can able to get it in program via Thread.CurrentName() but cant able to assign the name in spring config. Thatz my problem
score: 0
comment on: http://stackoverflow.com/q/24584380

http://stackoverflow.com/q/24443958
has title: Get signature and certification path from PFX
type: Question
downvote count: 0
tagged with: pfx
favorite count: 0
tagged with: digital-signature
type: UnansweredQuestion
upvote count: 1
has body: I have a SOAP message like &lt;soapenv:Envelope xmlns:soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:v = "http://www.something.com"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;v:Auth&gt; &lt;v:userID&gt;xxxxxxxxxx&lt;/v:userID&gt; &lt;v:password&gt;xxxxxxxxxx&lt;/v:password&gt; &lt;v:certChain&gt;xxxxxxxxxx&lt;/v:certChain&gt; &lt;v:signature&gt;xxxxxxxxxx&lt;/v:signature&gt; &lt;/v:Auth&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; After generating the java source code from WSDL, for Auth, I am setting value like this. (all the below 4 fields are string datatype) Auth authInfo = new Auth(); authInfo.setUserID(userId); authInfo.setPassword(password); authInfo.setCertChain(""); authInfo.setSignature(""); The following is the piece of code using which I get signature, digest value, certificate chain. But when I populate the values and submit the SOAP message I get a Digital Signature Invalid Error. But I verified that the signature is valid. Code to extract the details: I face issue with getting certification path and signature from pfx file. Can you share the code which gets them, I have the following piece of code to get them. When I use the signature and certification path obtained through below code , I always get Invalid Digital signature. public void getCertificateDetails(){ String aliasName="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // not posted here try{ char[] passwd = KEY_STORE_PASSWORD.toCharArray(); keyStore = KeyStore.getInstance("PKCS12","SunJSSE"); FileInputStream fis = new FileInputStream("path to pfx file"); keyStore.load(fis, passwd); fis.close(); Enumeration aliases; Certificate[] cc = keyStore.getCertificateChain(aliasName); X509Certificate certificate1 = (X509Certificate) cc[0]; System.out.println("signo algo:"+certificate1.getSigAlgName()); // get the value as SHA256withRSA PrivateKey pKey = (PrivateKey)keyStore.getKey("xxxxxxxxxxxxxxxxxxxxxxxxx", passwd); keyStore.getCertificate(aliasName); X509Certificate[] result = …
answer count: 0
score: 1
tagged with: java
tagged with: certificate

http://stackoverflow.com/comment/38010961
type: AnswerComment
type: Comment
has text: No. The first line in Throwable.printStackTrace() is the line where the exception was thrown. It isn't necessarily a line in the method you called printStackTrace() from at all.
score: 1
comment on: http://stackoverflow.com/a/24544373

http://stackoverflow.com/comment/37799369
type: Comment
type: QuestionComment
has text: @Opiatefuchs , I pos the logcat output and error at line =06-26 18:08:09.083: W/System.err(601): at com.employee_review.Update_Entry.onCreate(Update_Entry.java:68) means here = Cursor cursor = db.rawQuery("SELECT staff_employee_id, staff_emp_name, department, designation FROM employee_details WHERE staff_emp_name = ?", new String[] { "" + selectedEmployeeName });
score: 0
comment on: http://stackoverflow.com/q/24430683

http://stackoverflow.com/comment/37898143
score: 2
type: Comment
type: QuestionComment
has text: Can you plz show your code, so that we can help you.
comment on: http://stackoverflow.com/q/24483645

http://stackoverflow.com/comment/37930140
has text: I updated the answer to address some of your questions, as best as they can be answered, from this side of the web.
comment on: http://stackoverflow.com/a/24492268
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24509601
type: Answer
has comment: http://stackoverflow.com/comment/37946365
has body: this is happeninig because you are fetching the value AVG(performance_rate_one) and while searching for the column with the name performance_rate_one. So getColumnIndex will return -1 and hence the error you are getting. Either use alias in your query or use the column name as AVG(performance_rate_one) while fetching. EDIT For example: if in Query you select field as AVG(performance_rate_one) as col1 Then while fetching you should write cursor.g‌​etColumnIndex("col1") Hope this helps.
upvote count: 1
has comment: http://stackoverflow.com/comment/37946569
has comment: http://stackoverflow.com/comment/37946279
score: 1
accepted answer of: http://stackoverflow.com/q/24509053
has comment: http://stackoverflow.com/comment/37946254
answers question: http://stackoverflow.com/q/24509053
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37946883
has comment: http://stackoverflow.com/comment/37947012
has comment: http://stackoverflow.com/comment/37946314

http://stackoverflow.com/q/24495536
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: testing
tagged with: java
has title: Test Async-Task using app resources
type: Question
has body: I'm testing my android application. I have two android projects, one contains the app, and the other the test classes. I'm testing a AsyncTask: public class SimilarityTask extends AsyncTask&lt;Boolean, Void, SimilarityData&gt; { /*More code here*/ @Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(context); mProgressDialog.setTitle(context.getText(R.string.solving_puzzle)); mProgressDialog.setMessage(context.getText(R.string.calc_similarity)); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgressDialog.setCancelable(true); } public SimilarityTask(Context context) { this.context = context; } /*More code here*/ } As you can see, I create a progress dialog on the activity where this AsyncTask is called using the activity as context. The code works right, but the problem comes when I'm trying to test it. public class SimilarityTaskTest extends ActivityTestCase { public void testSimilarity() { task = new SimilarityTask(getInstrumentation().getContext()); task.execute(false); } } When I use this code, it fails on onPreExecute(): android.content.res.Resources$NotFoundException: String resource ID #0x7f07000a at android.content.res.Resources.getText(Resources.java:229) at android.content.Context.getText(Context.java:282) at com.example.tfg.SimilarityTask.onPreExecute(SimilarityTask.java:43) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586) at android.os.AsyncTask.execute(AsyncTask.java:534) at com.example.tfg.test.SimilarityTaskTest.testSimilarity(SimilarityTaskTest.java:161) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214) at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175) at android.test.InstrumentationTestRunner.onStart(Instrument…
answer count: 1
tagged with: android-context
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24495989

http://stackoverflow.com/comment/37916715
type: Comment
comment on: http://stackoverflow.com/a/24492561
type: AnswerComment
has text: @SimonRichter JLS specifically states "Writes and reads of volatile long and double values are always atomic.". Word tearing cannot occur for any other primitive values or references as well. Hence volatility gives absolute defense against word tearing
score: 0

http://stackoverflow.com/comment/131016263
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/53824823
score: 3
has text: `serialVersionUID` should be a hashed value generated from the [specification](https://docs.oracle.com/javase/6/docs/platform/serialization/spec/class.html#4100) instead of a random value. I think the top voted answer from Serhii Maksymchuk is a better answer than this one as the `serialVersionUID` using his way seems generated from the signature of the Object.

http://stackoverflow.com/comment/38007001
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24542375
type: QuestionComment
has text: Do the same thing you would do if you took a number 2.

http://stackoverflow.com/q/24492591
tagged with: java
type: Question
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has title: Async thread - dataexchange with UI
tagged with: android
has answer: http://stackoverflow.com/a/24492871
accepted answer: http://stackoverflow.com/a/24492871
tagged with: multithreading
type: AnsweredQuestion
has body: In my app I have to download data from a server. I put the HTTP request in an Async-Thread. How can I use the data (== a string) in the main UI? The platform is Android, and the programming language is Java 1.6.

http://stackoverflow.com/a/24548749
has comment: http://stackoverflow.com/comment/38022294
downvote count: 0
has comment: http://stackoverflow.com/comment/38018919
has comment: http://stackoverflow.com/comment/38024895
has comment: http://stackoverflow.com/comment/75658099
answers question: http://stackoverflow.com/q/24548624
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38062397
has comment: http://stackoverflow.com/comment/38063308
has comment: http://stackoverflow.com/comment/75700495
score: 8
has comment: http://stackoverflow.com/comment/38019132
accepted answer of: http://stackoverflow.com/q/24548624
has body: The Basics When you start an AsyncTask first the onPreExecute() method runs on the UI thread. You can override this method to make changes to the UI prior to the doInBackground() method running. After the doInBackground() method finishes, the onPostExecute() method runs on the UI thread, so you can use this to make changes to the UI from here. If you need to make regular changes to the UI Thread during the doInBackground() method you override the onProgressUpdate() method which runs on the UI Thread, and then call it from within doInBackground(), which will allow you to periodically update the UI. You could use something like the following; private class DoStuffTask extends AsyncTask { @Override protected void doInBackground(Object... args) { // Do stuff onProgressUpdate(x); // Do more stuff } @Override protected void onProgressUpdate(Object... args) { // Update your UI here } } Now if this doesn't quite do it and you want the AsyncTask to wait for input during the doInBackground() method it is probably worth considering using multiple AsyncTasks instead. You can then finish each AsyncTask, ask for input, and then start a new AsyncTask to continue working. Given that AlertDialog instances are asynchronous, this is probably the preferred solution because you can start the next AsyncTask from the AlertDialog itself. Using wait() in an AsyncTask If you would prefer to use a single AsyncTask you can use wait from within your AsyncTask to prevent execution continuing until some condition is met. Instead of using a new Runnable we are just using two threads in this instance, the thread running doInBackground() and the main thread, and we are synchronizing on the AsycTask itself. Example below; public class TestTask extends AsyncTask{ private boolean notified; private Promptable p; public interface Promptable { public abstract void prompt(); } public TestTask(Promptable p){ this.p = p; } @Override protected Object doInBackground(Object... arg0) { Log.d("First", "First"); o…
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/38018547
has comment: http://stackoverflow.com/comment/75690456
has comment: http://stackoverflow.com/comment/75713057
has comment: http://stackoverflow.com/comment/38018926
has comment: http://stackoverflow.com/comment/38019634

http://stackoverflow.com/a/24521246
has comment: http://stackoverflow.com/comment/37967113
score: 1
has comment: http://stackoverflow.com/comment/37968177
downvote count: 0
has body: What you need is to detect whether value has been inputted on the text fields right? Then have you looked at TextWatcher? Here is an example on how to use it. editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //code } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { //code } @Override public void afterTextChanged(Editable s) { //code } }); Basically you apply the TextWatcher to the three fields and watch. If all three fields have the values you need, then do the calculation. Maybe you can add global variables to the activity and check these global variables on the onTextChanged() method of the text field, and if three of the variables are already complete, set the value of the fourth one.
answers question: http://stackoverflow.com/q/24520929
type: Answer
has comment: http://stackoverflow.com/comment/37967622
upvote count: 1
has comment: http://stackoverflow.com/comment/37967273

http://stackoverflow.com/q/24441154
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37818853
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/37818973
accepted answer: http://stackoverflow.com/a/24441324
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37819727
tagged with: java
has body: I'm new to android (not completely new to java). Trying to follow along on a sorta dated tutorial. I can't figure out why setOnClickListener is crashing this app. I know that there is a null pointer exception somewhere, but I'm not sure how to fix it. Also, sidenote, why does my Class extend ActionBarActivity instead of Activity like in all of the examples I've seen so far? public class StartingPoint extends ActionBarActivity { int counter; Button add, sub; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_starting_point); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } // end of if counter = 0; add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub); display = (TextView) findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter++; display.setText("Counter equals" + 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; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_starting_point, container, false); r…
tagged with: crash
answer count: 2
has comment: http://stackoverflow.com/comment/37818852
possible better answer: http://stackoverflow.com/a/24441346
has answer: http://stackoverflow.com/a/24441324
has title: Why is setOnClick crashing this app?
has answer: http://stackoverflow.com/a/24441346

http://stackoverflow.com/comment/37899190
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24484205
score: 3
has text: Actually, it gives `0.33999999999999986`

http://stackoverflow.com/q/24567633
type: Question
has comment: http://stackoverflow.com/comment/38054045
has comment: http://stackoverflow.com/comment/38059373
score: 1
tagged with: primary-key
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/38054086
has comment: http://stackoverflow.com/comment/38066322
downvote count: 0
tagged with: db2
favorite count: 0
tagged with: auto-increment
has body: Good day, I have a table in db2, where the primary is_autoincrement is set to Yes. Means that everytime insert data to this table, no need to pass in the primary key value, because it will auto generate. However, I need to get back the primary key value after insertion. The code is something as follow: public integer insertRecord() { //insertion sql code here KeyHolder keyHolder = new GeneratedKeyHolder(); PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory( getInsertBatch2( ), new int[] { java.sql.Types.TIMESTAMP, java.sql.Types.VARCHAR, java.sql.Types.SMALLINT, java.sql.Types.DATE, java.sql.Types.INTEGER } ); int updated = JdbcTemplate.update( factory.newPreparedStatementCreator( params ), keyHolder); log.trace("key value is " + keyHolder.getKey( ); //after insertion, return primary key return id; } private String getInsertBatch2() { StringBuilder sb = new StringBuilder( ); sb.append( "insert into " ) .append( getDefaultSchema( ) ) .append( ".batches( startdatetime, type, manual, processdate, originalbatchid) " ); sb.append( "values(?,?,?,?,?) " ); return sb.toString( ); } The insertion query is something as follow: insert into table1(startdatetime, type, manual, processdate, originalbatchid) value (-- all the value here -- ); When I try to print out the keyHolder, it is null. Kindly advise how to get the primary key.
linked to: http://stackoverflow.com/q/3087836
has comment: http://stackoverflow.com/comment/38075072
has title: Get back the primary key value after insertion to db2 table by KeyHolder
answer count: 0
has comment: http://stackoverflow.com/comment/38118938
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/38040713
type: Comment
has text: Thanks but this is not what I am asking. I am asking about the outputstream and the inputstreams. How are they connected?
comment on: http://stackoverflow.com/a/24560663
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38025966
type: QuestionComment
has text: "R.java is my biggest enemy - cus i cant modify or use it". You should not edit R.java. R is auto-generated. If you add an extra String to Strings.xml, it will be added to R.java the next time it is generated.
type: Comment
comment on: http://stackoverflow.com/q/24552925
score: 0

http://stackoverflow.com/a/24575988
has body: The easier way to pay with PayPal on Android would be using the native PayPal Android SDK.
type: Answer
answers question: http://stackoverflow.com/q/24482379
score: 0

http://stackoverflow.com/a/24512614
answers question: http://stackoverflow.com/q/24512068
type: Answer
score: 1
upvote count: 1
has body: I suspect your middleName is empty string or has spaces. if so try using logic:equal to match and print some character instead of period, see what happens. If true, then trim the middleName, before sending it of to JSP.
downvote count: 0

instantiation
type: Tag
tag name: instantiation
tags question: http://stackoverflow.com/q/24482153
tags question: http://stackoverflow.com/q/24544255

http://stackoverflow.com/comment/37839915
has text: Thanks to all. Appreciate the quick, clear answers.
comment on: http://stackoverflow.com/a/24452490
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24541484
tagged with: java
type: Question
has title: error: The type oauth.signpost.AbstractOAuthConsumer cannot be resolved. It is indirectly referenced from required .class files
score: 0
answer count: 1
tagged with: buildpath
tagged with: oauth
type: UnansweredQuestion
tagged with: android
has body: I am attempting to import some previously built code into my workspace, however I am being given this error and cannot find a working solution: The type oauth.signpost.AbstractOAuthConsumer cannot be resolved. It is indirectly referenced from required .class files I have added all jars to the build path and rebuilt the code but none of these seem to work, has anyone encountered this issue before that can offer some suggestions? any help would go a long way thanks
has answer: http://stackoverflow.com/a/24593926

http://stackoverflow.com/q/24443639
tagged with: classnotfoundexception
tagged with: jpos
tagged with: iso8583
downvote count: 0
tagged with: spring
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has title: java.lang.ClassNotFoundException: org.jpos.iso.ISOException
has answer: http://stackoverflow.com/a/24447419
accepted answer: http://stackoverflow.com/a/24447419
answer count: 2
possible better answer: http://stackoverflow.com/a/24967733
has body: I'm beginner for using JPOS with ISO8583. At this time, I try my application using Spring to build the request using JPOS where I want to send it to BASE24. Here my code for build : public class BuildISO { public void sentISOMsg(String hostname, int portNumber) { // Create Packager based on XML that contain DE type GenericPackager packager; ASCIIChannel channel; try { packager = new GenericPackager("packager/iso93ascii.xml"); channel = new ASCIIChannel(hostname, portNumber, packager); ISOMUX isoMux = new ISOMUX(channel) { @Override protected String getKey(ISOMsg m) throws ISOException { return super.getKey(m); } }; new Thread(isoMux).start(); // Create ISO Message ISOMsg isoRequest = new ISOMsg(); isoRequest.setMTI("1800"); isoRequest.set(3, "123456"); isoRequest.set(7, new SimpleDateFormat("yyyyMMdd").format(new Date())); isoRequest.set(11, "000001"); isoRequest.set(12, new SimpleDateFormat("HHmmss").format(new Date())); isoRequest.set(13, new SimpleDateFormat("MMdd").format(new Date())); isoRequest.set(48, "Tutorial ISO 8583 Dengan Java"); isoRequest.set(70, "001"); ISORequest req = new ISORequest(isoRequest); isoMux.queue(req); ISOMsg isoReply = req.getResponse(50*1000); if (isoReply != null) { System.out.println("Req ["+new String(isoRequest.pack()) + "]"); System.out.println("Res ["+new String(isoReply.pack()) + "]"); } // print the DE list logISOMsg(isoRequest); // Get and print the output result byte[] data = isoRequest.pack(); System.out.println("RESULT : " + new String(data)); } catch (ISOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static void logISOMsg(ISOMsg msg) { System.out.println("----ISO MESSAGE-----"); try { System.out.println(" MTI : " + msg.getMTI()); for (int i=1;i&lt;=msg.getMaxField();i++) { if (msg.hasField(i)) { System.out.println(" Field-"+i+" : "+msg.getString(i)); } } } catch (ISOException e) { e.printStackTrace(); } finally { System.out.println("--------------------"); } } } and next, while I want to…
has answer: http://stackoverflow.com/a/24967733
favorite count: 0
upvote count: 3

http://stackoverflow.com/comment/37981469
type: Comment
has text: Are you using all that 20 threads?. I believe he wont create more than 20 if there are not used all 20
comment on: http://stackoverflow.com/q/24528421
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37989089
type: AnswerComment
has text: Could you look at the comment I posted above about Vink's answer?
score: 0
comment on: http://stackoverflow.com/a/24532783
type: Comment

http://stackoverflow.com/comment/37940671
type: QuestionComment
has text: It might not be clear to some readers, so I'll augment above quote of @ScaryWombat by adding that synchronized methods also must have an object to synchronize on (`this` or the class object), it's just implicitly specified by method type (instance or static method).
comment on: http://stackoverflow.com/q/24504642
score: 0
type: Comment

http://stackoverflow.com/a/24449011
type: AcceptedAnswer
type: Answer
has body: You're running 'java' from the JRE not the JDK. The JRE doesn't contain the 'jarsigner' tool.
accepted answer of: http://stackoverflow.com/q/24428314
answers question: http://stackoverflow.com/q/24428314
score: 0

http://stackoverflow.com/comment/44950672
type: Comment
has text: Is that a dash or an underscore? And how about handling the two keys "snake_case" and "snake_blah" by putting both "case" and "blah" in the same nested object?
comment on: http://stackoverflow.com/a/24466004
score: 0
type: AnswerComment

http://stackoverflow.com/q/24446262
tagged with: class-hierarchy
type: Question
has title: Hibernate Model: set default @ManyToOne value of a Child Class
tagged with: java
tagged with: hibernate
tagged with: default-value
has comment: http://stackoverflow.com/comment/37828178
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37828610
has body: I have class User which has @ManyToOne field Role. @Entity @Table(name="USERS") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorValue("ROLE_ADMIN") @DiscriminatorColumn (name="ROLENAME", discriminatorType= DiscriminatorType.STRING, length=20) public class User extends BaseEntity implements UserDetails { // all others fields like username, password,... @ManyToOne @JoinColumn(name = "role_id", referencedColumnName="id") @NotNull(message = "ROLE field is mandatory") private Role role; //getter and setter } I have many classes that extends User: UserSeller, UserClient, UserOffice.... @Entity @DiscriminatorValue("ROLE_SELLER") @AttributeOverride(name = "role", column = @Column(name = "role_id")) public class UserSeller extends User { //additional fields like CompanyId,... //getter &amp; setter } I have one panel where i can insert / edit / delete all kind of users, but i must have also "n" panel: one for each kind of user. When i'm in these panel, i would like to be able to insert these UserSeller without having to put a where to choose role, but i want set this role as default. &bull; I tried to put a costructor in the UserSeller @Entity @DiscriminatorValue("ROLE_SELLER") @AttributeOverride(name = "role", column = @Column(name = "role_id")) public class UserSeller extends User { @Transient RoleService roleService; @Transient User user = new User(); public UserSeller() { super(); try { this.setRole(roleService.getRole("ROLE_SELLER")); } catch (RecordNotFoundException e) { } } but i get this error: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister &bull; i tried to pass a User object to constructor: public UserSeller(User user) and in controller i do this: User user = new User(); UserSeller seller = new UserSeller(user); model.addAttribute("seller", seller); but i get this error: No default constructor for entity: com.machinet.model.UserVenditore If, in UserSeller i declare again the Role field i get error about "R…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24446814

http://stackoverflow.com/a/24472409
type: Answer
answers question: http://stackoverflow.com/q/24472224
score: 1
has body: You code is ok, but I don't trust in your query result. Try setting a negative value on maxIdNum to see if your are getting results from your query. int maxIdNum = -1; Another test you can do is replacing rsx.getInt("ID"); by rs.getString("ID"); to know if the result is a string it will fail in case of int so will help you to isolate the problem. Another you can do is to set a query with a hardcoded result to know if there is another problem: select 1 as ID from dual
accepted answer of: http://stackoverflow.com/q/24472224
has comment: http://stackoverflow.com/comment/37876874
has comment: http://stackoverflow.com/comment/37876657
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37876624
upvote count: 1
has comment: http://stackoverflow.com/comment/37876854
downvote count: 0
has comment: http://stackoverflow.com/comment/37876865
has comment: http://stackoverflow.com/comment/37876679

http://stackoverflow.com/comment/38054827
type: Comment
comment on: http://stackoverflow.com/a/24562867
has text: You should return your own UsernamePasswordAuthenticationToken from CustomAuthenticationProvider, then your token is retrieved for UsernamePasswordAuthenticationFilter and setting in the SecurityContext.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37976603
type: Comment
type: QuestionComment
has text: I copied using drag n drop of virtual box. Will try other methods. Thanks
score: 0
comment on: http://stackoverflow.com/q/24526438

http://stackoverflow.com/comment/38066817
comment on: http://stackoverflow.com/a/24566672
has text: Yeah, I understand that. I wouldn't mind going even with just `"logs/app-%i.log"` pattern, I just thought maybe there is a way I could squeeze in a timestamp for personal viewing convenience.
type: Comment
score: 6
type: AnswerComment

http://stackoverflow.com/a/24656525
type: Answer
has comment: http://stackoverflow.com/comment/38306041
score: 0
answers question: http://stackoverflow.com/q/24584302
has body: If you use CTRL+H to bring up the Java Search dialog you have the option of selecting the scope: either "Workspace" which covers all projects in your workspace , or "enclosing project" which is just the current project. You want to make sure "Workspace" is selected which is probably what you want. The results are then listed in the Search View

http://stackoverflow.com/comment/37907775
comment on: http://stackoverflow.com/q/24488922
type: QuestionComment
has text: http://lalit3686.blogspot.in/2012/06/today-i-am-going-to-show-how-to-deal.html . Make use of that example. You can pass data using intent to the next activity.
score: 0
type: Comment

http://stackoverflow.com/q/24550243
favorite count: 0
has comment: http://stackoverflow.com/comment/38022106
has comment: http://stackoverflow.com/comment/38021576
has comment: http://stackoverflow.com/comment/38026596
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: formatter
tagged with: java
has title: Conditional formatted output
score: -1
type: Question
has body: I only have access to a function like this (mean I cannot change the input or signature for this function): public void log( String fmt , final Object... args ) { fmt = fmt.replace( "%f" , "%1.3e" ); System.out.print( String.format( Locale.US , fmt , args ); } I'd like to change the fmt to contain either %5.2f or %1.3e (only examples) dependent on the actual decimal value it represents (to kind of achieve the same number of digits for every decimal value). Lets say 6 digits + 1 dot: 1234.56789 becomes 1234.56 123.456789 becomes 123.456 12.3456789 becomes 12.3456 ... 0.00123456789 becomes 1.234e-3 0.000123456789 becomes 1.234e-4 ... How would someone do that?
has answer: http://stackoverflow.com/a/24551252
answer count: 1

http://stackoverflow.com/q/24516024
has body: I'm trying to understand the usage of virtual memory for my java application, which seems to depend on the environment i'm running my jar. I have two environments: env 1 cat /proc/version Linux version 3.5.0-48-generic (buildd@roseapple) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #72~precise1-Ubuntu SMP Tue Mar 11 20:08:23 UTC 2014 java -version java version "1.7.0_51" OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2) OpenJDK Server VM (build 24.45-b08, mixed mode) env 2 cat /proc/version Linux version 3.2.0-49-generic (buildd@komainu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #75-Ubuntu SMP Tue Jun 18 17:39:32 UTC 2013 java -version java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) command: java -Xms128m -Xmx256m -cp myjar.jar com.test.Main I run the exact same jar, same command in both environments and the virtual memory usage differs greatly. On env 1 it all works as I think it should, reserving up to 600Mb in virtual memory (Heap xmx256m + permGen + other little things). However on env 2 virtual memory goes up to 2600Mb. physical memory usage on both environments seems fine and equal to configured sizes. I think virtual memory should be as in env 1, but I can't find a explanation for env 2 to use that much. Anyone have experienced this? What should I look for in the evironment or in the java configuration?
linked to: http://stackoverflow.com/q/561245
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/66060475
tagged with: memory
tagged with: virtual-memory
type: Question
has answer: http://stackoverflow.com/a/24520459
answer count: 1
has title: Java exceptionally big virtual memory for actual memory usage in some environments
tagged with: jvm
upvote count: 3
has comment: http://stackoverflow.com/comment/37957068
favorite count: 0
tagged with: memory-management
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37860387
comment on: http://stackoverflow.com/q/24463523
score: 1
has text: why down votes?... people who thinks that they never were noobs
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24473835
tagged with: regex
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24473867
type: Question
has body: I am checking for precedence in a string in my function. Is there a way to change my code to incorporate regex -- I am quite unfamiliar with regex, and though I have read some tutorials online, still not getting 'it' too well. So any guidance would really be appreciated. For example in a string XLYZ, if the char after X is not L or C, the 'violation' statement gets printed. Here's the code below: if (subtnString[cnt]=='X' &amp;&amp; cnt+1&lt;subtnString.length){ if(subtnString[cnt+1]!= 'L' || subtnString[cnt+1]!= 'C'){ System.out.println("Violation: X can be subtracted from L and C only"); return false; } } Is there a way I can use regex to replace this code?
answer count: 2
downvote count: 0
has title: Using regex in Java
possible better answer: http://stackoverflow.com/a/24473900
favorite count: 0
has answer: http://stackoverflow.com/a/24473900
has answer: http://stackoverflow.com/a/24473867

http://stackoverflow.com/comment/38005979
comment on: http://stackoverflow.com/q/24541672
has text: This question almost certainly is too broad for StackOverflow. You are asking about the design of an algorithm. StackOverflow is supposed to be for specific programming problems: E.g., "I tried this ...example code... and it did X when I expected it to do Y. What gives?"
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/38067386
has text: Oh wow, I'm generally an idiot... somehow I added the same color to the list twice.
comment on: http://stackoverflow.com/q/24574804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24518328
has answer: http://stackoverflow.com/a/24518633
has answer: http://stackoverflow.com/a/24518359
has comment: http://stackoverflow.com/comment/37961555
tagged with: constructor
type: UnansweredQuestion
has title: Constructor overloading same arguments
type: Question
tagged with: overloading
tagged with: java
has answer: http://stackoverflow.com/a/24518384
answer count: 3
score: 0
has body: Suppose I have class with 2 fields: x and y, of type double. Is it possible to define 2 constructors so constructor1 will create object setting its x property to what parameter in constructor tell and y to default and constructor2 vice versa? public class Test { private int x; private int y; public Test(int x) { this.x = x; } public Test(int y) { this.y = y; } } I'm trying something like that and I know that it wont work because of overloading rules

http://stackoverflow.com/a/24485737
type: Answer
answers question: http://stackoverflow.com/q/24485690
has comment: http://stackoverflow.com/comment/37902206
score: 0
has body: Yes, I'm definitely blind, numbers are in scientific notation.

http://stackoverflow.com/a/24487527
downvote count: 0
score: 5
type: AcceptedAnswer
has body: Looking at your code, and the error message, AD is saying that the DN CN=batman,OU=SoftwareV3,OU=SOFTWARE,DC=SOFTWAREDEV,DC=LOCAL does not exist. This message pertains to the entire DN tree. This means that either of these objects does not exist: DC=LOCAL DC=SOFTWAREDEV,DC=LOCAL OU=SOFTWARE,DC=SOFTWAREDEV,DC=LOCAL OU=SoftwareV3,OU=SOFTWARE,DC=SOFTWAREDEV,DC=LOCAL CN=batman,OU=SoftwareV3,OU=SOFTWARE,DC=SOFTWAREDEV,DC=LOCAL You should check the entire DN for correctness, using an LDAP browser, as the error message does not specify which object does not exist.
has comment: http://stackoverflow.com/comment/37905998
type: Answer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24485722
answers question: http://stackoverflow.com/q/24485722

http://stackoverflow.com/comment/37901537
has text: Please note Skype4COM is deprecated for all usecases except call recording and Hardware device control. While this code may work currently we make no commitment to its longevity
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24483653
type: AnswerComment

http://stackoverflow.com/comment/37806317
has text: Can you explain what you mean by *"restart the simulation"*? If you end the Java program and start it again (using `java` command or IDE's *Run* command) no variable will remember their state from the last run, for obvious reasons. You will need a mechanism to save the states persistently (into a file, registry or database) and reload them from the save on restart.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24433951

http://stackoverflow.com/a/24545952
has comment: http://stackoverflow.com/comment/38022426
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24540373
answers question: http://stackoverflow.com/q/24540373
has body: Using a stencil buffer for what you're describing sounds like a good approach. You need to make sure that you request a framebuffer configuration with a stencil buffer. When using GLSurfaceView on Android, this is done with one of the overloaded setEGLConfigChooser() methods. The simplest form is the one that takes a bit depth for Red, Green, Blue, Alpha, Depth, and Stencil. If you also need a depth buffer, you can try combinations like these to get a config with stencil: setEGLConfigChooser(8, 8, 8, 8, 24, 8); setEGLConfigChooser(8, 8, 8, 8, 16, 8); setEGLConfigChooser(8, 8, 8, 0, 24, 8); setEGLConfigChooser(8, 8, 8, 0, 16, 8); setEGLConfigChooser(5, 6, 5, 0, 24, 8); setEGLConfigChooser(5, 6, 5, 0, 16, 8); To be even more thorough, you can also use the setEGLConfigChooser() override that lets you register your own EGLConfigChooser implementation. Using that, you can enumerate configuration, and implement your own logic to choose the one that best meets your need. To verify that you indeed got a stencil buffer, you can use: GLint stencilBits = 0; glGetIntegerv(GL_STENCIL_BITS, &amp;stencilBits); I thought that stencil support was standard, but the way I read the ES 2.0 spec, it's not required: Further, an implementation or context may not provide depth or stencil buffers. However, an OpenGL ES implementation must support at least one conﬁg with a depth bit depth. I believe at least relatively recent GPUs support stencil. If you have to get this working on a GPU that indeed does not provide stencil after you tried all of the above, things get more difficult. For the example you sketched, where you clip by a rectangle, that could of course simply be done by using a scissor rectangle. But I'm sure that you only used that for illustration. Depending how much you use the depth buffer for your actual rendering, you could play some tricks with the depth buffer instead. For example, it could look like this: glClearDepthf(0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_…
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/24491093
linked to: http://stackoverflow.com/q/4540684
has title: Java round a decimal up to the next highest int
type: Question
answer count: 2
score: -2
has answer: http://stackoverflow.com/a/24491124
has comment: http://stackoverflow.com/comment/37912034
has body: In Java, how can I round a decimal to the next highest int? So that 3.1 would become 4, 4.6 becomes 5, 4.5 becomes 5, 1.004 becomes 2, etc... This probably a silly question but I can't figure it out... Sorry for this being a duplicate. I spent about an hour on google and 15 min on here trying be find it but I only got the normal rounding (1.5 -> 2, 1.2 -> 1) so I figured I may as well ask.
favorite count: 0
duplicate of: http://stackoverflow.com/q/4540684
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24491199
upvote count: 1
tagged with: rounding
tagged with: java
downvote count: 3

http://stackoverflow.com/q/24516354
has answer: http://stackoverflow.com/a/24516670
has answer: http://stackoverflow.com/a/24516619
type: Question
has body: I have a series of buttons that I would like the user to press in order to show a different list in the list view. Say, button one brings up list one. User adds a few items to list one and then presses button two to open list two; user then adds a few items to that list. How would I go about having multiple list that share a single list view? Also, how would I have the data of one list be saved so when the user switches lists... they can switch back to the original and have their items still presented in the list? Thank you!
tagged with: android-listfragment
tagged with: android-arrayadapter
score: 0
answer count: 2
tagged with: android-listview
has title: Multiple lists in one ListView
type: UnansweredQuestion
tagged with: list
tagged with: java

http://stackoverflow.com/a/24559433
has comment: http://stackoverflow.com/comment/38038349
has comment: http://stackoverflow.com/comment/38039244
type: Answer
has comment: http://stackoverflow.com/comment/38038335
score: 7
has comment: http://stackoverflow.com/comment/38038882
upvote count: 7
has comment: http://stackoverflow.com/comment/38039475
has body: Continue is a keyword in the Java language, so you cannot use it as a identifier for your variable. Declare the variable you have as static boolean continue = false; You cannot use the variable names as one of the keywords of the language. Otherwise you'll get this error while compiling the code. If you still want the continue, use it as Upper Case. Or change it to something else. But not the continue as it is.
downvote count: 0
has comment: http://stackoverflow.com/comment/38040121
has comment: http://stackoverflow.com/comment/38038385
answers question: http://stackoverflow.com/q/24559415

google-app-engine
tags question: http://stackoverflow.com/q/24499294
tag name: google-app-engine
tags question: http://stackoverflow.com/q/24455170
type: Tag
tags question: http://stackoverflow.com/q/24564028
tags question: http://stackoverflow.com/q/24547797
tags question: http://stackoverflow.com/q/24466759
tags question: http://stackoverflow.com/q/24482085
tags question: http://stackoverflow.com/q/24519587
tags question: http://stackoverflow.com/q/24473881
tags question: http://stackoverflow.com/q/24465746
tags question: http://stackoverflow.com/q/24501520
tags question: http://stackoverflow.com/q/24444573
tags question: http://stackoverflow.com/q/24565362
tags question: http://stackoverflow.com/q/24478626
tags question: http://stackoverflow.com/q/24460197
tags question: http://stackoverflow.com/q/24578025
tags question: http://stackoverflow.com/q/24498646
tags question: http://stackoverflow.com/q/24565411
tags question: http://stackoverflow.com/q/24582814
tags question: http://stackoverflow.com/q/24510490
tags question: http://stackoverflow.com/q/24495353
tags question: http://stackoverflow.com/q/24499347
tags question: http://stackoverflow.com/q/24484019
tags question: http://stackoverflow.com/q/24478454
tags question: http://stackoverflow.com/q/24573527
tags question: http://stackoverflow.com/q/24440342
tags question: http://stackoverflow.com/q/24583482
tags question: http://stackoverflow.com/q/24471890
tags question: http://stackoverflow.com/q/24544304
tags question: http://stackoverflow.com/q/24453755
tags question: http://stackoverflow.com/q/24498609
tags question: http://stackoverflow.com/q/24499678

http://stackoverflow.com/a/24484032
accepted answer of: http://stackoverflow.com/q/24483918
score: 1
has body: This is due to how float numbers are represented in the computer memory. Here's an online demo of how float numbers are stored in memory (binary representation) http://www.h-schmidt.net/FloatConverter/IEEE754.html According to the IEEE 754 standard, a single precision number is stored in a 32bit word composed of one sign bit, 8 exponents bits, and 23 mantissa bits. If you follow the steps of how to represent the number 48.12345678 you will find that there's underflow and some bits are truncated because it exceeds the 23 mantissa bits Example, in the above link, try to plug: 48.12345678 in the Decimal Representation, then press enter. You will see that the number will be converted to 48.123455 and above it you will find the single precision representation of the number in binary
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24483918
upvote count: 1

http://stackoverflow.com/comment/37981953
score: 0
has text: @AleksandrM you are no longer first with people using the [AleksandrM] tag in their questions... I won.
type: Comment
comment on: http://stackoverflow.com/q/24525825
type: QuestionComment

http://stackoverflow.com/q/24469829
has comment: http://stackoverflow.com/comment/37872419
accepted answer: http://stackoverflow.com/a/24470456
favorite count: 0
has body: Is gives the error ship1 not found. I only declare ship1 only if condiontion is met. Other wise i have placed else condition which re runs the function. It is compilation problem, so as i was told earlier ... try catch will not work. public static int plantNavy(BattleBoard myBattle, int counter) { System.out.println("Im innnnn"); if (counter == 0) { System.out.println("\nPlacing Large Ship"); } else if (counter == 1) { System.out.println("Placing Medium Ship"); } else if (counter == 2) { System.out.println("Placing Medium Ship"); } else if (counter == 3) { System.out.println("Placing Small Ship"); } else if (counter == 4) { System.out.println("Placing Small Ship"); } System.out.println("Enter 0 to place ship horizontally"); System.out.println("Enter 1 to place ship vertically"); String align = shipAlignment.nextLine(); if (align.length() &gt; 1) { System.out.println("Inappropriate value entered. Please enter again"); plantNavy(myBattle,counter); } if (align.charAt(0) - 48 == 0 || align.charAt(0) - 48 == 1) { if (align.charAt(0) - 48 == 0) { if (counter == 0) { BattleShip ship1 = new LargeShip(false); } else if (counter == 1) { BattleShip ship1 = new MediumShip(false); } else if (counter == 2) { BattleShip ship1 = new MediumShip(false); } else if (counter == 3) { BattleShip ship1 = new SmallShip(false); } else if (counter == 4) { BattleShip ship1 = new SmallShip(false); } } if (align.charAt(0) - 48 == 1) { if (counter == 0) { BattleShip ship1 = new LargeShip(true); } else if (counter == 1) { BattleShip ship1 = new MediumShip(true); } else if (counter == 2) { BattleShip ship1 = new MediumShip(true); } else if (counter == 3) { BattleShip ship1 = new SmallShip(true); } else if (counter == 4) { BattleShip ship1 = new SmallShip(true); } } } else { System.out.println("Inappropriate value entered"); counter=plantNavy(myBattle,counter); } System.out.println("Enter Ship Placing position"); String shipPos = shipPlace.next(); if (shipPos.length() &gt; 3 || shipPos.length() &lt;…
tagged with: exception
has comment: http://stackoverflow.com/comment/37872263
score: -8
has comment: http://stackoverflow.com/comment/37872412
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37871681
has comment: http://stackoverflow.com/comment/37871698
type: Question
has answer: http://stackoverflow.com/a/24470456
has comment: http://stackoverflow.com/comment/37872014
has title: How to handle symbol not found compile error in java?
has comment: http://stackoverflow.com/comment/37872533
downvote count: 9
has comment: http://stackoverflow.com/comment/37871794
has comment: http://stackoverflow.com/comment/37871695
has comment: http://stackoverflow.com/comment/37872539
has comment: http://stackoverflow.com/comment/37872577
has comment: http://stackoverflow.com/comment/37872051
answer count: 1

http://stackoverflow.com/comment/37934675
has text: Java interprets the Split string as RegEx which considers the . character as matching ANY single character. To match only a literal . you have to escape it hence \. But in Java strings \ is an escape character so you have to escape it hence \\.
comment on: http://stackoverflow.com/a/24503037
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37937893
has text: What do you mean by "doesn't recognize"? What's the error?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24499042

http://stackoverflow.com/comment/37815961
type: Comment
comment on: http://stackoverflow.com/a/24439268
has text: So this code is better than what I was using for writing, but the problem is that now after I write the email, as soon as I try to read in the next line (which should be "[?] password:"), it hangs. When I try using debug mode to look at what chars are in the BufferedReader's buffer, it just shows the chars it has read and then a bunch of empty slots in the buffer. Once it tries to read two of those empty slots, it hangs without any exceptions thrown. The buffer also shows no sign of "[?] password:".
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37990986
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24534046
has text: I'll update the answer to explain the regular expression and link to a massive index of user agent strings.

http://stackoverflow.com/q/24554557
favorite count: 0
tagged with: spring-data-jpa
has body: I'm using Spring PagingAndSortingRepository and I have a very easy findAll query: inventoryDao.findAll(new Sort(Sort.Direction.DESC,"startTime")) It's working fine, I just was wondering: is it possible to replace the query above using Method Name generation instead? (Somethnig like: inventoryDao.findAllOrderByStartTime() )
has comment: http://stackoverflow.com/comment/38031065
upvote count: 3
type: UnansweredQuestion
tagged with: spring
type: Question
score: 3
has answer: http://stackoverflow.com/a/28773971
tagged with: java
has comment: http://stackoverflow.com/comment/38032705
downvote count: 0
answer count: 1
has title: Spring Data JPA - Order By : Sorting with Method Name vs Sort Class
tagged with: sorting

http://stackoverflow.com/q/24575618
downvote count: 1
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/38068439
favorite count: 0
has answer: http://stackoverflow.com/a/24575694
tagged with: abstract-class
has title: Can you re-make a method abstract in the inheritance tree?
tagged with: abstract
answer count: 4
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/24575897
has comment: http://stackoverflow.com/comment/38068291
has answer: http://stackoverflow.com/a/24575897
type: Question
has answer: http://stackoverflow.com/a/52842477
tagged with: java
has body: EDIT: To be clear: The fact that the design is quite ugly is not the point. The point is, that the design is there and I am in the situation to have to add another sub-class of FlyingMotorizedVehicle which would not work as expected if I forgot to add the foo(...). So I just was wondering if I could redefine it as abstract. I am right now facing a quite weird inheritance situation. Lets say, I have three classes, Vehicle, MotorizedVehicle and FlyingMotorizedVehicle as well as a bunch of classes Airplane, Helicopter, ...: public abstract class Vehicle { abstract Something doStuff(...); abstract SomethingElse doOtherStuff(...); abstract Foo bar(...); } public class MotorizedVehicle extends Vehicle { @Override Something doStuff(...) { return new Something(); } @Override SomethingElse doOtherStuff(...) { return new SomethingElse(); } @Override Foo bar(...) { return new Foo(); } } public class FlyingMotorizedVehicle extends MotorizedVehicle { @Override SomethingElse doOtherStuff(...) { return new SomethingElse(); } } public class Airplane extends FlyingMotorizedVehicle { @Override Foo bar(...) { //do something different return new Foo(); } } public class Helicopter extends FlyingMotorizedVehicle { @Override Foo bar(...) { //do something totally different return new Foo(); } } [...] So Vehicle is an abstract class providing some abstract methods. MotorizedVehicle is a sub-class of Vehicle with concrete implementations of its methods. FlyingMotorizedVehicle again is a sub-class of MotorizedVehicle overriding the implementations of a subset of MotorizedVehicles methods. Now there are the sub-classes Helicopter, Airplane and potentially some others which in the example override the concrete implemenatation of MotorizedVehicle#bar(...). What I want is to "force" every sub-class of MotorizedVehicle to have to override the bar(...) method and provide its own implementation. Is it possible to just change the FlyingMotorizedVehicle in the following way: public class FlyingMotoriz…
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/24575694
upvote count: 2
has answer: http://stackoverflow.com/a/24575839

http://stackoverflow.com/comment/37960113
comment on: http://stackoverflow.com/q/24517487
has text: Are you looking for a tutorial on how to write a text file? Have you searched? I'm sure there are many available.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24570418
type: Answer
has comment: http://stackoverflow.com/comment/38065782
upvote count: 1
score: 1
has body: The only reason to spawn an additional thread each time you accept a connection is so that the server can accept more than one connection at a time. If you only want to be able to accept one connection, then just process that connection on the same thread as you accept it: public class Server implements Runnable { @Override public void run() { try { ServerSocket server = new ServerSocket(2323); try { while (true) processConnection(server.accept()); } finally { server.close(); } } catch (IOException e) { e.printStackTrace(); } } private void processConnection(Socket socket) throws IOException { System.out.println("got connection"); ObjectInputStream in = new ObjectInputStream(socket.getInputStream()); try { while (interpret((Packet) in.readObject()) != 0); } catch (ClassNotFoundException e) { e.printStackTrace(); } } ... } You don't need threads, synchronisation, or anything like that.
answers question: http://stackoverflow.com/q/24569752
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24569752

http://stackoverflow.com/a/24477448
downvote count: 0
has body: This problem could be caused by : Permission limit Check that you execute your program with valid permission (try to test with execute as administrator if you are in Windows , or root if you are in Unix) Relative path problem it's possible that you didn't set the valid path to your file, try to test with an absolute path to insure that you can read from it.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24477376
answers question: http://stackoverflow.com/q/24477376
type: AcceptedAnswer

http://stackoverflow.com/comment/37827950
comment on: http://stackoverflow.com/q/24446194
score: 0
type: Comment
type: QuestionComment
has text: @Gyro Gearless: As an ant task

http://stackoverflow.com/comment/41570121
has text: This answer is not correct as it is NOT applicable to inserting CSV data into mysql. OP, did it really solve your question? I believe the correct way is to use `LOAD DATA INFILE` syntax.
comment on: http://stackoverflow.com/a/24427782
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24566510
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/24616577
type: Question
has comment: http://stackoverflow.com/comment/38053138
tagged with: ssl-certificate
has comment: http://stackoverflow.com/comment/38141576
has body: Java 7, Spring Security, running on Linux. I'm developing a Java application that needs to authenticate users with LDAP over SSL. Instead of installing the certificate in the standard location, I'm contacting the LDAP server when the application starts, downloading a fresh certificate (using InstallCert.java), and saving it to a local file. I have the properties -Djavax.net.ssl.keyStore=path/to/store and -Djavax.net.ssl.keyStorePassword=password correctly defined and pointing to where I save the certificate - the certificate is valid; I checked it with keytool. Everything works fine for a period of time - I can authenticate users with no problem. However, after some time (around 30 to 60 seconds or so) the attempts to authenticate start to fail with: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I have a loop certificating the same user over and over, so I can reproduce the problem every time. If I restart my application and download a new certificate, everything works fine again, but after some time, I start to get the same exception. I'm pretty sure I have a valid certificate: I remove the previous one before starting the application, a new one shows up, and keytool tells me it's valid; the program works for some time, so my code must be correct. I spent the entire day on Google trying to find some clue as to why this is happening, with no luck. Has anyone experienced anything similar? Application log with -Djavax.net.debug=ssl,handshake on: keyStore is : keyStore type is : jks keyStore provider is : init keystore init keymanager of type SunX509 trustStore is: ../resources/secKS trustStore type is : jks trustStore provider is : init truststore adding as trusted cert: Subject: <omitted> Issuer: <omitted> Algorithm: RSA; Serial number: 0x127b251800020002f2b7 Valid from Sat Mar 01 07:16:28 CST 2014 until Sun Mar 01…
tagged with: ldap
has comment: http://stackoverflow.com/comment/38090878
has title: LDAP certificate randomly expiring
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/38080231
tagged with: spring-ldap
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/24532672
tagged with: java
answer count: 1
downvote count: 1
has body: I need to send a header If-Modified-Since to this address and only download if the server returns 200 not 304. Is there a way I can add/modify the header in this code? new java.net.URL(API.JSON_ZIP_OF_ALL_FILES).openStream()
has answer: http://stackoverflow.com/a/24532876
has title: Android how to add a header to this: new java.net.URL("http://example.com/").openStream()
type: AnsweredQuestion
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/480153
type: Question
accepted answer: http://stackoverflow.com/a/24532876
tagged with: android
duplicate of: http://stackoverflow.com/q/480153
upvote count: 2

http://stackoverflow.com/comment/73353714
type: Comment
score: 2
has text: so this timeout cannot save us from an attack like slow lorries , right ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24554490

http://stackoverflow.com/comment/37900302
score: 0
type: Comment
type: QuestionComment
has text: The error message says "C:\home\ecnet\ffjar.jar does not exist". Your _jar_ target builds the destination file "D:/build/jar/ffjar.jar". Seems to be a bit different ...
comment on: http://stackoverflow.com/q/24484761

http://stackoverflow.com/comment/37922655
has text: 1282 = `GL_INVALID_OPERATION`, which can be caused by a ton of things. If your driver supports KHR_debug, you can register a callback to get a hopefully more descriptive error message.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24496443

http://stackoverflow.com/a/24581125
has comment: http://stackoverflow.com/comment/38078955
type: Answer
has comment: http://stackoverflow.com/comment/38078899
downvote count: 1
answers question: http://stackoverflow.com/q/24580952
has comment: http://stackoverflow.com/comment/38078981
upvote count: 0
score: -1
has body: The Car is added to the Cars when through the Update method. If, in the paint, the array is empty it is because no Car has been added to Cars. So, just make sure the Update method is being called otherwise the array will always be empty - unless you modify the array directly and not via Update.

http://stackoverflow.com/q/24476477
has answer: http://stackoverflow.com/a/24476504
has title: How to make an Android program identify 'if' function?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24476517
score: 0
tagged with: java
type: Question
answer count: 2
has body: I am a beginner trying to make an counting app. I used videos from thenewboston's channel to produce this. package com.example.tasbih2; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity { int counter; Button tap, reset; TextView display, words; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); counter = 0; tap = (Button) findViewById(R.id.button1); reset = (Button) findViewById(R.id.resetbutton); words = (TextView) findViewById(R.id.words); display = (TextView) findViewById(R.id.counter); if (counter &gt; 10){ words.setText("C"); } else if (counter &gt; 7){ words.setText("B"); } else{ words.setText("A"); } //This is the command to add a count tap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter++; display.setText(" " + counter); } }); reset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub counter = 0; display.setText(" " + counter); } }); } I tried running the program lots of times. I wanted the app so that when the counter reaches a specific number, the writing on top of the number changes. Somehow, it when the counter reaches the number 8, the writing on top does not change. I tried using the 'while' function. However, that just crashed my app. Can someone suggest to me how should I make my program so that the 'if' function gets regularly checked if the counter reaches a certain number?
tagged with: android
has answer: http://stackoverflow.com/a/24476517
possible better answer: http://stackoverflow.com/a/24476504

http://stackoverflow.com/q/24445075
has answer: http://stackoverflow.com/a/24445774
answer count: 3
has comment: http://stackoverflow.com/comment/37825860
has title: Storing multiple values with same key in HashMap
has comment: http://stackoverflow.com/comment/37825904
tagged with: hashmap
tagged with: java
has body: I had an interview today and my interviewer asked me that how can I store multiple values having the same key in HashMap? She gave me this example-->If I am given a list of String and I am suppose to store the length of String as key and the String itself as value. I gave her the following solution in how I will be using HashMap: Map&lt;Integer, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;Integer, ArrayList&lt;String&gt;&gt;(); Integer being the length of the String and the ArrayList will store the Strings of that particular length. The interviewer said that this is one way of using the HashMap but there is another way in which I won't be requiring ArrayList or any other data structure. During interview, I couldn't come up with any solution and now after enough googling, I still have nothing. Can anyone tell me how can I achieve the solution to this question? Thanks!
accepted answer: http://stackoverflow.com/a/24445171
has comment: http://stackoverflow.com/comment/37825915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37825890
downvote count: 0
has comment: http://stackoverflow.com/comment/37825912
score: 6
favorite count: 0
has answer: http://stackoverflow.com/a/24445148
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/24445171
possible better answer: http://stackoverflow.com/a/24445148

http://stackoverflow.com/comment/38080160
score: 0
comment on: http://stackoverflow.com/q/24580873
type: Comment
type: QuestionComment
has text: I'm using 5 for both the width and height

http://stackoverflow.com/q/24477648
favorite count: 0
linked to: http://stackoverflow.com/q/6366385
tagged with: io
has answer: http://stackoverflow.com/a/24477667
type: AnsweredQuestion
score: 3
has title: Piped<I/O>Stream. Can I pass complex objects?
upvote count: 3
tagged with: java
tagged with: concurrency
type: Question
accepted answer: http://stackoverflow.com/a/24477667
has body: I investigate java I/O. Now I am reading about pipes. I wrote simplest code example: PipedInputStream pipedInputStream = new PipedInputStream(); PipedOutputStream pipedOutputStream = new PipedOutputStream(); pipedOutputStream.connect(pipedInputStream); pipedOutputStream.write(new byte[]{1}); System.out.println(pipedInputStream.read()); I have following question. As I understand - it is very strange to pass bytes in real life. Is it really to extend this example for pass entire String for example?
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24548914
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24548915
type: Question
downvote count: 0
has title: How to initialize Velocity DateTool within spring webapp?
tagged with: jakarta-mail
answer count: 1
accepted answer: http://stackoverflow.com/a/24548915
tagged with: templates
favorite count: 0
has body: Recently I needed to initialize Velocity's DateTool in order to properly format date in resulting e-mail. Usually you do this with VelocityContext, however, since I was using spring's VelocityEngineFactoryBean configured in xml, I got to figure out - how can you initialize VelocityContext, when using VelocityEngineFactoryBean? In other words, my setup: webmvc-config.xml <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> resource.loader=class class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader MailSender.java public class CustomMailSender { @Autowired private VelocityEngine velocityEngine; private void sendMail(final Object backingObject) { MimeMessagePreparator preparator = new MimeMessagePreparator() { public void prepare(MimeMessage mimeMessage) throws Exception { MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true); // Set subject, from, to, .... // Set model, which then will be used in velocity's mail template Map<String, Object> model = new HashMap<String, Object>(); model.put("backingObject", backingObject); String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "mail_template.vm", model); message.setText(text, true); } }; this.javaMailSender.send(preparator); } In mail_template.vm you want to use something like: Transfer start date: $date.format('medium_date', $backingObject.creationDate) How to ensure, that DateTool will be properly initialized and used, when parsing template?
tagged with: velocity

http://stackoverflow.com/comment/38022075
comment on: http://stackoverflow.com/q/24550801
score: 1
has text: possible duplicate of [How to declare an array in Java?](http://stackoverflow.com/questions/1200621/how-to-declare-an-array-in-java)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24446841
downvote count: 0
answers question: http://stackoverflow.com/q/24431609
upvote count: 2
type: Answer
has body: there are some minor mistakes in your code, here is the updated code: private static int Partition(int[] a, int i, int j) { // TODO Auto-generated method stub int temp; int x = a[j]; int l = i - 1; for (int n = i; n &lt; j; n++) { if (a[n] &lt;= x) { /*******Condition was wrong******/ l++; temp = a[l]; a[l] = a[n]; a[n] = temp; } } temp = a[j]; /******a[j] not a[x] x is value of pivot element******/ a[j] = a[l + 1]; a[l + 1] = temp; return l + 1; }
score: 2

http://stackoverflow.com/comment/37843278
has text: @shazin Um, arrays extend `Object`. Therefore, they are "fully fledged objects". No question about it.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24446646

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/24431728
tags question: http://stackoverflow.com/q/24532541
type: Tag

http://stackoverflow.com/comment/37992702
type: AnswerComment
comment on: http://stackoverflow.com/a/24516864
has text: Not sure what's around your code snippet, but this looks like blocking I/O (with an infinite timeout too). Anyway, you'd still get an exception.
type: Comment
score: 0

http://stackoverflow.com/q/24438291
type: Question
upvote count: 1
answer count: 1
has body: I am following JavaFX tutorial found at http://code.makery.ch/java/javafx-8-tutorial-part7/ which describes how to create native installer with 'Inno Setup'. I am using e(fx)clipse 4.4 with java 8 JRE installed only and 1.8 compiler and i do it for windows (exe). Everything works fine, but when i install exported native application it create folders for JRE runtime/jre8/ program wont start and says jvm.dll is not found in bundled runtime. if i change manualy runtime/jre8/ to runtime/jre/ - it start without any problem. I did not found any settings in project for specifing runtime path. How do i make my native installer make right path for runtime?
tagged with: inno-setup
accepted answer: http://stackoverflow.com/a/24456850
favorite count: 0
has answer: http://stackoverflow.com/a/24456850
downvote count: 0
tagged with: java-8
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
has title: E(fx)clipce with Inno Setup wrong jre folder name
tagged with: eclipse

http://stackoverflow.com/comment/37964845
score: 0
type: Comment
type: QuestionComment
has text: Sorry I pasted the wrong code. now updated the OP
comment on: http://stackoverflow.com/q/24520017

http://stackoverflow.com/comment/38079309
comment on: http://stackoverflow.com/q/24581337
score: 0
type: Comment
type: QuestionComment
has text: @RichardTingle aren't you just stating the question?

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/24538508

http://stackoverflow.com/a/24481469
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24481374
type: Answer
has body: I think if you go to Window->Preferences->Java->Code Style and set the Fields prefix list to '_' you will probably be able to do what your trying to achieve. If this doesn't help, maybe try this past question
has comment: http://stackoverflow.com/comment/78883607
score: 4

http://stackoverflow.com/a/26834397
answers question: http://stackoverflow.com/q/24518607
upvote count: 0
has body: There is a way to start a grizzly server that both logs and prints out exceptions in the response: HttpServer server = GrizzlyWebContainerFactory.create(getBaseURI(), Collections.singletonMap("javax.ws.rs.Application", "class.that.extends.ResourceConfig"));
type: AcceptedAnswer
type: Answer
score: -1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24518607

http://stackoverflow.com/comment/38079131
type: QuestionComment
has text: Let's say i need it as comma string. Is there a other way to convert it to an string list?
comment on: http://stackoverflow.com/q/24581202
score: 0
type: Comment

http://stackoverflow.com/a/24562984
downvote count: 1
has comment: http://stackoverflow.com/comment/38045718
type: Answer
has comment: http://stackoverflow.com/comment/38045528
score: 2
has body: Declare public static int[] locations={1,2,3}; outside of the main method.
answers question: http://stackoverflow.com/q/24562950
has comment: http://stackoverflow.com/comment/38045447
upvote count: 3

http://stackoverflow.com/q/24473099
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24473196
tagged with: arrays
has comment: http://stackoverflow.com/comment/37878239
has title: Randomizing an array of string without repetitions
score: 0
accepted answer: http://stackoverflow.com/a/24473196
tagged with: random
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37877914
has body: So I'm confronted to a little problem: I want to randomize an Array of Strings without any repetitions. I've already searched for such thing AND I found some "Randomising an Array without Repetitions" but all I can find is about randomising an array of int and it doesn't give me the results I want. Here's my code (that i shortened just a bit to show only the useful part) so you guys can help me with the use of my own code. The array I want to randomise is the allCommands[] one. Anyway, here it is: Box box = Box.createVerticalBox(); String[] allCommands = new String[]{"start", "help", "hint", "look around", "take note", "look under bed"}; JLabel[] fun = new JLabel[allCommands.length]; for(int o = 0 ; o &lt; allCommands.length ; o++){ fun[o] = new JLabel(allCommands[o]); box.add(fun[o]); } Quick note: The allCommands[] array in my codes is way larger and I might get it even bigger, so I thought about a way to make the randomiser easily expandable... I tried things like Collection and ArrayList (or something like that) and I didn't found the result I wanted. Quick note #2: If my questions isn't very clear or you want me to add more detail about variables in my codes or something else, just tell me and I'll edit this out. Quick note #3 (so many quick notes!): I'm kinda new to programmation. In a result, I would prefer using for() loops, Arrays, if() and else if if possible. But any way of doing a randomisation without repetitions for an array of Strings will make me happy... All of my thanks!

http://stackoverflow.com/a/24434755
accepted answer of: http://stackoverflow.com/q/24434586
answers question: http://stackoverflow.com/q/24434586
has body: When the files / directories are bundled inside a .jar file, they are no longer be treated as File objects. They can be read by acquiring their inputstream like InputStream input = getClass().getResourceAsStream("my_directory/file"); I would suggest you to keep the folder with files in the filesystem and make the operations you want to perform. Is there any reason, you want to bundle them into a jar prior to these manipulation. As per the answer in the below question, In Java 7, you can create a FileSystem from the JAR (zip) file, and then use NIO's directory walking and filtering mechanisms to search through it. This would make it easier to write code that handles JARs and "exploded" directories. You can try that!
has comment: http://stackoverflow.com/comment/37806948
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37806849
type: Answer
score: 0

http://stackoverflow.com/q/24473750
has answer: http://stackoverflow.com/a/24473760
favorite count: 0
upvote count: 1
has title: java.lang.NumberFormatException: For input string when using scanner to read the file
accepted answer: http://stackoverflow.com/a/24473760
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am not sure why I am receiving this error and what's the fix to it in the following snippet of code: String srcFile=args[0]; Scanner fileIn = new Scanner(srcFile); // if (fileIn.isFile() &amp;&amp; fileIn.canRead()) CarDB carDatabase = new CarDB(); while(fileIn.hasNext()) { String[] line = fileIn.nextLine().split(","); double mpg = Double.parseDouble(line[0]); int cylinders = Integer.parseInt(line[1]); int power = Integer.parseInt(line[2]); int year = Integer.parseInt(line[3]); int region = Integer.parseInt(line[4]); String makerName = line[5].trim(); String carName = line[6].trim(); carDatabase.addCar(makerName, carName, mpg, cylinders, power, year, region);// add car carDatabase.addMaker(makerName);//add maker to list } and line 36 is : double mpg = Double.parseDouble(line[0]); Error is: java CarDBMain cars.txt java.lang.NumberFormatException: For input string: "cars.txt" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1250) at java.lang.Double.parseDouble(Double.java:540) at CarDBMain.main(CarDBMain.java:36)
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24437105
tagged with: methods
has title: android replace a method call at runtime
type: Question
has comment: http://stackoverflow.com/comment/37824504
has comment: http://stackoverflow.com/comment/37810981
has body: I am developing an Android app with a 3rd-party library. I want to replace a method call in the library. Please note that I cannot obtain the library's source code, so that I have to change it at runtime. For example, let's assume there is doA() method in a class Foo in the library class Foo { doA() { //method body } ... } I want to replace the method body of doA() with my own code. I have done some exploration and found the following stackoverflow thread: Replacing a method call in a class at runtime. The thread tells me that I may try a bytecode manipulation library called javassist. I found there is an Android-version of that library at here: https://github.com/crimsonwoods/javassist-android. I imported the library and wrote following code: try { final ClassPool cp = ClassPool.getDefault(getApplicationContext()); CtClass cc = cp.get("Foo"); CtMethod method = cc.getMethod("doA","()V"); method.setBody("{ java.lang.System#out.println(\"doA() is called.\");}"); cc.writeFile(); //where the exception was raised } catch (Exception e) { e.printStackTrace(); } But I encountered an exception when executing cc.writeFile(). It is "FileNotFoundException: ./Foo.class: open failed: ENOENT (No such file or directory)". I do not know how to address this problem.
tagged with: bytecode
downvote count: 0
score: 4
tagged with: android
answer count: 1
favorite count: 0
tagged with: javassist
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24437297
has comment: http://stackoverflow.com/comment/37810980
upvote count: 4
has comment: http://stackoverflow.com/comment/37822455
linked to: http://stackoverflow.com/q/9720833
tagged with: java

http://stackoverflow.com/comment/47997513
score: 1
comment on: http://stackoverflow.com/a/26196831
type: AnswerComment
has text: @JacobTabak can we handle both click on individual views in adapter and item click listener. The touch is intercepted by onTouchListener. If i have both then i have both fire listeners one on view and the other on the row item
type: Comment

windows
tags question: http://stackoverflow.com/q/24539026
tags question: http://stackoverflow.com/q/24523997
tags question: http://stackoverflow.com/q/24583782
tags question: http://stackoverflow.com/q/24471844
tags question: http://stackoverflow.com/q/24484370
tags question: http://stackoverflow.com/q/24532541
tags question: http://stackoverflow.com/q/24531003
tags question: http://stackoverflow.com/q/24497871
tags question: http://stackoverflow.com/q/24517610
tags question: http://stackoverflow.com/q/24444680
tags question: http://stackoverflow.com/q/24480450
tags question: http://stackoverflow.com/q/24533169
type: Tag
tags question: http://stackoverflow.com/q/24461403
tags question: http://stackoverflow.com/q/24548479
tags question: http://stackoverflow.com/q/24546534
tags question: http://stackoverflow.com/q/24479777
tags question: http://stackoverflow.com/q/24440209
tags question: http://stackoverflow.com/q/24448201
tags question: http://stackoverflow.com/q/24455117
tag name: windows
tags question: http://stackoverflow.com/q/24459232
tags question: http://stackoverflow.com/q/24428367

http://stackoverflow.com/a/24522722
score: 5
accepted answer of: http://stackoverflow.com/q/24522362
type: AcceptedAnswer
downvote count: 0
has body: To sort lists in Java, the simplest way is to use Collections.sort(). You just need an appropriate Comparator&lt;?&gt;. I assume you want to sort by application name. In that case you can use something like this: final PackageItemInfo.DisplayNameComparator comparator = new PackageItemInfo.DisplayNameComparator(packageManager); Collections.sort(packageList1, new Comparator&lt;PackageInfo&gt;() { @Override public int compare(PackageInfo lhs, PackageInfo rhs) { return comparator.compare(lhs.applicationInfo, rhs.applicationInfo); } }); If you want to sort by package name, it's even simpler: Collections.sort(packageList1, new Comparator&lt;PackageInfo&gt;() { @Override public int compare(PackageInfo lhs, PackageInfo rhs) { return String.CASE_INSENSITIVE_ORDER.compare(lhs.packageName, rhs.packageName); } });
answers question: http://stackoverflow.com/q/24522362
has comment: http://stackoverflow.com/comment/37971796
has comment: http://stackoverflow.com/comment/37971837
type: Answer
upvote count: 5

http://stackoverflow.com/a/28579176
answers question: http://stackoverflow.com/q/24553930
has body: If you receive this error, Windows cannot find the compiler (javac). Here's one way to tell Windows where to find javac. Suppose you installed the JDK in C:\jdk1.8.0. At the prompt you would type the following command and press Enter: C:\jdk1.8.0\bin\javac HelloWorld.java If you choose this option, you'll have to precede your javac and java commands with C:\jdk1.8.0\bin\ each time you compile or run a program. To avoid this extra typing, consult the lecture "Creating a Hello World application" in this website Class names, 'HelloWorld', are only accepted if annotation processing is explicitly requested If you receive this error, you forgot to include the .java suffix when compiling the program. Remember, the command is javac HelloWorld.java not javac HelloWorld.
type: Answer
score: 0

http://stackoverflow.com/q/24529834
has title: eclipse auto complete content assis
has answer: http://stackoverflow.com/a/24544178
tagged with: spring-tool-suite
accepted answer: http://stackoverflow.com/a/24639183
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24639183
has comment: http://stackoverflow.com/comment/38037412
has comment: http://stackoverflow.com/comment/37989746
has comment: http://stackoverflow.com/comment/37992591
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24533156
tagged with: eclipse
has body: In my javaIDE eclipse indigo, started making a list e.g. List&lt;Integer&gt; list = new and then hit Ctrl + space and the top choice was ArrayList() which then filled in the rest List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); Now I have moved to Spring Tools Suite, and this ArrayList is not even found in the list, let alone at the top until I type "ar". Is there a way of making this ArrayList() show in the autocomplete list and if so, how so I can do it with other implementing classes as well (e.g. Map -> HashMap, etc.). P.S. I have seen other posts like this and I don't want suggestions to do it another way e.g. Ctrl+2, L. This is because I type this way Thanks
type: Question
has comment: http://stackoverflow.com/comment/37985071
possible better answer: http://stackoverflow.com/a/24533156

http://stackoverflow.com/comment/37937816
score: 0
has text: yes u r absolutely correct . he may be making mistake in String URL = "jdbc:postgresql://localhost:5432/your DataBase Name";
type: Comment
comment on: http://stackoverflow.com/a/24504976
type: AnswerComment

http://stackoverflow.com/a/25141901
has comment: http://stackoverflow.com/comment/74351027
has comment: http://stackoverflow.com/comment/39224200
has comment: http://stackoverflow.com/comment/39224461
has body: Setting up an Android project is really simple. The document you linked is outdated and you don't need to move any files at all. Unity Goto File -&gt; Build Settings -&gt; Android and click Switch Platform Enable Google Android Project Click Export and choose where you want the Android project to be Android Studio Import or open the project you have just created with Unity Done :) If you want to display the Unity engine inside a subactivity, I suggest you take a look at this answer. If you're completely unfamiliar with Android development, you should start with a simple "Hello World" app without complicating things by adding Unity to the mix. Just follow some of the official Android guides.
type: Answer
upvote count: 22
answers question: http://stackoverflow.com/q/24564470
has comment: http://stackoverflow.com/comment/39224057
downvote count: 0
has comment: http://stackoverflow.com/comment/74368042
has comment: http://stackoverflow.com/comment/74291415
has comment: http://stackoverflow.com/comment/90658881
has comment: http://stackoverflow.com/comment/39224842
has comment: http://stackoverflow.com/comment/39224575
score: 22
has comment: http://stackoverflow.com/comment/43411169
has comment: http://stackoverflow.com/comment/39137025
has comment: http://stackoverflow.com/comment/39224675

http://stackoverflow.com/comment/37809861
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24436628
score: 8
has text: Floating point inaccuracy. 10^-17 is close enough to zero for most practical purposes.

http://stackoverflow.com/a/75168463
answers question: http://stackoverflow.com/q/24473430
type: Answer
has body: This is a very simple question than it sounds. This is possible without using conditional; just write this code System.out.println(n&gt;0);
score: 0

http://stackoverflow.com/a/24508852
has comment: http://stackoverflow.com/comment/37944086
downvote count: 1
upvote count: 6
has body: Start with a sorted array (trivialy easy to create by a for-loop); then shuffle bey swapping each array element with another (random chosen) element. To avoid the bias discussed in the comments, the index of the other element must be equal or higher than the index of the first element. If the indexes are equal, then the element is not swapped. (The original version of this answer contained a sentence about the possibility of the element being swapped back, but this is now obsolete since this can't happen anymore with the highlighted modification)
has comment: http://stackoverflow.com/comment/37945240
answers question: http://stackoverflow.com/q/24508742
score: 5
has comment: http://stackoverflow.com/comment/37943925
type: Answer

http://stackoverflow.com/comment/37872193
type: Comment
comment on: http://stackoverflow.com/a/24469786
type: AnswerComment
has text: Share a `FileOuputStream` and write a timestamp to it from each thread. (I don't think that would add any additional synchronization if that's what you were getting at.)
score: 0

http://stackoverflow.com/q/24520203
has comment: http://stackoverflow.com/comment/37965343
has body: I have a simple class public class A { public static int calc(){ return anotherCalc(); } public static int anotherCalc() { return 10; } } I need to verify is method calc fire an anotherCalc method? How can I do it with PowerMockito? UPD: I have a code which (I think) do the right verification. But I'm not sure. @Test public void should_invoke_anotherCalc_method() throws Exception { mockStatic(A.class); when(A.calc()).thenCallRealMethod(); A.calc(); verifyStatic(times(1)); A.anotherCalc(); } Maybe anyone can say is it ok or not?
type: Question
has comment: http://stackoverflow.com/comment/38035375
score: 0
has comment: http://stackoverflow.com/comment/37965389
answer count: 1
accepted answer: http://stackoverflow.com/a/24557690
tagged with: powermock
has title: How can I verity two static methods invocations using PowerMock?
has comment: http://stackoverflow.com/comment/37965038
has answer: http://stackoverflow.com/a/24557690
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37965405
tagged with: java
linked to: http://stackoverflow.com/q/24516771

http://stackoverflow.com/q/24444265
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24503645
has comment: http://stackoverflow.com/comment/37826916
has comment: http://stackoverflow.com/comment/37827337
has answer: http://stackoverflow.com/a/24503645
tagged with: java
tagged with: itext
upvote count: 1
has comment: http://stackoverflow.com/comment/37826361
type: Question
has comment: http://stackoverflow.com/comment/37835598
linked to: http://stackoverflow.com/q/20351916
answer count: 2
has answer: http://stackoverflow.com/a/24455048
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
score: 1
has title: Watermark in itextsharp is not displaying properly
favorite count: 0
has comment: http://stackoverflow.com/comment/37838482
has comment: http://stackoverflow.com/comment/37832688
has comment: http://stackoverflow.com/comment/37834512
has body: I'm using iTextSharp to populate the data to PDF Templates, which is created in OpenOffice. it populating fine, I'm getting proper PDF, Watermark is not displaying properly. below is my code: public void addWaterMark(PdfStamper stamper, int pageNumber, Watermark watermark) { List&lt;WatermarkField&gt; watermarkFields = watermark.getWatermarkFieldAsReference(); for (WatermarkField watermarkField : watermarkFields) { // setting font and font size for the watermark text Font FONT = new Font(FontFamily.HELVETICA, watermarkField.getFontSize(), Font.BOLD, new GrayColor(0.75f)); // setting alignment for the watermark ColumnText.showTextAligned(stamper.getUnderContent(pageNumber), Element.ALIGN_CENTER, new Phrase(watermarkField.getText(), FONT), watermarkField.getXDirection(), watermarkField.getYDirection(), watermarkField.getRotation()); } } When i putting in background text-boxes are hiding the watermark. When i putting in foreground watermark is hiding the text. Both screen shorts are attaching below. Please Suggest me the solution. Thanks.
accepted answer: http://stackoverflow.com/a/24455048

http://stackoverflow.com/a/24554534
has comment: http://stackoverflow.com/comment/38029248
type: Answer
has comment: http://stackoverflow.com/comment/38039778
answers question: http://stackoverflow.com/q/24554084
has body: To make it more clear, the table involved is completely configurable. That is why I cant create POJO classes prior to this task. In that case, I'd have thought that the only real way of doing this is to turn each row into a string with delimiters (CSV, XML or something) and then create an array of strings. You can get a list of column names returned by a JDBC query as in this answer: Retrieve column names from java.sql.ResultSet
has comment: http://stackoverflow.com/comment/38032347
score: 0

richfaces
tags question: http://stackoverflow.com/q/24468940
type: Tag
tag name: richfaces

http://stackoverflow.com/comment/38071238
type: Comment
type: QuestionComment
score: 0
has text: @JonSkeet My point is that I want to run this class and get the same instance every time. When I run it now, i see the same 'PID', but with instance.hashCode(); I see different instances. That's my query, how to make it possible.
comment on: http://stackoverflow.com/q/24576793

http://stackoverflow.com/comment/37878045
comment on: http://stackoverflow.com/q/24473158
score: 0
type: Comment
type: QuestionComment
has text: What is the API level you creating the project for?

http://stackoverflow.com/q/24473320
upvote count: 1
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/37878353
score: -1
has comment: http://stackoverflow.com/comment/37878348
accepted answer: http://stackoverflow.com/a/24473560
has comment: http://stackoverflow.com/comment/37878368
has comment: http://stackoverflow.com/comment/37878424
answer count: 1
has comment: http://stackoverflow.com/comment/37878643
favorite count: 0
has title: How to modify builder pattern by adding more keys?
has body: I am working on a project in which I need to make a keys by passing different parameters to it so I decided to use Builder pattern here. Below is my DataKey class builder which we need to make before calling the code. In the below builder class, we have three important keys which are userId, uuid and deviceId. public final class DataKey { private final long userId; private final long uuid; private final long deviceid; private final int clientId; private final long timeout; private DataKey(Builder builder) { this.userId = builder.userId; this.uuid = builder.uuid; this.deviceid = builder.deviceid; this.clientId = builder.clientId; this.timeout = builder.timeout; } public static class Builder { protected final long userId; protected final long uuid; protected final long deviceid; protected final int clientId; protected long timeout = 200L; public Builder setUserId(long userId) { this.userId = userId; return this; } public Builder setUuid(String uuid) { this.uuid = uuid; return this; } public Builder setDeviceId(String deviceid) { this.deviceid = deviceid; return this; } public Builder setClientId(String clientId) { this.clientId = clientId; return this; } public DataKey build() { return new DataKey(this); } } public long getUserId() { return userId; } public long getUuid() { return uuid; } public long getDeviceId() { return deviceid; } public int getclientId() { return clientId; } public long getTimeout() { return timeout; } } Problem Statement:- Here customer, will pass modelId always but they can pass us different combinations of important id keys such as - userId, uuid, deviceId : If they are passing userId, uuid and deviceId, then the preference will be userId. So now, I will use userId and that means, it is a USERFLOW as shown in the below enum. uuid, deviceId : If they are passing uuid and deviceId, then the preference will be uuid. So now, I will use uuid and that means, it is a DEVICEFLOW as shown in the below enum. deviceId : If they are passing deviceId, then…
has comment: http://stackoverflow.com/comment/37878412
has answer: http://stackoverflow.com/a/24473560
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37878355
tagged with: builder
has comment: http://stackoverflow.com/comment/37878711
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/37801209
type: QuestionComment
has text: @Doon Hi, I just checked **bold** 'netstat -an | grep 12000'. I get the folloing: **tcp6 0 0 :::12000 :::* LISTEN'**. interestingly when I check for **netstat -an | grep 12000** I get **tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN**. So I'm just wondering how do I add **0.0.0.0** for port **12000**. that might solve my problem
score: 0
comment on: http://stackoverflow.com/q/24430249
type: Comment

http://stackoverflow.com/a/24553123
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24552723
downvote count: 0
has body: You could do it quite simply with three for loops, assuming all you want is to output the possible combinations. for(int i = 0; i &lt; set1.size; i++){ for(int j = 0; j &lt; set2.size; j++){ for(int k = 0; k &lt; set3.size; k++){ System.out.println(set1.toArray()[i] + " " + set2.toArray()[j] + " " + set3.toArray()[k]); // toArray() represents the set as an array, allowing easy access to its indices } } } That would yield your listed output in a simple way, and you could probably easily see how it works. For fixed values from set1 and set2, output all possibilities from set3. Then change to another unused value from set2, and so on.
type: Answer

http://stackoverflow.com/comment/37903280
comment on: http://stackoverflow.com/a/24486362
has text: @JonSkeet If you use an object of a Class and you use a setter method instead of assignment you could explain to the OP better.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24512451
type: Answer
has body: JPA is Java Persistence API released as a JSR (Java Specification Requests) by JCP (Java Community Process). It is kind of specification; in other words like interface, no implementation includes. Every vendor (implementors) who interested this spec needs to implement as it says in specification document. Here is example JPA 2.0 spec
answers question: http://stackoverflow.com/q/24512100
score: 0

http://stackoverflow.com/comment/38098126
has text: If you're going to create another class anyway, then using a delegate class as described in blgt answer is probably the best.
type: Comment
comment on: http://stackoverflow.com/a/24588863
score: 0
type: AnswerComment

android-camera
tags question: http://stackoverflow.com/q/24531118
type: Tag
tag name: android-camera

http://stackoverflow.com/comment/55540212
has text: I figured out the view is a topmost `Layout` for a `list_item.xml`. How can I know on which exactly `view` a click was?
type: AnswerComment
comment on: http://stackoverflow.com/a/26196831
score: 0
type: Comment

http://stackoverflow.com/comment/38015090
comment on: http://stackoverflow.com/a/24546872
score: 0
has text: cursor.getCount() returned 0 . But how can I get data from database?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37875869
type: Comment
type: QuestionComment
has text: Could you please explain "I'm not sure how to fetch records from the database as quickly as possible without the workers rejecting new tasks."? Is the thread pool rejecting your tasks because you generate so many tasks quickly that the pool's waiting queue is full? If so, you can make each task's batch size bigger. (e.g. 1000 rows instead of 100 rows)
score: 0
comment on: http://stackoverflow.com/q/24471543

http://stackoverflow.com/comment/37831870
score: 1
has text: why would `synchronized(object)` be better than `synchronized(this)` . I always thought it depended on the circumstances
comment on: http://stackoverflow.com/q/24448460
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24524834
score: 6
answers question: http://stackoverflow.com/q/24524811
downvote count: 0
has body: There's no difference in the initializations, only in the declarations and therefore in the way the rest of your code sees the variables type.
type: Answer
upvote count: 6

http://stackoverflow.com/comment/38008704
has text: You shouldn't need to do `update-alternatives --install` just to switch between the 32-bit and 64-bit versions of Java. Alternatives are installed automatically by the packages that provide them. The `--config` should be all you need.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24543014
type: QuestionComment

http://stackoverflow.com/comment/37852866
score: 1
comment on: http://stackoverflow.com/q/24459226
has text: the error traces back to `android.app.Activity.setContentView(Activity.java:1929)`, which is called with `R.layout.history`, which indicates that something is wrong in `history.xml`. post that file.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24490636
has body: For a rarely occurring condition in a method which is called from different sites, I'd like to have the stack trace in the log. The exceptional conditions are note detected via exceptions, that is, there is no try-catch. The only way I'm aware if is to use a fake exception, like this: static void logWithStacktrace(Logger logger, Priority p, String msg) { try { throw new AssertionError(); } catch (AssertionError e) { logger.log(p, msg, e); } } Is there a good way to do this without raising an exception? Maybe there is there a log4j feature I've overlooked? I'm looking for a solution that formats the stack trace as in real exception messages - ideally it would end up as a &lt;log4j:throwable&gt; element in the XML log file. Using Thread.getStackTrace and formatting it myself doesn't let me do that. I'm aware that "rarely occurring" sort of screams for the code to be refactored to use exceptions. On the other hand, all I would do with the exceptions is to log them, since the problems are not really errors but an indication of questionable API usage. So it seems sort of contrived not to log them directly.
tagged with: java
type: Question
has title: How to log stack trace outside of catch clause
has answer: http://stackoverflow.com/a/24491993
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24490795
tagged with: log4j
linked to: http://stackoverflow.com/q/1069066
possible better answer: http://stackoverflow.com/a/24490795
accepted answer: http://stackoverflow.com/a/24491993
tagged with: logging
type: AnsweredQuestion

http://stackoverflow.com/comment/37800927
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24431711
has text: When you do a maven-build, if you are getting your jar file inside "target" folder, you can deploy that jar file inside tomcat, non-embedded one.
type: Comment

http://stackoverflow.com/comment/37981590
comment on: http://stackoverflow.com/a/24529097
has text: The view you inflated at the top, I believe.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24458759
has comment: http://stackoverflow.com/comment/37851132
answer count: 0
downvote count: 0
favorite count: 0
type: Question
score: 3
tagged with: xsd
tagged with: http://stackoverflow.com/tag/xml
has title: Using JAXB .episode files
upvote count: 3
has body: I am trying to generate .java files from XSD files using JAXB. I have two xsd schemas, Base.xsd and Area.xsd. Area.xsd imports Base.xsd. I have been able to create java files for each of the schemas separately, but that results in duplicate java files for the Base.xsd. I tried to solve this problem by creating an episode file for Base.xsd using the command: xjc -d out -episode base.episode Base.xsd This worked fine and created the episode file as expected. Next I attempted to create the java files from each of the schemas: xjc -d ...\src\main\java Base.xsd -p mypackage.base xjc -d ...\src\main\java Area.xsd -p mypackage.area -extension -b base.episode The java files for Base.xsd were created successfully, however no files were created for Area.xsd (including the Area-specific classes). I have spent a lot of time looking into this issue, and it seems like it should work as expected. Is this anything noticeably wrong with what I am doing? Please advise me if there is anything you would recommend changing. Thanks in advance.
has comment: http://stackoverflow.com/comment/37859107
tagged with: java
type: UnansweredQuestion
tagged with: jaxb
linked to: http://stackoverflow.com/q/9756185

http://stackoverflow.com/comment/38039572
has text: @veritas I agree now: since your code is calling lock() and not lockInterruptibly() in signalNotFull / signalNotEmpty, it should be safe. Not sure if there's much benefit to the extra complexity though. I suspect if you perf test both options under a decent load, you might be able to answer your original question (i.e. your take and put methods each use both of the locks).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24542089
type: Comment

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/24574046
tags question: http://stackoverflow.com/q/24429671
type: Tag

http://stackoverflow.com/comment/38039119
type: Comment
has text: @spudone no you see there is a while loop while await, so it will always look at the correct count. If this would not be the case even LBQ will fail in the sense not overriding the elements but queue will exceeds its size
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24542089

http://stackoverflow.com/q/24578253
tagged with: android-studio
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38074336
has comment: http://stackoverflow.com/comment/38073532
type: Question
has answer: http://stackoverflow.com/a/24578769
has comment: http://stackoverflow.com/comment/38073596
score: 4
has comment: http://stackoverflow.com/comment/38073708
answer count: 2
downvote count: 0
has body: I am making an android app and one of the components of the app is designed to take a number in binary and convert it to decimal. Every time I run it, it crashes. public void Button0Clicked(View v) { TextView myText = (TextView)findViewById(R.id.textView); if (firstType == true) { myText.setText(""); firstType = false; } myText.setText(myText.getText() + "0"); } public void Button1Clicked(View v) { TextView myText = (TextView)findViewById(R.id.textView); if (firstType == true) { myText.setText(""); firstType = false; } myText.setText(myText.getText() + "1"); } public void Conversion(View view) { TextView myText = (TextView)findViewById(R.id.textView); int decimalValue = Integer.parseInt(myText.getText().toString(),2); TextView result = (TextView)findViewById(R.id.textView2); result.setText(decimalValue); } I've narrowed the problem down to some problem with the Integer.parseint() function, is my implementation wrong? Stack Trace 07-04 09:43:17.806 29832-29832/com.example.jay.myapplication2 E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.jay.myapplication2, PID: 29832 java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3823) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:5…
has answer: http://stackoverflow.com/a/24578734
favorite count: 0
accepted answer: http://stackoverflow.com/a/24578734
possible better answer: http://stackoverflow.com/a/24578769
tagged with: android
has title: How do I convert from binary to decimal in java (using android studio)
upvote count: 4

http://stackoverflow.com/comment/37891149
score: 1
type: AnswerComment
has text: @user3637864: please have another look at the [mcve requirements link](http://stackoverflow.com/help/mcve) as it will require more effort on your part. The link will tell you exactly what is required to satisfy the mcve requirements.
comment on: http://stackoverflow.com/a/24479941
type: Comment

akka
type: Tag
tags question: http://stackoverflow.com/q/24584887
tags question: http://stackoverflow.com/q/24514598
tag name: akka
tags question: http://stackoverflow.com/q/24536971
tags question: http://stackoverflow.com/q/24490118
tags question: http://stackoverflow.com/q/24459168

http://stackoverflow.com/q/24493702
answer count: 0
has title: Spring 2.0 Redirect from within formBackingObject() method?
type: UnansweredQuestion
tagged with: http-redirect
type: Question
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/37916792
score: 0
has comment: http://stackoverflow.com/comment/37916763
tagged with: spring
has body: So I'm writing a spring 2.0 controller, myNewController.ctl, I've got the request mapping working such that when the user hits a button on a page, the flow of control passes to the formBackingObject() method as expected. Now, at this point business logic requires that sometimes we generate the backing object as normal and return it (which I can do fine), but in other situations, we want to redirect the user to a different controller, (as a get request). I've tried to do something like return new RedirectView("/myOtherController.ctl"); but The user is never redirected, and the browser just goes to myNewController.ctl and gets an error screen. How can I redirect the user to a different controller from within the createBackingObject() method of a spring 2.0 simpleFormController workflow? Edit: I do know that there are newer technologies out there, but this is a legacy system and a one-time add-on. Upgrading isn't the solution I'm looking for.

http://stackoverflow.com/comment/37965821
type: AnswerComment
type: Comment
score: 0
has text: @codeMonkey oops wrong reflection call use `getMethod` instead
comment on: http://stackoverflow.com/a/24520439

http://stackoverflow.com/a/24525836
has body: Create an object of form inside loop. Also check pageCount if it is 1.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37978209
has comment: http://stackoverflow.com/comment/37978649
answers question: http://stackoverflow.com/q/24525770
has comment: http://stackoverflow.com/comment/37976057
has comment: http://stackoverflow.com/comment/37978525
has comment: http://stackoverflow.com/comment/37978474

http://stackoverflow.com/a/24540719
upvote count: 11
answers question: http://stackoverflow.com/q/24540443
score: 11
downvote count: 0
has body: If you just need the current day of week in a human-readable format, formatted to the current user's locale, then you could use this: SimpleDateFormat sdf = new SimpleDateFormat("EEEE"); String dayString = sdf.format(new Date()); If their locale is "en_US", the output is: Wednesday If their locale is "de_DE", the output is: Mittwoch If their locale is "fr_FR", the output is: mercredi But if you need a numerical representation of the day of week (for example, you wanted to get '1' if it is Sunday or '2' if it is Monday), then you could use Calendar: Calendar cal = Calendar.getInstance(); int dayInt = cal.get(Calendar.DAY_OF_WEEK);
type: Answer

http://stackoverflow.com/q/24546135
downvote count: 4
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/38013659
answer count: 3
has answer: http://stackoverflow.com/a/24546167
type: UnansweredQuestion
has title: For loop not working with int
score: -4
has answer: http://stackoverflow.com/a/24546154
tagged with: java
has answer: http://stackoverflow.com/a/24546260
type: Question
has body: Alright so I had my for loop before set up like... for(int i=0; i&lt;inventory.size(); i++){ g.drawImage( inventory.get(i).getImage(), Game.WIDTH - inventory.get(i).getImage().getWidth() - 2, (Game.HEIGHT / 2 - hud.getSideHeight() / 2) + (i*4+2) + i*(inventory.get(i).getImage().getWidth()), inventory.get(i).width, inventory.get(i).height, null ); } But now instead of it running till inventory.size() I want it to run till it reaches seven so I did this... for(int i=0; i&lt;7; i++){ g.drawImage( inventory.get(i).getImage(), Game.WIDTH - inventory.get(i).getImage().getWidth() - 2, (Game.HEIGHT / 2 - hud.getSideHeight() / 2) + (i*4+2) + i*(inventory.get(i).getImage().getWidth()), inventory.get(i).width, inventory.get(i).height, null ); } Why doesn't this work? I am getting the java.lang.IndexOutOfBoundsException error. Thanks for all the help!

http://stackoverflow.com/a/69480917
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24580508
upvote count: 1
type: Answer
has body: For Android API 28 and above you can use the following code TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ANSWER_PHONE_CALLS) != PackageManager.PERMISSION_GRANTED) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { telecomManager.endCall(); } }else{ //Ask for permission here } Also add this permission in your app manifest file <uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />

http://stackoverflow.com/comment/38059317
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24549971
has text: What is the GET request now? As you are sending a JSON in the URI, there must be a "name" for that parameter.
score: 0

angularjs
tags question: http://stackoverflow.com/q/24439335
type: Tag
tags question: http://stackoverflow.com/q/24566950
tag name: angularjs
tags question: http://stackoverflow.com/q/24530999
tags question: http://stackoverflow.com/q/24567422

http://stackoverflow.com/q/24447233
tagged with: java
has comment: http://stackoverflow.com/comment/37830039
has comment: http://stackoverflow.com/comment/37830715
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37830482
has answer: http://stackoverflow.com/a/24466815
has comment: http://stackoverflow.com/comment/37829966
downvote count: 0
has comment: http://stackoverflow.com/comment/37830921
has title: Store enum class reference
has comment: http://stackoverflow.com/comment/37829723
has comment: http://stackoverflow.com/comment/37829627
tagged with: wildcard
favorite count: 0
has comment: http://stackoverflow.com/comment/37832999
has answer: http://stackoverflow.com/a/24447331
has comment: http://stackoverflow.com/comment/37830608
has comment: http://stackoverflow.com/comment/37830247
has comment: http://stackoverflow.com/comment/37830833
has comment: http://stackoverflow.com/comment/37829575
has comment: http://stackoverflow.com/comment/37829588
has comment: http://stackoverflow.com/comment/37829592
possible better answer: http://stackoverflow.com/a/24447331
tagged with: generics
has comment: http://stackoverflow.com/comment/37829765
has comment: http://stackoverflow.com/comment/37829607
accepted answer: http://stackoverflow.com/a/24466815
upvote count: 2
has comment: http://stackoverflow.com/comment/37830131
has body: Ok i have two enums: public enum AnotherEnum { value1, value2, value3; } public enum MyEnum implements MyInterface { value1(AnotherEnum); generic_reference_type a; MyEnum ( ?? ) { a = ?? } GetGenericReference() { return this.a; } } I want MyEnum to store a reference to the AnotherEnum class so I'll be able to do this: MyEnum.value1.GetGenericReference().values(); Is this possible?
score: 2
type: AnsweredQuestion
tagged with: enums

bukkit
tag name: bukkit
type: Tag
tags question: http://stackoverflow.com/q/24464772
tags question: http://stackoverflow.com/q/24428437
tags question: http://stackoverflow.com/q/24492218

http://stackoverflow.com/comment/37848396
has text: @user3539825 Not necessarily. You might understand the *basics*, but the *specific* stuff from the Android API you'll need to find elsewhere, especially if Java 6/7 features are being used.
score: 1
comment on: http://stackoverflow.com/q/24457285
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24450976
has comment: http://stackoverflow.com/comment/37836796
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37848712
has body: You would need to read the file to get an index of where each block starts. Once you have this you can do a binary search of those blocks. Note: if you have an underlying record or key, it could be split across multiple blocks. A better solution is to build the compressed file yourself. Write a known number of records to a block and compress those individually. Additionally you can write a index to say where each block starts as well as the first key for that block. This would allow you to find the right block without decompressing all the keys and only decompress one block instead of log2(n) blocks per search.
accepted answer of: http://stackoverflow.com/q/24450874
type: Answer
has comment: http://stackoverflow.com/comment/37839274
answers question: http://stackoverflow.com/q/24450874

http://stackoverflow.com/comment/38077746
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24573464
type: Comment
has text: Yeah, I totally missed that. Thanks.

http://stackoverflow.com/a/24514440
has comment: http://stackoverflow.com/comment/37954095
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24514336
has body: boolean a, b, c = false; You declare a, b and c here, but only assign c. As in: boolean a; boolean b; boolean c = false; If you want to assign each of the variables, you have to make it explicit: boolean a = false, b = false, c = false; (But at that point it would probably be more readable to split it into multiple lines.) Consequently, it makes no sense to have a, b, c = true; // invalid You can, however, use a = b = c = true; // valid to assign a, b and c all to true.
answers question: http://stackoverflow.com/q/24514336
upvote count: 5
has comment: http://stackoverflow.com/comment/37954226
type: Answer
downvote count: 0

http://stackoverflow.com/q/24552484
linked to: http://stackoverflow.com/q/858572
has body: Is it possible to set several object to List? If I declare List&lt;Object&gt; it will accept any kind of objects. If I declare List&lt;Integer&gt; it will accept only integers. Can I make a list which will accept Integers OR Floats and nothing else?
has answer: http://stackoverflow.com/a/24552570
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24552803
possible better answer: http://stackoverflow.com/a/24552570
tagged with: java
linked to: http://stackoverflow.com/q/9975836
type: Question
has title: How to assign accepted objects to generics?
has answer: http://stackoverflow.com/a/24552667
accepted answer: http://stackoverflow.com/a/24552803
score: 0
answer count: 3

http://stackoverflow.com/comment/38007075
type: AnswerComment
has text: I am getting this exception Exception in thread "main" org.json.JSONException: JSONObject["toppings"] is not a JSONObject. at org.json.JSONObject.getJSONObject(JSONObject.java:515) at com.Teste.main(Teste.java:42)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24542244

http://stackoverflow.com/q/24484582
has body: I have a json object I want to case into a java class, I'm not sure what i'm supposed to cast two of the properties to, they are comma seperated strings. The json object looks like this {"color":null,"display_name":null,"id":321,"option_codes":"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013","user_id":123,"vehicle_id":1234567890,"vin":"5YJSA1CN5CFP01657","tokens":["x","x"],"state":"online"} The option codes and tokens are the member properties I keep getting an error with this java class. public class Vehicle{ private String color,displayName,vin,state; private int id,user_id,vehicle_id; private List&lt;String&gt; option_codes,tokens; public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getVin() { return vin; } public void setVin(String vin) { this.vin = vin; } public String getState() { return state; } public void setState(String state) { this.state = state; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getUser_id() { return user_id; } public void setUser_id(int user_id) { this.user_id = user_id; } public int getVehicle_id() { return vehicle_id; } public void setVehicle_id(int vehicle_id) { this.vehicle_id = vehicle_id; } public List&lt;String&gt; getOption_codes() { return option_codes; } public void setOption_codes(List&lt;String&gt; option_codes) { this.option_codes = option_codes; } public List&lt;String&gt; getTokens() { return tokens; } public void setTokens(List&lt;String&gt; tokens) { this.tokens = tokens; } } Is there a way to cast the option_codes into an array somehow from the csv string?
has comment: http://stackoverflow.com/comment/37900189
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37899972
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24484872
has answer: http://stackoverflow.com/a/24485041
type: Question
has title: What type do I cast a CSV json string to its java memeber
accepted answer: http://stackoverflow.com/a/24484872
has comment: http://stackoverflow.com/comment/37899929
answer count: 3
tagged with: getter-setter
possible better answer: http://stackoverflow.com/a/24484809
has answer: http://stackoverflow.com/a/24484809

ignore-case
type: Tag
tags question: http://stackoverflow.com/q/24558456
tag name: ignore-case

http://stackoverflow.com/comment/37870278
score: 0
comment on: http://stackoverflow.com/q/24468875
type: Comment
type: QuestionComment
has text: Problem solved thanks for all who try to help me and a special thanks for the one who make a downvote !

http://stackoverflow.com/comment/37906033
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24487641
has text: Publish the code, which creates and writes file, please.

http://stackoverflow.com/comment/37931817
has text: Can you point out here exactly are you getting the problem?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24501894

http://stackoverflow.com/comment/38011973
type: Comment
type: QuestionComment
has text: InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
score: 0
comment on: http://stackoverflow.com/q/24544878

http://stackoverflow.com/a/24527737
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/75032102
has body: You can use SimpleDateFormat to format and parse any date string. The format you are looking for is "yyyyww".
upvote count: 3
answers question: http://stackoverflow.com/q/24527611
type: Answer

http://stackoverflow.com/comment/38076782
has text: Oke, thanks. I have solve this trouble. Now, everything is well. Thanks Mr.Pr0gr4mm3r...
comment on: http://stackoverflow.com/a/24579574
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37853301
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24459832
has text: You have to load via `getResource()`

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/24497758
tags question: http://stackoverflow.com/q/24479732
tags question: http://stackoverflow.com/q/24453202

http://stackoverflow.com/comment/37942509
type: Comment
has text: The first thing to look for is where the bottleneck is. Is it Java fetching the results? Is the the network (are you delivering too much overhead?)? Is it the rendering part? In which JavaScript is to blame?
score: 0
comment on: http://stackoverflow.com/q/24507301
type: QuestionComment

http://stackoverflow.com/q/24548964
tagged with: response-time
has body: I created a simple rest service POST method that consumes a XML. I created a REST client with Jersey and created my object and i am trying to see the variations in response time by increasing my XML length, by giving larger inputs to my objects. Say, my objects takes up a simple employee details, i will increase . I see that the response time inconsistently varies , from my observation it is not dependent on the size of the xml. I am computing the time taken as follows. long startTime = System.currentTimeMillis(); // enter code here for post ` long elapsedTime = System.currentTimeMillis() - startTime; Please Suggest if there is a better way of doing it. Here what i would like to get clarified is my server is in the local host and why the response time varies (say once it is 88ms and the other time it is 504ms ). What i expect is it should increase when i am giving larger inputs to my xml object but that does not happen as i observe. Please clarify or point me to a better site or book where i can read about the same.
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: jersey
possible better answer: http://stackoverflow.com/a/24549118
has answer: http://stackoverflow.com/a/24554767
accepted answer: http://stackoverflow.com/a/24554767
tagged with: rest
has title: Restful response time varies irrespective of the input size?
has answer: http://stackoverflow.com/a/24549118

http://stackoverflow.com/comment/37885253
type: Comment
comment on: http://stackoverflow.com/a/24476994
type: AnswerComment
score: 0
has text: The object creation should be inside the loop but not THAT object creation. The marker list should not be created repeatedly.

http://stackoverflow.com/comment/37942380
has text: Does the value get inserted into the database correctly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24507893

http://stackoverflow.com/comment/38080152
has text: @user3052882: You can download the file from the jdoodle (at "others" button). Then you can enter the values from stdin. If there are still problems you or you're IDE probably forgot to recompile it...
type: AnswerComment
comment on: http://stackoverflow.com/a/24581755
score: 0
type: Comment

http://stackoverflow.com/a/50948300
type: Answer
score: 0
has body: For me worked following approach: SparkConf sparkConf = new SparkConf().setAppName("MyApp").setMaster("local[*]"); SparkContext sparkContext = new SparkContext(sparkConf); org.apache.hadoop.conf.Configuration conf = ... String TABLE_NAME = ... String startRow = ... String endRow = ... String columnFamily = ... String columnName = ... conf.set(org.apache.hadoop.hbase.mapreduce.TableInputFormat.TableInputFormat.INPUT_TABLE, TABLE_NAME); conf.set(TableInputFormat.SCAN_ROW_START, startRow); conf.set(TableInputFormat.SCAN_ROW_STOP, endRow); conf.set(TableInputFormat.SCAN_COLUMNS, "columnFamily:columnName"); org.apache.spark.rdd.RDD&lt;Tuple2&lt;ImmutableBytesWritable, Result&gt;&gt; hbaseRdd = sparkContext.newAPIHadoopRDD(conf, TableInputFormat.class, org.apache.hadoop.hbase.io.ImmutableBytesWritable.class, org.apache.hadoop.hbase.client.Result.class);
answers question: http://stackoverflow.com/q/24450540

http://stackoverflow.com/q/24471720
has body: I have a database on a server, and to connect with him use RMI. I created the following method in the RMI server: public InputStream getImageById(int id) { try { String sql = "SELECT photo FROM Product WHERE id = ?"; PreparedStatement ps = SQLConnection.getConnection().prepareStatement(sql); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); while(rs.next()) { return rs.getBinaryStream("photo"); } Log.message("Retonada imagem (ID: " + id + ")"); } catch (SQLException e) { Log.message("Ocorreu um erro. (getImageById) " + e.getMessage()); } return null; } But when calling the error is occurring below, someone can tell me what it is? SEVERE: null java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: net.sourceforge.jtds.util.BlobBuffer$BlobInputStream at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:191) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148) at com.sun.proxy.$Proxy0.getImageById(Unknown Source) at model.teste.main(teste.java:22) Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: net.sourceforge.jtds.util.BlobBuffer$BlobInputStream at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1352) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:324) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:173) ... 4 more Caused by: java.io.NotSerializableException: net.sourceforge.jtds.util.BlobBuffer$BlobInputStream at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1181) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347) at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:292) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.j…
type: UnansweredQuestion
tagged with: rmi
tagged with: java
tagged with: jtds
type: Question
has answer: http://stackoverflow.com/a/24472004
has title: java.io.NotSerializableException: net.sourceforge.jtds.util.BlobBuffer$BlobInputStream
tagged with: sql-server
score: 0
answer count: 1

http://stackoverflow.com/comment/37936587
comment on: http://stackoverflow.com/q/24504304
has text: Oh you didn't mention that in your question, just set the content of the head to null thats all. Something like list.remove(0)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37991176
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24533962
has text: A .csv file doesn't have the format for being loaded as a Property object. -- And: If you can't access the remote file you won't be able to read it.

http://stackoverflow.com/comment/38072572
type: QuestionComment
score: 1
has text: Have you added the support libraries in your build.gradle? Use Google Repository's Wear version instead of a fat jar.
comment on: http://stackoverflow.com/q/24577811
type: Comment

http://stackoverflow.com/q/24435239
has answer: http://stackoverflow.com/a/24435517
has answer: http://stackoverflow.com/a/24435347
has answer: http://stackoverflow.com/a/24435278
accepted answer: http://stackoverflow.com/a/24435278
has comment: http://stackoverflow.com/comment/37807596
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
has title: Why declare self static instance of a class
has body: I sometimes see that people create self instance for example: public class Example extends Service { private static Example mInstance = null; public void onStart( Intent aIntent, int aStartId ) { mInstance = this; . . . } } What is the purpose of this?
has answer: http://stackoverflow.com/a/24435270
answer count: 7
has answer: http://stackoverflow.com/a/24435812
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24435265
has answer: http://stackoverflow.com/a/24435524
downvote count: 0
possible better answer: http://stackoverflow.com/a/24435347

http://stackoverflow.com/a/24536457
has body: Hackers do not need the APK to ascertain your server's IP. They could simply use a proxy tool such as Fiddler or packet sniffer. During my brief stint as a game developer (working on the network multiplayer features), you learn to just assume that cheaters and hackers have the source code to your game. Then you design your protocols around that assumption. So how do you guard your server from being hacked by a rogue client or from cheating? You really can't, but here's some things that make it extremely hard. Require the user to "log in" (name/password) from the game before allowing it to post anything to your server. If you catch someone cheating, ban their account from playing the game by disallowing them to login. Use a "ticket" or auth token in the header of each HTTP request for the server to validate. If you ban someone, it will be too annoying for them to get a new account to try again. HTTPS instead of HTTP. Technically a hacker could beat this by simply changing his rogue client to post with HTTPS as well. He could reverse engineer the protocol by debugging your APK. But now you've made it so much harder for him to discover what the protocol is to begin with. With HTTPS, the hacker can't use an easy tool such as Fiddler to observe the network traffic. Be wary of debug spew in release builds. Make sure your "Log" statements related to anything protocol wise are in debug builds only, never release builds. Obfuscate everything and use something like HMAC to "sign" every message with a key. This technically isn't security, but will make it A LOT harder for anyone who breaks the encryption to continue. Something like the following: Example code: name = BASE64("Hacker"); messagetype = ROT13("HK"); score = 3910; tosend = name + ":" + messagetype + ":" + Integer.ToString(score ^ 0xAAAAAAAA) + ":"; Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM); mac.init(Your_Secret_Key); byte[] rawHmac = mac.doFinal(data.getBytes()); tosend += Encoding.EncodeBase64(rawHmac); Where …
score: 2
has comment: http://stackoverflow.com/comment/37996096
downvote count: 0
answers question: http://stackoverflow.com/q/24532340
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37995874

http://stackoverflow.com/comment/37806402
type: Comment
type: QuestionComment
has text: Why do you have Jackson 1 and Jackson 2 in your POM file?
comment on: http://stackoverflow.com/q/24434515
score: 0

http://stackoverflow.com/comment/38355978
type: Comment
has text: As far as I know NodeAware is 3.3+ so probably this will not work on 3.2 and you use private API which always is subject of changes. We do not yet expose those things to users SPI but you're right, we eventually need to do that to make it convenient to use. Can you please fill out an enhancement request on github?
comment on: http://stackoverflow.com/a/24681504
type: AnswerComment
score: 0

http://stackoverflow.com/q/24568613
downvote count: 0
answer count: 1
favorite count: 0
tagged with: netbeans-8
has comment: http://stackoverflow.com/comment/38059316
has comment: http://stackoverflow.com/comment/38059655
tagged with: bash
has comment: http://stackoverflow.com/comment/38055960
tagged with: ubuntu-12.04
has comment: http://stackoverflow.com/comment/38059547
has body: I have created A GUI using java and netbeans IDE, in that java code i have set value of a variable path which consists of path of directory such as path=/home/usr/jai/newfolder and i have a shell script file with extension .sh in that a command is mentioned which access many files mentioned in newfolder. My question is how to use path variable in that shell script file so that I can access all those files mention in newfolder and execute that file using java code and I know how to execute script file using java code but I am unable to access the variable value in shell script file.
type: UnansweredQuestion
has title: How to access a variable value in shell script file from java code written using netbeans
upvote count: 1
has comment: http://stackoverflow.com/comment/38055815
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24568772
type: Question

http://stackoverflow.com/a/24456847
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24456624
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24456624
downvote count: 0
has body: Iterating all the digits from right to left is easy enough - you just keep dividing by 10 and keeping the remainder. Since you need to print them from left to right, but there don't seem to be any constraint on the memory usage, you could just keep them in a list, and print it backwards: int num = ...; // inputed from user List&lt;Integer&gt; digits = new LinkedList&lt;&gt;(); int sum = 0; // Extract the digits and the sum while (num != 0) { int digit = num % 10; digits.add (digit); sum += digit; num /= 10; } // Print backwards: System.out.print ("The digits are: "); for (int i = digits.size() - 1; i &gt;= 0; --i) { System.out.print (digits.get(i) + " "); } System.out.println(); System.out.println("Their sum is: " + sum);
type: Answer

http://stackoverflow.com/q/24495504
has comment: http://stackoverflow.com/comment/37923109
accepted answer: http://stackoverflow.com/a/24513342
has title: Unable tp read zipfile using Apache Tika
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip
has body: i am using Apache Tika 1.5 for parsing the contents present in a zip file, here's my sample code Parser parser = new AutoDetectParser(); ParseContext context = new ParseContext(); context.set(Parser.class, parser); ContentHandler handler = new DefaultHandler(); Metadata metadata = new Metadata(); InputStream stream = null; try { stream = TikaInputStream.get(new File(zipFilePath)); } catch (FileNotFoundException e) { e.printStackTrace(); } try { parser.parse(stream, handler, metadata, context); logger.info("Content:\t" + handler.toString()); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (TikaException e) { e.printStackTrace(); } finally { try { stream.close(); } catch (IOException e) { e.printStackTrace(); } } in the logger statement all i see is org.xml.sax.helpers.DefaultHandler@5bd8e367 i am missing something, unable to figure it out, looking for some help
upvote count: 1
type: Question
tagged with: apache-tika
has answer: http://stackoverflow.com/a/24513342
score: 1
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24527627
answers question: http://stackoverflow.com/q/24526714
has comment: http://stackoverflow.com/comment/37980674
has comment: http://stackoverflow.com/comment/37980852
has comment: http://stackoverflow.com/comment/37979545
type: Answer
has comment: http://stackoverflow.com/comment/37979473
has body: i think problem is LinearLayout LinearLayout mainLayout = (LinearLayout)rootView.findViewById(R.layout.fragment_main); you are finding rootView.findViewById(R.layout.fragment_main) its layout ID not linearLayout it should like R.id.linearlayout(whatever your layout ID) EDIT 1 do like this RelativeLayout mainLayout = (RelativeLayout)rootView.findViewById(R.id.fragment);
has comment: http://stackoverflow.com/comment/37980024
has comment: http://stackoverflow.com/comment/37980801
has comment: http://stackoverflow.com/comment/37980754
has comment: http://stackoverflow.com/comment/37980702
score: 0

http://stackoverflow.com/comment/38084493
type: AnswerComment
comment on: http://stackoverflow.com/a/24584287
score: 0
type: Comment
has text: @user3717646 `instanceof` checks if the instance is in the inheritance hierarchy of the type, so it will work just the same

http://stackoverflow.com/comment/37992861
has text: URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits. So % is like a reserved character for url.
score: 0
comment on: http://stackoverflow.com/q/24535091
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24501520
type: Question
type: AnsweredQuestion
has title: Does restlet support ContainerResponseFilter on GAE?
favorite count: 0
tagged with: google-app-engine
score: 0
has answer: http://stackoverflow.com/a/24542432
upvote count: 1
downvote count: 1
tagged with: java
has body: Reslet 2.2.1 for GAE does not include ContainerResponseFilter (or more generally javax.ws.rs.container.*). How do I implement such a filter in this environment? Or is there another work-around to add access-control headers (can be a temporary kludge)?
accepted answer: http://stackoverflow.com/a/24542432
answer count: 1
tagged with: restlet

http://stackoverflow.com/comment/38914783
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24571177
type: QuestionComment
has text: Surprised to not see any workaround for this on Android. I see conflicting information about whether any cookie with the httpOnly flag would even be constrained by the Android browsers even if you managed to get the flag set (from the server or via the client). Google's own [browser security doc](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_cookies) lists Android as the only platform not supporting httpOnly, but I'm not sure how dated that table is.

http://stackoverflow.com/q/24587908
tagged with: builder
upvote count: 2
tagged with: multithreading
answer count: 2
has comment: http://stackoverflow.com/comment/38091158
accepted answer: http://stackoverflow.com/a/24587944
tagged with: java
has comment: http://stackoverflow.com/comment/38091144
score: 2
type: AnsweredQuestion
has body: I have a static "Builder" class inside a class called "MyClass". If I try to create two instances of MyClass using the builder simultaneously from two threads, will it be safe ? Can values set by one thread be assigned to object created by another thread ? Code: public class MyClass { private int height; private int weight; private MyClass(Builder builder) { height = builder.height; weight = builder.weight; } public static class Builder { private int height; private int weight; public Builder height(int h) { height = h; return this; } public Builder weight(int w) { weight = w; return this; } public MyClass build() { return new MyClass(this); } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/38091157
favorite count: 0
possible better answer: http://stackoverflow.com/a/24588096
has title: Static nested class thread safety - java
has answer: http://stackoverflow.com/a/24588096
type: Question
has answer: http://stackoverflow.com/a/24587944

http://stackoverflow.com/comment/37961555
has text: You can do it, but you'll need some second parameter to distinguish the overloads. At that point, you might just want to make the two parameters `x` and `y`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24518328
score: 1

http://stackoverflow.com/a/24578785
has comment: http://stackoverflow.com/comment/38125270
has comment: http://stackoverflow.com/comment/38370905
has comment: http://stackoverflow.com/comment/38132298
has comment: http://stackoverflow.com/comment/38130091
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24548296
has comment: http://stackoverflow.com/comment/38367665
type: Answer
upvote count: 1
has body: You're using JAVA V2 sample app. V2 APIs are deprecated and you can't access Global company's data using V2. Please use the V3 sample app Ref - https://github.com/IntuitDeveloperRelations/QuickbooksV3API-Java Setup instruction is available here - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/sample_code/spring_sample_app_for_quickbooksapi/0002_creating_the_app Maven command - mvn install:install-file -DgroupId=com.intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.3.1 -Dpackaging=jar -Dfile=&lt;JarFilePath&gt;\ipp-v3-java-devkit-2.3.1-jar-with-dependencies.jar PN - If required please change the version number according to the devkit version you have. Latest devkit is available here - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits Re - Qts on Push notification As of now, this service is not available in production. There are couple of existing solutions which you should find out after doing a bit googling. Imp - You should not use the deprecated V2 app. Thanks
has comment: http://stackoverflow.com/comment/38130654

http://stackoverflow.com/comment/37998428
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24538046
has text: You should probably be using `||` for an OR instead of `|`.

http://stackoverflow.com/comment/38003751
score: 0
type: Comment
type: QuestionComment
has text: Did you try hsv.scrollTo(hsv.getMaxScrollAmount()/2, 0); ?
comment on: http://stackoverflow.com/q/24540666

http://stackoverflow.com/a/24491263
type: AcceptedAnswer
has body: Set custom renderer for target column: table.getColumnModel().getColumn(COLUMN_INDEX).setCellRenderer(new PriorityCellRenderer()); in getTableCellRendererComponent() validate column index if(column == COLUMN_INDEX)
type: Answer
has comment: http://stackoverflow.com/comment/37923996
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/37917248
accepted answer of: http://stackoverflow.com/q/24491182
score: 5
answers question: http://stackoverflow.com/q/24491182

http://stackoverflow.com/a/24434677
has comment: http://stackoverflow.com/comment/37830225
type: AcceptedAnswer
downvote count: 0
has body: Unfortunately you cannot do that in general. What you saw was the try-with-resources functionality of Java 7. public class MyClose implements AutoCloseable { @Override public void close() { } } Fine: try (MyClass x = new MyClass()) { ... } // Automatic close Fine too: MyClass x = null;+ try { x = new MyClass(); ... } finally { x.close(); } Warning: MyClass x = new MyClass(); ... It is the AutoCloseable that leads the IDE to attend for a missing close()/try. One of the reasons is that clicking on the warning probably proposes to repair it with a try-with-resources (in some IDEs). However there is a code design pattern class ServiceBaseClass { protected Z z; protected YourBaseClass() { } public final void process(X x) { z = ...; ... f(x, y); ... g(x); } protected void f(X x, Y y) { } protected void g(X x) { ... z ... } } Here one lets the child class implement (override) f and g - the requirements -, and takes care that the process logic is done oneself, in a public final process - the service -.
accepted answer of: http://stackoverflow.com/q/24434071
answers question: http://stackoverflow.com/q/24434071
has comment: http://stackoverflow.com/comment/37828996
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/24502394
possible better answer: http://stackoverflow.com/a/41105736
has answer: http://stackoverflow.com/a/41105736
downvote count: 1
accepted answer: http://stackoverflow.com/a/24502482
type: AnsweredQuestion
tagged with: android-fragments
has answer: http://stackoverflow.com/a/24502542
has comment: http://stackoverflow.com/comment/37933427
score: 49
tagged with: java
linked to: http://stackoverflow.com/q/36347429
type: Question
linked to: http://stackoverflow.com/q/1910194
favorite count: 0
has answer: http://stackoverflow.com/a/24502482
answer count: 3
has body: I have a method sendData() in my fragment. This method starts a new Activity. I want to call this method from my ArrayAdapter. Here is my code:- HomeFragment.java stagAdaper = new StaggeredAdapter(myContext, android.R.layout.simple_list_item_1, getList); mGridView.setAdapter(stagAdaper); private void sendData(int position) { myDialog = new ProgressDialog(myContext).show(getActivity(), "Fetching news..", "Just a moment"); myDialog.getWindow().setContentView(R.layout.openarticlewaitprogress); myDialog.getWindow().setTitle("Loading.."); myDialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); new NewsDetails(myDialog); Intent nIntent = new Intent(getActivity(),Details.class); String Body=getList.get(position).getBody(); newsIntent.putExtra("Body", Body); startActivity(nIntent); } StaggeredAdapter.java viewHolder.layGridLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //viewHolder.layGridLayout.setForeground(R.drawable.foreground_selector); } }); return convertView; } How can I do it?
linked to: http://stackoverflow.com/q/24081101
tagged with: android
has title: Call a Fragment method from an Adapter
upvote count: 50

http://stackoverflow.com/comment/37816983
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24434650
has text: @Erhun yes I'm sure, I can post the relevant part tomorrow. I'll add the OS as well.

http://stackoverflow.com/q/24520562
has comment: http://stackoverflow.com/comment/37968271
type: Question
has comment: http://stackoverflow.com/comment/37985286
answer count: 1
downvote count: 0
has title: How to pass user name or user ip adress on jdbc connection?
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has body: i have oracle users database. System has users on LDAP. And i want to keep user's log when user insert/update/delete. But how to pass user name or user ip and user password to oracle on jdbc connection? i use weblogic. And system connection with just one user and password. This user is setting on weblogic generic data source. my jdbc connection class is public class DBFactory { private static javax.sql.DataSource dataSource = null; public static Connection getConnection(String user, String password) { Connection connection = null; try { if (dataSource == null) { //weblogic app server javax.naming.InitialContext ctx = new javax.naming.InitialContext(); dataSource = (javax.sql.DataSource) ctx.lookup("jdbc/XXXX"); } connection=dataSource.getConnection(); Statement statement = connection.createStatement(); statement.execute("ALTER SESSION SET NLS_SORT=XTURKISH_AI"); statement.execute("ALTER SESSION SET NLS_COMP=LINGUISTIC"); statement.close(); return connection; } catch (Exception ex) { throw new DBFactoryException(ex.getMessage()); } } what can i do? or another solution?
tagged with: jdbc
has answer: http://stackoverflow.com/a/24558049
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24474984
upvote count: 2
has comment: http://stackoverflow.com/comment/37882537
type: Answer
accepted answer of: http://stackoverflow.com/q/24474905
answers question: http://stackoverflow.com/q/24474905
has comment: http://stackoverflow.com/comment/37881742
has comment: http://stackoverflow.com/comment/37881858
has comment: http://stackoverflow.com/comment/37881706
has comment: http://stackoverflow.com/comment/37882451
score: 2
type: AcceptedAnswer
downvote count: 0
has body: You're trying to access variables outside the scope they're declared in. You have to declare the variables outside the do so you can access them in the while: double roomLength; double roomWidth; double roomHeight; do { Scanner dimensionsInput = new Scanner(System.in); System.out.print("Please enter the dimensions of the room, length, width and height accordingly"); roomLength = dimensionsInput.nextDouble(); roomWidth = dimensionsInput.nextDouble(); roomHeight = dimensionsInput.nextDouble(); Room r = new Room(roomName, roomLength, roomWidth, roomHeight); } while (roomLength &gt; 0 || roomWidth &gt; 0 || roomHeight &gt; 0); But I see now that Room is also declared with the wrong scope. You have to declare it before the loop if you want to access it afterwards. So a simpler solution might be: Room r; do { Scanner dimensionsInput = new Scanner(System.in); System.out.print("Please enter the dimensions of the room, length, width and height accordingly"); double roomLength = dimensionsInput.nextDouble(); double roomWidth = dimensionsInput.nextDouble(); double roomHeight = dimensionsInput.nextDouble(); r = new Room(roomName, roomLength, roomWidth, roomHeight); } while (r.getLength() &gt; 0 || r.getWidth() &gt; 0 || r.getHeight() &gt; 0); Incidentally, it doesn't seem right that you're looping until all dimensions are 0. I suspect you mean to check == 0.
has comment: http://stackoverflow.com/comment/37881775

http://stackoverflow.com/q/24567082
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/38058970
tagged with: swing
has title: JLabel does not show value from another class
has comment: http://stackoverflow.com/comment/38059390
has comment: http://stackoverflow.com/comment/38054159
has comment: http://stackoverflow.com/comment/38060876
has body: I have two GUI classes. When I click a row in JTable in the first user interface, the second interface should display the corresponding values in JLabels. But the second user interface does not show the values. Here's my first GUI class: public class ChequeGUI extends JFrame { public String chqNo; public String payName; public double chkAmount = 10; public Date chkDate; JTable guiTable = new JTable(); DefaultTableModel model = new DefaultTableModel(new Object[][]{},new String[]{"Cheque Number","Payee Name","Cheque Amount","Cheque Date"}); public ChequeGUI() throws SQLException { guiTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e){ //guiTable.getTableHeader().getDefaultRenderer(); int row = guiTable.getSelectedRow(); chqNo = (String) guiTable.getValueAt(row,0); payName = (String) guiTable.getValueAt(row,1); chkAmount = (Double) guiTable.getValueAt(row,2); chkDate = (Date) guiTable.getValueAt(row, 3); try { PrintChequeGUI pcg = new PrintChequeGUI(); pcg.setTitle("Print Cheque"); pcg.setVisible(true); System.out.println(chqNo); System.out.println(payName); System.out.println(chkAmount); System.out.println(chkDate); } catch (Exception ex) { ex.printStackTrace(); } } }); guiTable.setModel(model); add(new JScrollPane(guiTable)); DBConnection connection = new DBConnection(); //Populate Table ChequeDAOImpl chqdi = new ChequeDAOImpl(); chqdi.setConnection(connection); List&lt;Cheque&gt; cheques = chqdi.getCheques(); for(Cheque cq : cheques){ model.addRow(new Object[]{cq.getChqNum(), cq.getName(),cq.getAmount(),cq.getDate()}); } } } This is my second GUI class: public class PrintChequeGUI extends JFrame { private JPanel contentPane; private JTextField txtAmount; /** * Create the frame. * @throws SQLException */ public PrintChequeGUI() throws SQLException { setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 480, 400); contentPane = new JPanel(); contentPane.setBackground(new Color(176, 224, 230)); contentP…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38058739
has comment: http://stackoverflow.com/comment/38059423
tagged with: java
has comment: http://stackoverflow.com/comment/38059558
type: Question
has answer: http://stackoverflow.com/a/24570750
answer count: 1
favorite count: 0
tagged with: jlabel
accepted answer: http://stackoverflow.com/a/24570750

http://stackoverflow.com/comment/37985327
has text: Got it, thanks a lot. Had to tweak it somewhat - in the if statement I had to make "out" accept displayTs as opposed to elapsed.
score: 0
comment on: http://stackoverflow.com/a/24528214
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24487363
tagged with: button
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/37905085
has answer: http://stackoverflow.com/a/24497490
favorite count: 0
has comment: http://stackoverflow.com/comment/37985588
has answer: http://stackoverflow.com/a/24531369
has comment: http://stackoverflow.com/comment/37905802
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37905249
has comment: http://stackoverflow.com/comment/37906637
tagged with: twitter-bootstrap
score: 1
upvote count: 1
type: Question
has body: hello i'm using bootstrap 3 in a .jsp page and the button does not work i'm using IE 10 (the browser that i need). this is what is happen: the url change but the page does not this is the button code: <form action="main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>"> this is the url starting page: http://localhost:8090/HTM/main.jsp and this is the targhet page: http://localhost:8090/HTM/main.jsp#dettaglio_ticket.jsp?ticket=11111 so, is there a better way to do this? also i tryed this two codes: <button action="main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>" type="button" class="fa fa-arrow-circle-right btn btn-primary btn-sm"> <a class="btn btn-primary fa fa-arrow-circle-right" href='main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>'>Link and none of this one works, a parte the first one (the one the form syntax that works only on chrome, but i need IE 10) thanks in advice now i'm trying this five different syntax: 1) <form action="main.jsp#dettaglio_ticket.jsp?ticket= <%=ticketL.get(x).id_ticket%>"> 2) <button action="main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>" type="button" class="fa fa-arrow-circle-right btn btn-primary btn-sm"> 3) <a class="btn btn-primary fa fa-arrow-circle-right" href='main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>'>Link 4) <input TYPE="button" VALUE="Home Page" onclick="window.location.href='main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>'"> 5) <input TYPE="button" VALUE="Home Page" onclick="window.location.href='main.jsp#dettaglio_ticket.jsp?ticket=<%=ticketL.get(x).id_ticket%>'"> this is the starting page: http://it.tinypic.com/view.php?pic=200tips&s=8#.U7E71fl_sTQ if i press the buttons numbers 1 and 2 nothing happens, if i press the buttons number 3 and 4 and 5 the url changes but nothing else happens: http://it.tinypic.com/view.php?pic=2zyvqet&s=8#.U7E78Pl_sTQ
has comment: http://stackoverflow.com/comment/37905663
has title: bootstrap 3, the button does not work on IE (java) (.jsp)
tagged with: java
has comment: http://stackoverflow.com/comment/37905146
has comment: http://stackoverflow.com/comment/37905279
answer count: 2

http://stackoverflow.com/comment/38121698
score: 0
type: Comment
has text: I am not experienced with WCF in particular. Seems that there's something wrong on the server side, server settings. Make a simple servlet to check your POST request as I mentioned in previous comment, to be sure.
type: AnswerComment
comment on: http://stackoverflow.com/a/24602307

http://stackoverflow.com/comment/99060625
score: 2
comment on: http://stackoverflow.com/a/31671289
has text: @AJW The simplest way is to initialize the listener early and pass it as argument to the Adapter constructor and then the ViewHolder constructor.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37823006
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24441346
has text: @user3781123 - welcome to SO. If you like the answer give it an upvote or click the checkbox.
type: Comment

http://stackoverflow.com/q/24444573
tagged with: mysql
type: Question
score: 2
has comment: http://stackoverflow.com/comment/37829855
accepted answer: http://stackoverflow.com/a/24495497
downvote count: 0
tagged with: google-cloud-sql
has title: Dedicated MySql server works with app engine
answer count: 1
favorite count: 0
has body: I know AppEngine application runs in a restricted "sandbox" environment so that it can access limited resources like request execution time limit 60 sec (which is for speed optimization purpose) read from external file but can not write ,etc AppEngine provides a good high replication Datastore ,which is so good to store data but it is hard to mange number of quires to perform simple operation like insert, update, delete and update as it uses NoSql(basically jpa and jdo). Because of this we decide to go with Mysql,I know google itself provide cloud sql instance which uses Mysql5.6 ,I searched alot on SO and in some post I found that it is possible with some restriction while some post says it is not possible because of limitation of sandbox environment,so it is confusing . During development one can use local mysql instance as detail provide on this link ,but we want to use External mysql instance which is hosted on ourserver It possible use Dedicated (External/Local) MySql server with app engine(for production not for development)? thanks in advance!!!!!!
upvote count: 2
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24495497
has comment: http://stackoverflow.com/comment/37839284
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37830911
has comment: http://stackoverflow.com/comment/37828532
tagged with: java

http://stackoverflow.com/comment/38022981
type: QuestionComment
comment on: http://stackoverflow.com/q/24545906
score: 0
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). That might solve the problem. If not, it should provide more information as to the reason it failed. 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: Comment

http://stackoverflow.com/q/24460915
tagged with: apache-poi
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37858106
has title: Java failed to read in data from evaluated excel formula using apache poi
answer count: 0
has comment: http://stackoverflow.com/comment/37855095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37974699
has body: I want to use excel to calculate the cdf of normal distribution by input x into excel and read the output of cdf(x) from excel. The excel can be created and calculated correctly. However java cannot read the result from excel correctly. Here are the relevant code: private double cdfxls1(double x) throws IOException{ double cdf=0; HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("1"); HSSFRow row = sheet.createRow(0); HSSFCell input = row.createCell(0); input.setCellValue(x); HSSFCell output = row.createCell(1); output.setCellFormula("NORMDIST(A1,0,1,1)"); wb.setForceFormulaRecalculation(true); /* Using the FormulaEvaluator, still doesn't work Cell tempoutput=row.getCell(1); tempoutput.setCellType(Cell.CELL_TYPE_NUMERIC); FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); evaluator.evaluateInCell(tempoutput); evaluator.evaluateFormulaCell(tempoutput); System.out.println("tempoutput "+tempoutput.getNumericCellValue()); System.out.println("output "+output.getNumericCellValue()); */ //Using evaluateall, doesn't work either // HSSFFormulaEvaluator.evaluateAllFormulaCells(wb); FileOutputStream fileOut = new FileOutputStream("cdf_cal.xls"); wb.write(fileOut); fileOut.close(); cdf=output.getNumericCellValue(); return cdf; } I tried three methods for recalculating the formula. However, none of them worked. I also tried close and reopen the excel. It doesn't work as well. I also tried to use '.csv' as output file instead of '.xls'. It doesn't work either and the cell in csv file contains the formula. When I opened the spreadsheet created, the formula and value are all correct. However, the java can only output 0, the initial value, to me. Update: The error message shows: Caused by: org.apache.poi.ss.formula.eval.NotImplementedException: NORMDIST at org.apache.poi.ss.formula.functions.NotImplementedFunction.evaluate(NotImplementedFunction.java:42) These means the normdist function has not been supported and I need to implement i…
type: Question
tagged with: excel

http://stackoverflow.com/comment/37839865
comment on: http://stackoverflow.com/q/24452689
score: 0
has text: @user11153 how do I get that fixed?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24522151
downvote count: 0
possible better answer: http://stackoverflow.com/a/36128409
tagged with: resize
has comment: http://stackoverflow.com/comment/37968611
has answer: http://stackoverflow.com/a/36128409
has comment: http://stackoverflow.com/comment/37968952
has comment: http://stackoverflow.com/comment/37969162
has body: I have a JLayeredPane within a JFrame, with two JPanels in it. It all works fine, except since the JLayeredPane requires me to have a null Layout, it doesn't resize the two JPanels correctly when the JFrame resizes. public class CreatorUI extends JFrame{ private static final long serialVersionUID = 1L; private JPanel moveablePane = new JPanel(); private Container backgroundPane; private JLayeredPane layers = new JLayeredPane(); private ComponentMover componentMover = new ComponentMover(); private ComponentResizer componentResizer = new ComponentResizer(); public CreatorUI(){ backgroundPane = new BackgroundUI().initComponents(); layers.add(backgroundPane, 1); moveablePane.setLayout(null); componentMover.setAutoLayout(true); moveablePane.setOpaque(false); layers.add(moveablePane, 2); moveablePane.setSize(backgroundPane.getSize()); add(layers, BorderLayout.CENTER); layers.setPreferredSize(backgroundPane.getPreferredSize()); pack(); } public void addWindow(WindowComponent window){ this.componentMover.registerComponent(window); this.componentResizer.registerComponent(window); this.componentMover.setDragInsets(this.componentResizer.getDragInsets()); this.moveablePane.add(window); } public static void main(String[] args){ CreatorUI frame = new CreatorUI(); frame.addWindow(new MapComponent()); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } This is what it looks like normally (looks perfect for the normal size): This is what it looks like once I've tried to resize the JFrame: I figured out that I can make the top layer resizable if I change my code to this: public CreatorUI(){ componentMover.setAutoLayout(true); backgroundPane = new BackgroundUI().initComponents(); moveablePane.setLayout(null); moveablePane.setOpaque(false); moveablePane.setSize(backgroundPane.getSize()); layers.setLayout(new BorderLayout()); layers.add(backgroundPane, BorderLayout.CENTER); layers.setLayer(backgroundPane, new Integer(1)); layers.add(moveablePa…
has answer: http://stackoverflow.com/a/24522913
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37969539
linked to: http://stackoverflow.com/q/1097366
has comment: http://stackoverflow.com/comment/37969152
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37969559
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24522913
tagged with: java
has title: JLayeredPane not resizing with JFrame
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37969399

http://stackoverflow.com/a/24513113
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/24462757
score: 8
has body: As every one else has mentioned, the primary benefit of JTA is not the single transaction case, but the orchestration of multiple transactions. Your "Transactional File" is an excellent, conceptual, example when used in the proper context. Consider a contrived use case. You're uploading a picture that has associate meta data and you want to then alert the infrastructure that the file as arrived. This "simple" task is fraught with reliability issues. For example, this workflow: String pathName = saveUploadedFile(myFile); saveMetaData(myFile.size(), myFile.type(), currentUser, pathName); queueMessageToJMS(new FileArrivalEvent(user, pathName); That bit of code involves the file system and 2 different servers (DB and JMS). If the saveUploadedFile succeeds, but the saveMetaData does not, you now have a orphaned file on the file system, a "file leak" so to speak. If the saveMetaData succeeds, but the queue does not, you have saved the file, but "nobody knows about it". The success of the transaction relies upon all 3 components successfully performing their tasks. Now, throw in JTA (not real code): beginWork(); try { String pathName = saveUploadedFile(myFile); saveMetaData(myFile.size(), myFile.type(), currentUser, pathName); queueMessageToJMS(new FileArrivalEvent(user, pathName); } catch(Exception e) { rollbackWork(); } finally { commitWork(); } Now it "all works", or "none of it works". Normally folks jump through hoops to make this kind of thing work safely, since most systems do not have transaction managers. But with a transaction manager (i.e. JTA), you the TM manages all of the hoops for you, and you get to keep your code clean. If you survey the industry you will find very few transaction managers. Originally they were proprietary programs used by "Enterprise" grade systems. TIBCO is a famous one, IBM has one, Microsoft has one. Tuxedo used to be popular. But with Java, and JTA, and the ubiquitous Java EE (etc) servers "everyone" has a transaction manager. We in t…
upvote count: 8

http://stackoverflow.com/comment/37934247
score: 2
comment on: http://stackoverflow.com/q/24503082
type: Comment
type: QuestionComment
has text: Are you using Java 8? If so, google for "default methods". If not, what you want is impossible.

http://stackoverflow.com/comment/38069025
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24575780
has text: I tried both ways: Using Cascades and without: Both return the same exception

http://stackoverflow.com/comment/37947090
type: QuestionComment
comment on: http://stackoverflow.com/q/24510420
score: 0
has text: Sorry. The only requirement is that the characters must be there. I have corrected it in my post as well
type: Comment

http://stackoverflow.com/q/24437736
has body: If I run the following program, the JVM will not terminate after execution. However, if I uncomment the line (// newFixedThreadPool.execute(new Producer3());) from the code, the program terminates after execution. I am aware because of the blocking nature of the queue the program does not terminate. In the context of the below code what part of the code blocks the termination of the JVM? public class LinkedBlockingQueueExample { public static void main(String[] args) { final BlockingQueue&lt;String&gt; blockingQueue = new LinkedBlockingQueue&lt;String&gt;(5); final class Producer implements Runnable { @Override public void run() { try { blockingQueue.put("Joshua"); blockingQueue.put("Bloch"); System.out.println("Put Joshua in the queue"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } final class Producer1 implements Runnable { @Override public void run() { try { blockingQueue.put("Martin"); blockingQueue.put("Fowler"); System.out.println("Put Mr Fowler in the Queue"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } final class Producer3 implements Runnable { @Override public void run() { try { blockingQueue.put("Malcom"); blockingQueue.put("Gladwell"); System.out.println("Put an Outlier in the Queue"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } final class Consumer implements Runnable { @Override public void run() { try { System.out.println(getClass() + " " + blockingQueue.take()); System.out.println(getClass() + " " + blockingQueue.take()); System.out.println(getClass() + " " + blockingQueue.take()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } final class Consumer1 implements Runnable { @Override public void run() { try { System.out.println(getClass() + " " + blockingQueue.take()); System.out.println(getClass() + " " + blockingQueue.take()); System.out.println(g…
type: AnsweredQuestion
has title: LinkedBlockingQueue program does not terminate
tagged with: java
tagged with: collections
has answer: http://stackoverflow.com/a/24437792
type: Question
accepted answer: http://stackoverflow.com/a/24437792
tagged with: blockingqueue
possible better answer: http://stackoverflow.com/a/24509031
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24509031

http://stackoverflow.com/a/24526904
answers question: http://stackoverflow.com/q/24526438
type: Answer
accepted answer of: http://stackoverflow.com/q/24526438
upvote count: 2
has body: Well, since the answer is obvious after the long chat I'd provide the action list that helps to find problem like "my jar does not run". Check the command line. Be sure the classpath is correct. Check the error message. If it complains that jar is corrupted, check jar. If it complains about the class version check JRE version. If it throws ClassNotFoundException or ClassDefNotFoundError check classpath. If it throws NoSuchMethodException or similar check compatibility of your libraries. To check jar file try jar vft your.jar (if you have JDK) or commands like unzip on linux or extract zip file on windows. If this does not work - jar file is corrupted. If jar file runs on one machine and does not run on other check how did you copy the file. First check the file size on both machines. Use ls -l on unix or dir on windows. If files have the same size try to compare them by creating hash. Use md5sum my.jar on linux and tool like WinMd5 on windows. Other possibility is to copy file forward and back and check that it is still ok.
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/38502779
comment on: http://stackoverflow.com/q/24587059
score: 0
type: QuestionComment
has text: Where did you put the log?
type: Comment

http://stackoverflow.com/q/24580927
has comment: http://stackoverflow.com/comment/38078648
has body: I'm a bit novice at Java, so this may be common sense to somebody else... I am trying to write a method that takes an input string of any length and returns a list of every possible variation of the string with at least one "i" removed. For example, the input could be "kikikifiki". The output will be a list containing the word with 0 "i"s removed ("kikikifiki"), each word with one "I" removed ("kikikifik", "kikikifki", etc.), each word with two "I"s removed ("kikikifk", "kikikfik", etc.), and so on. The output may have any amount of "i"s. So far, I came up with something a little like this: String word = /*input goes here; has only a-zA-Z*/; String hypo[] = new String[10000]; String wordOriginal = word; String temp = word; for (int g=0;g&lt;(wordOriginal.replaceAll("[^i]","")).length();g++) { while (word.contains("i")) { for(int j=0; j&lt;numI; j++) { //Test the current prefix with each following 'i' removed. temp = word.substring(0,temp.indexOf("i")+j) + temp.substring(word.indexOf("i")+j+1); hypo[index] = prefix + temp; for (int h=j; h&gt;0; h--) temp = temp.substring(0,temp.indexOf("i")) + temp.substring(temp.indexOf("i")+1); index++; } word = word.substring(0,word.indexOf("i")) + word.substring(word.indexOf("i")+1); temp = word; numI = (word.replaceAll("[^i]","")).length(); } word = wordOriginal; for (int ghj=0;ghj&lt;g;ghj++) prefix = word.substring(0,word.indexOf("i")+1); word = word.substring(word.indexOf("i")+1); temp = word; numI = (word.replaceAll("[^i]","")).length(); } It doesn't quite work, though. I know that I should probably use a list of hypo instead of an array, but I feel like there is more I can do to make this elegant and, well, operative. Any ideas? - EDIT: Somebody suggested that I put the desired output with the actual output. I also added the code below to match my entire code as of yet. INPUT: rifi DESIRED OUTPUT: (not necessarily in this order) rf rif rfi rifi ACTUAL OUTPUT: rf rfi rif rf f - INPUT: kiraiki DESIRED OUTPUT: (not necessarily…
has comment: http://stackoverflow.com/comment/38078736
has comment: http://stackoverflow.com/comment/38078947
has comment: http://stackoverflow.com/comment/38079067
has comment: http://stackoverflow.com/comment/38078868
possible better answer: http://stackoverflow.com/a/24581764
has answer: http://stackoverflow.com/a/24581764
answer count: 3
has comment: http://stackoverflow.com/comment/38079215
tagged with: string
linked to: http://stackoverflow.com/q/14094864
favorite count: 0
has answer: http://stackoverflow.com/a/24581762
has comment: http://stackoverflow.com/comment/38079044
has answer: http://stackoverflow.com/a/24589265
has comment: http://stackoverflow.com/comment/38078894
has title: How to get every possibility of a string with at least one of a certain letter removed
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38079056
has comment: http://stackoverflow.com/comment/38078495
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38079235
accepted answer: http://stackoverflow.com/a/24581762
has comment: http://stackoverflow.com/comment/38078745
downvote count: 1
type: Question
tagged with: combinations

http://stackoverflow.com/q/24546345
has comment: http://stackoverflow.com/comment/38014068
has comment: http://stackoverflow.com/comment/38014618
has comment: http://stackoverflow.com/comment/38014067
downvote count: 0
has title: ClassPathXmlApplicationContext function file not found exception
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/38014295
favorite count: 0
has answer: http://stackoverflow.com/a/24546815
has comment: http://stackoverflow.com/comment/38014080
has comment: http://stackoverflow.com/comment/38014277
type: Question
tagged with: maven
upvote count: 1
has body: I'am working with spring hibernate maven project. Here i got exception dispatcher-servlet.xml file not found. How should i add the path . OR should i add classpath entry in .classpath file? my file is inside web-inf . I have tried ClassPathXmlApplicationContext("WEB-INF/dispatcher-servlet.xml"); ApplicationContext appContext =new ClassPathXmlApplicationContext("dispatcher-servlet.xml"); Please help
answer count: 1
has comment: http://stackoverflow.com/comment/38014097
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/38010904
comment on: http://stackoverflow.com/q/24544197
score: 0
has text: Are you sure that ResultMapWithBLOBs isn't extending the BaseResultMap?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24574719
has comment: http://stackoverflow.com/comment/38127294
type: Answer
has comment: http://stackoverflow.com/comment/38090312
has comment: http://stackoverflow.com/comment/38134207
answers question: http://stackoverflow.com/q/24573460
score: 0
has body: It means that if you send an event, and then during the transaction, the same thread will consume this event and prepare some database changes (the producer and consumer uses the same threat and transaction) all the consumers changes depends on main transaction.

http://stackoverflow.com/a/24455655
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24455622
has body: Are you just doing everything locally? If so, use this tutorial. If you are trying to save to a cloud my favorite I have used is Parse.com.
upvote count: 2
type: Answer

http://stackoverflow.com/comment/38017012
type: Comment
type: QuestionComment
has text: @Jan My problem got resolved. I cleaned up all the tables in the quartz database and it started working. But when I am using two instances it is not actually following a random load balancing the instance which took up the job takes it forever until it is terminated. But it looks fine enough. Anyways thanks for you help.
score: 0
comment on: http://stackoverflow.com/q/24485207

http://stackoverflow.com/comment/38083481
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24583452
has text: Yes. frame.setSize sets the entire frame size, not the inner contentpane size. See modified code above. Layout managers and setPreferredSize is the way to go. Same advice applies for JavaFX.
type: AnswerComment

http://stackoverflow.com/q/24488727
downvote count: 3
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/37907301
has answer: http://stackoverflow.com/a/30738414
has answer: http://stackoverflow.com/a/24488805
has answer: http://stackoverflow.com/a/31341331
has title: What's synchronizes in Java Collection?
tagged with: synchronized
has answer: http://stackoverflow.com/a/24489253
upvote count: 4
linked to: http://stackoverflow.com/q/6045648
has comment: http://stackoverflow.com/comment/37907323
has comment: http://stackoverflow.com/comment/37907709
has answer: http://stackoverflow.com/a/24488771
answer count: 7
favorite count: 0
accepted answer: http://stackoverflow.com/a/24488771
has answer: http://stackoverflow.com/a/43079078
possible better answer: http://stackoverflow.com/a/24489072
has answer: http://stackoverflow.com/a/24489072
has body: I'm trying to figure out what are synchronized on the Java collection framework. But still haven’t got any clear solution. I mean, if we get list Queie Set And on the list ArrayList LinkedList Vector What are the synchronized? If we get HashMap and HashTable we know Hashtable is synchronized on the table while access to the HashMap isn't.
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/37963752
type: QuestionComment
score: 0
has text: What @svenoaks may be trying to say is, extending Thread is a 20th century way of defining your thread's entry point. The 21st century way is to instantiate the naked Thread class, and give it a Runnable delegate. `new Thread(new Runnable() { public void run() { ... }});` The long-term benefit is that it gets you in the habit of using delegation instead of using type inheritance---one step along the path to writing clean, re-useable, maintainable code.
comment on: http://stackoverflow.com/q/24517175
type: Comment

http://stackoverflow.com/a/24457680
has body: When a JSP page is called, the following happens, in this order: Server checks to see if the .jsp has already been compiled and whether or not it has changed since it was last compiled. Server runs the jsp through the Jasper compiler, which interprets the jsp into Java code, anything that is not Java (CSS, HTML, JavaScript, etc) is placed in a String. The Java code is compiled and executed. The results are placed in the response and sent to the user. So, your statement: ${sessionScope.custId} is executed before the the HTML is sent to the user, and the input of selectCustomers() function is already set to before calling it. For more info have a look at my another post JSP inside ListItems onclick How to verify it? Right click in the browser and look at the view source. Try below sample code that might help you. Enclose ${...} inside the single quotes. <c:set var="custId" value="1234" scope="session" /> Before : <c:out value="${sessionScope.custId}"></c:out> <c:set var="custId" value="4321" scope="session" /> After: <c:out value="${sessionScope.custId}"></c:out> View Source code: (Right click in browser to view it) Before : 1234 After: 4321
answers question: http://stackoverflow.com/q/24449784
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24449784

http://stackoverflow.com/q/24533422
favorite count: 0
has comment: http://stackoverflow.com/comment/37989573
tagged with: android
has comment: http://stackoverflow.com/comment/37989702
has body: I want to order 5 button in the bottom of the screen that will with equal space all over the bottom of the screen (app). is there an command that will do it no matter the screen size? basically I need to divided the screen at 5 &amp; put the button in place. I tried to do it custom button but it's look different from one screen to another. thank you for your help.
type: UnansweredQuestion
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24533598
type: Question
has title: order button in android
score: -2
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/37841164
comment on: http://stackoverflow.com/q/24452949
score: 0
has text: While using Jasper Reports within your application, some libraries are required. Are you including jasperreports-fonts jar ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24428688
has title: Is it safe to use scala singleton in java web application containers?
type: UnansweredQuestion
tagged with: singleton
tagged with: scala
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24428885
score: 0
answer count: 1
has body: I know that using static singleton like that (see code below) often lead to memory leak. public class Singleton { private static Singleton instance = new Singleton(); public static Singleton getInstance() { return instance; } private Singleton() { } } I do n't know many details, but somewhere I read that static variables contains link to classloader and that's why they often do not removed by garbage collector. But scala singleton are converted to static variables in bytecode. So is it safe to use scala singleton objects in java web application container?

http://stackoverflow.com/comment/37870433
type: QuestionComment
comment on: http://stackoverflow.com/q/24468902
score: 0
type: Comment
has text: What happens when you run the same line in command prompt?

http://stackoverflow.com/comment/90474794
comment on: http://stackoverflow.com/a/38330184
score: 4
type: AnswerComment
type: Comment
has text: By calling `JUnitCore.runClasses()` without inspecting the result, you risk masking the errors from the inner test. `assert(JUnitCore.runClasses(TestMockitoJUnitRunner.class).wasSuccessful());` will at least report the error to you

http://stackoverflow.com/comment/37798702
score: 0
type: Comment
has text: I tried `KnowledgeBuilder` way also. I am getting exception. Updated my question.
comment on: http://stackoverflow.com/a/24429916
type: AnswerComment

http://stackoverflow.com/comment/60607591
type: Comment
has text: See also http://stackoverflow.com/questions/28494203/blocked-thread-while-executing-oracle-procedure-from-java-class
type: QuestionComment
comment on: http://stackoverflow.com/q/24443742
score: 0

http://stackoverflow.com/comment/81149384
type: Comment
comment on: http://stackoverflow.com/a/47097450
score: 0
type: AnswerComment
has text: The question is tagged with [tag:android-studio] an answer about Netbeans doesn't answer it.

http://stackoverflow.com/comment/37909531
type: Comment
has text: I try to ping to the server but it not works. However, it works with my browser.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24489752

http://stackoverflow.com/comment/37806951
comment on: http://stackoverflow.com/a/24434444
score: 0
type: Comment
has text: If you mean if there is a way to store a runtime volatile value of a variable outside the runtime and without a permanent storage the answer is no. And the question makes no sense because you want to store a variable without storing it. Every time you run a java program and set variables in your objects, when the java program ends those variables are wiped out.
type: AnswerComment

http://stackoverflow.com/comment/37943143
comment on: http://stackoverflow.com/q/24500958
type: QuestionComment
score: 0
has text: It needs the whole path to the file and not just the file name.
type: Comment

http://stackoverflow.com/q/24555692
has title: How can I run a Java class inside a Maven artifact, automatically resolving dependencies?
possible better answer: http://stackoverflow.com/a/27210675
has answer: http://stackoverflow.com/a/27210675
tagged with: dependencies
has comment: http://stackoverflow.com/comment/38271585
favorite count: 0
linked to: http://stackoverflow.com/q/1895492
has answer: http://stackoverflow.com/a/27304895
answer count: 5
has body: If I know the coordinates of an artifact, and a name of the class inside that artifact, can I make Maven run the class, including all of its dependencies on the Java classpath? For example, suppose a coworker told me about a tool I can run, which is published to our internal Nexus with the artifact coordinates example:cool-tools:1.0.0. I used this answer to download the artifact. Now, I know that the main class name is example.Main. But if I just go to the artifact's download location and run java -cp cool-tools-1.0.0.jar example.Main, I get NoClassDefFoundErrors for any dependencies of cool-tools. I'm aware of the maven-exec-plugin, but as far as I can tell that's only for projects where you have the source. Suppose I don't have access to the source, only the Nexus containing the tool (and all its dependencies). Ideally, I'd do something like mvn exec:exec -DmainArtifact='example:cool-tools:1.0.0' -DmainClass='example.Main', but I don't think the exec plugin is actually capable of this. ETA: To be clear, I do not have a local project / POM. I want to do this using only the command line, without writing a POM, if possible.
has comment: http://stackoverflow.com/comment/38272494
tagged with: maven
linked to: http://stackoverflow.com/q/2943404
has answer: http://stackoverflow.com/a/27217659
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/38271482
upvote count: 7
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38034191
has answer: http://stackoverflow.com/a/27300358
has comment: http://stackoverflow.com/comment/38034902
has answer: http://stackoverflow.com/a/47473869
has comment: http://stackoverflow.com/comment/38058583
accepted answer: http://stackoverflow.com/a/27217659
score: 6

http://stackoverflow.com/q/24521830
tagged with: text
score: 2
type: AnsweredQuestion
has title: How to convert an InputStream() to a Scanner() Java
has body: I am working on an android app so I need to use an InputStream() to read a txt file but I also have several methods that only work with Scanner() so I need a way to convert InputStream() to Scanner(). Thanks in advance.
upvote count: 3
tagged with: file
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9780213
tagged with: java
tagged with: inputstream
duplicate of: http://stackoverflow.com/q/9780213
has answer: http://stackoverflow.com/a/24521844
answer count: 1
accepted answer: http://stackoverflow.com/a/24521844
favorite count: 0

http://stackoverflow.com/a/24525897
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37976909
has body: -fx-background-color is a valid JavaFX attribute, but background-color is not (so don't use it). Only the CSS attributes which are defined in the JavaFX CSS reference guide are valid in JavaFX - you can't use CSS attributes designed for HTML such as background-color.
type: Answer
has comment: http://stackoverflow.com/comment/37977267
answers question: http://stackoverflow.com/q/24525389
downvote count: 0

http://stackoverflow.com/a/24590091
has comment: http://stackoverflow.com/comment/38135528
score: 0
type: AcceptedAnswer
has body: A node in a tree can have a custom icon but most skins have an additional folder like icon next to those nodes in a tree that contain children. I think you mean the Folder icon next to the node disappears when you click on it. If the tree asks the model if it has children and the model returns true then the icon is displayed. When you click on the node and the children are not present the tree removes the icon. This will happen if you did not implement the getChildren and isLeaf method or implemented isLeaf incorrectly. The isLeaf method tells the JTree UI to draw or not draw the folder icon. Also make sure setAsksAllowsChildren() is set the the correct value for your needs and getChildCount() returns the correct value for each node.
type: Answer
accepted answer of: http://stackoverflow.com/q/24573861
answers question: http://stackoverflow.com/q/24573861

http://stackoverflow.com/q/24499500
has title: JavaFX Menu - first letter, underline decoration
upvote count: 15
answer count: 2
has answer: http://stackoverflow.com/a/24500058
downvote count: 0
linked to: http://stackoverflow.com/q/12710468
has comment: http://stackoverflow.com/comment/37927961
favorite count: 0
type: AnsweredQuestion
has body: Following the UI standards: If application menu item (on the top menu bar) opens a dropdown, it MUST be decorated as it is shown under: The first letter has "text-decoration:underline" property. But accoring to this http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html I can't do like that in in javafx app. Any suggestions?
accepted answer: http://stackoverflow.com/a/24500058
possible better answer: http://stackoverflow.com/a/79307670
has comment: http://stackoverflow.com/comment/37927443
type: Question
has answer: http://stackoverflow.com/a/79307670
tagged with: standards
tagged with: java
tagged with: javafx
score: 15

http://stackoverflow.com/comment/37900372
type: Comment
type: QuestionComment
has text: Make an `List` of shapes in the `Tetris` class that contains all shapes that are finished falling. After a shape falls add it to the finished array. You will likely need this array for collision checking anyway.
score: 1
comment on: http://stackoverflow.com/q/24484772

http://stackoverflow.com/comment/38012035
type: QuestionComment
comment on: http://stackoverflow.com/q/24545089
has text: Just "generate" the key bytes as you wish and use `SecretKeySpec` directly. You *can* implement your own `SecureRandom` and pass it into the `KeyGenerator` but you have no real control on how the key generator uses that random object and how many random bytes it takes out of it to generate a key.
score: 0
type: Comment

http://stackoverflow.com/comment/37832540
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24448604
type: Comment
has text: Okay, thanks. I just tried it with another enum. How would I do this? Like INSTANCE(myEnum); ?

http://stackoverflow.com/comment/37887861
comment on: http://stackoverflow.com/q/24478376
score: 0
type: QuestionComment
type: Comment
has text: Install java,download eclipse ,install ADT from Help,Download SDK, but what is your mean about " its seems not to work " ?

http://stackoverflow.com/comment/37928462
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24499870
type: AnswerComment
has text: Better yet, use the primary Ethernet adapter's MAC address. It seems to be a popular hardware reference lately. Not sure how you get it though.

http://stackoverflow.com/comment/37799381
has text: I already fix like @PratikButani said. And there's no error.But its still not working. Its still print $$$Italian.
comment on: http://stackoverflow.com/a/24430711
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24523980
score: 0
has body: Looks like intention is to loop on the array and append "," except for last entry. Below should work Need to check for boundary condition as well for(int i=0; i&lt;params.length; i++) { if(params[i] != null) { System.out.print(params[i].getType()+ " " +params[i].getName()); if(i != params.length-1) System.out.print(", "); } }
type: Answer
answers question: http://stackoverflow.com/q/24523849

dll
tags question: http://stackoverflow.com/q/24448597
tags question: http://stackoverflow.com/q/24433202
tags question: http://stackoverflow.com/q/24481260
type: Tag
tags question: http://stackoverflow.com/q/24555951
tags question: http://stackoverflow.com/q/24436291
tag name: dll
tags question: http://stackoverflow.com/q/24448500

http://stackoverflow.com/a/24493463
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24493276
upvote count: 3
answers question: http://stackoverflow.com/q/24493276
has body: If you look at the byte code, then you'll see that Inner keeps a hidden reference to Outer which is automatically generated by the Java compiler. So as long as oi can be referenced, otr can be referenced as well. Now you might think that an optimization step could get rid the hidden reference to Outer since Inner never uses it. But someone could extend Inner and try to access Outer from there, so the compiler can't make such assumptions.
type: Answer
score: 3

http://stackoverflow.com/comment/37919435
type: AnswerComment
score: 0
type: Comment
has text: Actually, eliminated the `if (f != null)` lines of code allowed my test to pass. I'm not sure I understand this.
comment on: http://stackoverflow.com/a/24494715

http://stackoverflow.com/q/24583766
has title: Insert multiple objects as instance variable in hibernate
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/24583888
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24583878
has body: Please help me to understand why multiple Objects as instance variable insertion is not woking. Professor.java @Entity public class Professor { @Id private long id; private String name; @Embedded private Courses daycourse; @Embedded @AttributeOverrides({ @AttributeOverride(name="code",column=@Column(name="eve_code")), @AttributeOverride(name="desc",column=@Column(name="eve_desc"))}) private Courses evecourse; // gettter and setters } Courses.java @Embeddable public class Courses { private String code; private String desc; // gettter and setters } Main.java Professor prof = new Professor(); prof.setId(1); prof.setName("leo"); Courses evecourse = new Courses(); evecourse.setCode("MCA"); evecourse.setDesc("Desc"); Courses daycourse = new Courses(); daycourse.setCode("MSC"); daycourse.setDesc("Desc"); prof.setEvecourse(evecourse); prof.setDaycourse(daycourse); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(prof); session.getTransaction().commit(); session.close(); Output : Hibernate: create table Professor ( id number(19,0) not null, code varchar2(255), desc varchar2(255), eve_code varchar2(255), eve_desc varchar2(255), name varchar2(255), primary key (id) ) Hibernate: insert into Professor (code, desc, eve_code, eve_desc, name, id) values (?, ?, ?, ?, ?, ?) Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 1747, SQLState: 42000 Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: ORA-01747: invalid user.table.column, table.column, or column specification Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release INFO: HHH000010: On release of batch it still contained JDBC statements Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123) at org.hibern…
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/24583878
type: Question
has answer: http://stackoverflow.com/a/24583888
answer count: 2
downvote count: 0

http://stackoverflow.com/q/24542272
accepted answer: http://stackoverflow.com/a/24578281
has body: My program displays image gallery, unfortunatelly it loads everything at once. I am looking for suggestions to implement a method to load an image and release previous loaded image once user clicks next button. Updates version where I changed to JApplet and changed the way paint method is called. However it still does not solve an issue with memory usage. Any help would be highly appriciated! import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.swing.JApplet; public class JAppletGallery extends JApplet implements ActionListener { private Button first; private Button previous; private Button next; private Button last; static int total = 400; // initial total total images int imageIndex = 0; // current image // gets folder's location String folderName = "/Users/Martynas/Pictures/leicester/"; File folder = new File(folderName); // initialise image object up to its total Image Pictures[] = new Image[total]; static String[] imageName = new String[total]; // constructor public JAppletGallery() { } public void init() { makeGui(); prepareImages(); } private void makeGui() { setBackground(Color.DARK_GRAY); setForeground(Color.WHITE); setLayout(new BorderLayout()); setSize(800, 600); // init buttons first = new Button("First"); first.setForeground(Color.BLACK); previous = new Button("Previous"); previous.setForeground(Color.BLACK); next = new Button("Next"); next.setForeground(Color.BLACK); last = new Button("Last"); last.setForeground(Color.BLACK); // init panel holder Panel btnPanel = new Panel(); btnPanel.add(first); btnPanel.add(previous); btnPanel.add(next); btnPanel.add(last); add(BorderLayout.NORTH, btnPanel); first.addActionListener(this); previous.addActionListener(this); next.addActionListener(this); last.addActionListener(this); } public void drawNext() { imageIndex…
has comment: http://stackoverflow.com/comment/38072946
answer count: 1
tagged with: graphics
tagged with: java
has title: Java Applet: free up Graphics resources
has comment: http://stackoverflow.com/comment/38007631
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24578281
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/38063146
type: Question
has comment: http://stackoverflow.com/comment/38029642
has comment: http://stackoverflow.com/comment/38046924
has comment: http://stackoverflow.com/comment/38015422
upvote count: 2

http://stackoverflow.com/comment/38049815
type: Comment
type: QuestionComment
score: 1
has text: Change from float to double. A float only carries about 6 digits of precision.
comment on: http://stackoverflow.com/q/24565397

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/24495448

http://stackoverflow.com/q/24483998
has title: Jboss: initialize database with data
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: database
tagged with: jboss
score: 0
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/24484446
has body: Since I haven't received an answer to my question. I've decided to try and find a different solution. So, I've got a Java EE application that is deployed on a JBoss server and I'm asking if there's a way to initialize a database with some data, before the user starts interacting with the application. Apparently, a singleton bean that is executed at start-up is a problem (see my other question)

http://stackoverflow.com/comment/45135224
type: AnswerComment
has text: Recently, the Checkstyle team recommends to provide compiled classes, as they use them in an increasing number of checks. Checkstyle still works without, though.
type: Comment
comment on: http://stackoverflow.com/a/24495543
score: 0

http://stackoverflow.com/q/24485468
has answer: http://stackoverflow.com/a/24485755
has title: Why the tab widget is above the content in android?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37901610
has answer: http://stackoverflow.com/a/24485514
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24486870
tagged with: android
has body: Currently I work on a tabhost layout. In most android app the layout is: tab1 | tab 2 ____________ Tab 1 content (if I press on tab1) However, what I would like to achieve is Tab 1 content (if I press on tab1) ____________ tab1 | tab 2 Here is the main xml (backbone of app) : <FrameLayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0" /> <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation="horizontal" /> The tab content layout <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/home" /> The main class: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ctx = this; gs = (MyApp) getApplication(); tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost); tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); tabHost.addTab(tabHost.newTabSpec("main").setIndicator(""),Home.class, null); tabHost.addTab(tabHost.newTabSpec("carpark").setIndicator("",getResources().getDrawable(R.drawable.btn_park)), CarPark.class,null); tabHost.addTab(tabHost.newTabSpec("shop").setIndicator("",getResources().getDrawable(R.drawable.btn_shop)), Shop.class,null); tabHost.getTabWidget().setDividerDrawable(null); tabHost.setCurrentTab(0); } Thanks for helping
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question
tagged with: android-layout

http://stackoverflow.com/comment/38091993
type: QuestionComment
type: Comment
has text: +1 on using gvm. It will take care of updating grails home and the path.
score: 0
comment on: http://stackoverflow.com/q/24577480

http://stackoverflow.com/q/24533419
answer count: 3
tagged with: sql
linked to: http://stackoverflow.com/q/470542
type: UnansweredQuestion
has body: I am doing code review, and in many cases I found result is not closed if SQL statement returns the records. The business rule for SQL statement is consider only the first record. Below is the code where I am confused, Why is it returning the value without closing resultset and statement? Is this correct way? if (rs.next()){ return new Long(rs.getLong(1)); } Below is sample code: private static Long &lt;MethodName&gt; ( oracle.sql.NUMBER[] o_errorCode, oracle.sql.CHAR[] o_errorText, Long portA, Long portZ) throws SQLException { String errorMessage = ""; Long[] NROLE = new Long[1]; Long[] pTask = new Long[1]; Long dimObject = null; Long objectIDA = null; Long objectIDZ = null; Long relation = null; Connection tmpConn = null; Statement stmt = null; ResultSet rs = null; String SQL = null; try { // Retrieve the Epipe circuits that are on the specified ports stmt = DbUtil.getConn().createStatement(); String query = "Select * from Circuit where ... Order by Id"; rs = stmt.executeQuery(query); if (rs.next()){ return new Long(rs.getLong(1)); } rs.close(); stmt.close(); return null; } catch (SQLException ex) { o_errorCode[0] = new oracle.sql.NUMBER(1); o_errorText[0] = new oracle.sql.CHAR("SQLException - " + ex.getMessage(), oracle.sql.CharacterSet.make(oracle.sql.CharacterSet.DEFAULT_CHARSET)); return(null); } catch (Exception e) { o_errorCode[0] = new oracle.sql.NUMBER(1); o_errorText[0] = new oracle.sql.CHAR("Exception - " + e.getMessage(), oracle.sql.CharacterSet.make( oracle.sql.CharacterSet. DEFAULT_CHARSET)); return(null); } }
has comment: http://stackoverflow.com/comment/37989694
has title: Java return SQL statement
tagged with: java
has answer: http://stackoverflow.com/a/24533552
type: Question
has answer: http://stackoverflow.com/a/24533692
has answer: http://stackoverflow.com/a/24533569
score: 0

http://stackoverflow.com/q/24488091
tagged with: parse-platform
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
tagged with: bitmap
tagged with: java
has body: I am making an app where i can upload images to a server but I am getting a problem in these lines of code. It gives an OutOfMemmoryError as shown below. package com.technow.pereo; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.util.Log; public class FileHelper { public static final String TAG = FileHelper.class.getSimpleName(); public static final int SHORT_SIDE_TARGET = 1280; public static byte[] getByteArrayFromFile(Context context, Uri uri) { byte[] fileBytes = null; InputStream inStream = null; ByteArrayOutputStream outStream = null; if (uri.getScheme().equals("content")) { try { inStream = context.getContentResolver().openInputStream(uri); outStream = new ByteArrayOutputStream(); byte[] bytesFromFile = new byte[1024 * 1024]; // buffer size (1 // MB) int bytesRead = inStream.read(bytesFromFile); while (bytesRead != -1) { outStream.write(bytesFromFile, 0, bytesRead); bytesRead = inStream.read(bytesFromFile); } fileBytes = outStream.toByteArray(); } catch (IOException e) { Log.e(TAG, e.getMessage()); } finally { try { inStream.close(); outStream.close(); } catch (IOException e) { /* ( Intentionally blank */ } } } else { try { File file = new File(uri.getPath()); FileInputStream fileInput = new FileInputStream(file); fileBytes = IOUtils.toByteArray(fileInput); } catch (IOException e) { Log.e(TAG, e.getMessage()); } } return fileBytes; } public static byte[] reduceImageForUpload(byte[] imageData) { Bitmap bitmap = null ; bitmap = ImageResizer.resizeImageMaintainAspectRatio(imageData, SHORT_SIDE_TARGET); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, outputStream); bitmap.recycle(); bitmap = null; byte[] reducedData = outputStream.toByteArray(); try { outputStream…
type: Question
has title: Is my use of Bitmap In these classes efficient
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37906868
has answer: http://stackoverflow.com/a/24488351

http://stackoverflow.com/q/24429232
accepted answer: http://stackoverflow.com/a/24432902
has comment: http://stackoverflow.com/comment/37824253
type: Question
tagged with: selenium-webdriver
tagged with: apache-poi
has title: Java Selenium webdriver code not execute ;Password Field remains Empty
has comment: http://stackoverflow.com/comment/37797991
has comment: http://stackoverflow.com/comment/37797242
has comment: http://stackoverflow.com/comment/37798917
score: 0
has comment: http://stackoverflow.com/comment/37803290
answer count: 2
has comment: http://stackoverflow.com/comment/37797704
has body: I try to execute java webdriver code ,selenium test for login page .I passed input from excel it correctly assign values to username , password .once click login button - Till login button submit works perfectly. if once login button clicked.. password field in that page remain empty and login attempt failed i cant sort out the problem. Thank you all Your reply and appreciate package exceltest; import java.io.File; import java.io.FileInputStream; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class sample { public static void main( String[] args) throws Exception { String [][] data; data = excelread(); String expectedtitle; for (int i = 1; i &lt; data.length; i++ ) { expectedtitle = login(data[i][0],data[i][1]); System.out.println("page title after login is" + expectedtitle ); if(expectedtitle.equalsIgnoreCase("homepage Title")) { System.out.println("PASSED"); } else{ System.out.println("FAILED"); } } } public static String login(String username,String password) throws InterruptedException { WebDriver driver = new FirefoxDriver(); driver.get("http://localhost/xxx/Default.aspx"); Thread.sleep(1000); //driver.findElement(By.id("LoginUserName")).clear(); driver.findElement(By.id("LoginUserName")).sendKeys(username); //driver.findElement(By.id("LoginPassword")).clear(); driver.findElement(By.id("LoginPassword")).sendKeys(password); driver.findElement(By.id("LoginLoginButton")).click(); Thread.sleep(1000); String expectedtitle = driver.getTitle(); return expectedtitle; } public static String [][] excelread()throws Exception { File excel = new File("D:\\Book1.xlsx"); FileInputStream fis = new FileInputStream(excel); XSSFWorkbook wb = new XSSFWorkbook(fis); XSSFSheet ws = wb.getSheet("Sheet1"); int totrow =…
has comment: http://stackoverflow.com/comment/37825616
has answer: http://stackoverflow.com/a/24432902
has comment: http://stackoverflow.com/comment/37799253
tagged with: excel
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/24429879
has comment: http://stackoverflow.com/comment/37799106
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37802139
has comment: http://stackoverflow.com/comment/37804323
has answer: http://stackoverflow.com/a/24429879

http://stackoverflow.com/a/24487430
accepted answer of: http://stackoverflow.com/q/24458257
upvote count: 3
has body: After some research, i managed to solve my problem. Apparently the APP_PLATFORM android-8 is not compatible with x86 android-opencv libs. So i just targeted android-9 and it worked.
answers question: http://stackoverflow.com/q/24458257
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/27332913
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43717066
answers question: http://stackoverflow.com/q/24484840
downvote count: 0
has body: getCurrentSession() : Obtains the current session. Creates a new session, different from the contextual session openSession() : Returns: The created session.
type: Answer

http://stackoverflow.com/a/24580200
has body: Take out the runOnUiTread call from Getjuice doInBackground. Put the setText statements for the EditTexts in onPostExecute. Thats a start...
score: 0
answers question: http://stackoverflow.com/q/24567588
type: Answer

http://stackoverflow.com/comment/37971950
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24523824
has text: @Aniruddha Yes, but we can safely assume they posted their code like this for simplicity.
type: AnswerComment

http://stackoverflow.com/q/24547797
downvote count: 0
tagged with: java
has title: How to upload data to Google Cloud Storage Automatically
tagged with: google-cloud-storage
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24548143
has comment: http://stackoverflow.com/comment/38016678
answer count: 2
tagged with: cloud
has answer: http://stackoverflow.com/a/24554722
favorite count: 0
accepted answer: http://stackoverflow.com/a/24554722
has body: I want to upload data from my local to oogle Cloud Storage, but I can't find any Java sample code describing how to do this. Would someone please give me some hint as how to do this? Thanks in advance.
possible better answer: http://stackoverflow.com/a/24548143
has comment: http://stackoverflow.com/comment/38016950
tagged with: google-app-engine
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/37885077
type: AnswerComment
has text: I mean I thought about using a JButton instead of the return key to get the entered text - but then if someone where ever to press the return button it would then be impossible to ever clear the textArea again - which just seems crazy. I'll read the section on bindings and see if I can find a solution. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/24476780
score: 0

http://stackoverflow.com/comment/38018000
score: 0
type: AnswerComment
type: Comment
has text: in java your pattern gives error here "([^,]*)\\" cause of quotes
comment on: http://stackoverflow.com/a/24547664

http://stackoverflow.com/q/24559977
downvote count: 1
has comment: http://stackoverflow.com/comment/38039401
type: Question
score: -1
answer count: 2
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: 2620 Steps I am currently working on an Android project which needs to parse some data from the website and display the data in TextView's. As seen above, I need to display the value Highlighted which is "2620". I'm using Jsoup and that is my Element data obtained from the website. I dunno what tag to use exactly. try { Document document = Jsoup.connect(url).get(); Elements stepstaken = document .select("div[class=measureValue fontGreyBold]span[class]"); stta = stepstaken.attr("class"); } catch (IOException e) { e.printStackTrace(); } The above code doesn't work so any possible replies are appreciated. Thanks!
has title: HTML Parsing using Jsoup library
has answer: http://stackoverflow.com/a/24560079
has answer: http://stackoverflow.com/a/24560071
tagged with: java

http://stackoverflow.com/q/24516965
has answer: http://stackoverflow.com/a/49387230
favorite count: 0
has title: How can I use Capybara with Cucumber-jvm and Java?
upvote count: 1
tagged with: webrat
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37961368
has body: I learned about cucumber and capybara while using Ruby on Rails, and I love it. Automated testing of manual inputs like button clicks is a must have for me. However, now that I am working with Java, I do not know how to include Capybara/webrat into my project. I am able to use cucumber-jvm really nicely, but I really would like to integrate capybara. Can anyone here guide me on how to use Capybara in my Java project?
has answer: http://stackoverflow.com/a/24526830
score: 1
tagged with: java
type: Question
tagged with: cucumber
answer count: 2
tagged with: capybara
downvote count: 0
possible better answer: http://stackoverflow.com/a/49387230
has comment: http://stackoverflow.com/comment/37961420
accepted answer: http://stackoverflow.com/a/24526830
tagged with: cucumber-jvm

http://stackoverflow.com/q/24459232
score: 3
has comment: http://stackoverflow.com/comment/37852169
has body: I have a jar file for an application i've made and would like to deploy it now as an .app and .exe file. Is this possible? I've seen applications do this before and i don't know how it's done. Is there a tool/eclipse plugin I need? Would i need a developer subscription with apple for OSX? I don't know where to go next, some recommended steps to take would be amazing thank you! So far for testing, i've been doing Run > Run As > Java Application from within eclipse. As stated in the title I wanted the .app and .exe to act as a wrapper for the .jar.
has comment: http://stackoverflow.com/comment/37852031
upvote count: 3
answer count: 1
tagged with: macos
has title: Wrap jar as .app (OSX) and (.exe) for deployment?
favorite count: 0
has answer: http://stackoverflow.com/a/24459332
accepted answer: http://stackoverflow.com/a/24459332
has comment: http://stackoverflow.com/comment/37852428
has comment: http://stackoverflow.com/comment/37861720
tagged with: windows
tagged with: deployment
has comment: http://stackoverflow.com/comment/37851912
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/24578243
tagged with: android
possible better answer: http://stackoverflow.com/a/30395096
tagged with: android-studio
has comment: http://stackoverflow.com/comment/89283231
upvote count: 41
has body: I have used the following code to create a temporary file in my android app: public File streamToFile (InputStream in) throws IOException { File tempFile = File.createTempFile("sample", ".tmp"); tempFile.deleteOnExit(); FileOutputStream out = new FileOutputStream(tempFile); IOUtils.copy(in, out); return tempFile; } Now the problem is Cannot resolve symbol 'IOUtils'. I did a little bit of googling and discovered that for using IOUtils I need to download and include a jar file. I downloaded the jar file from here(commons-io-2.4-bin.zip). I added the jar named commons-io-2.4.jar from the zip to my bundle and when I tried to import it using: import org.apache.commons.io.IOUtils; It is showing error Cannot resolve symbol 'io'. So I tried to import it like: import org.apache.commons.* But still I am getting the error Cannot resolve symbol 'IOUtils'. Question 1 : Why am I getting this error? How to resolve it? Question 2 : Is there any way to create a temp file from an InputStream without using an external library? Or is this the most efficient way to do that? I am using android studio.
downvote count: 1
has answer: http://stackoverflow.com/a/65919346
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/29549421
tagged with: java
has answer: http://stackoverflow.com/a/47097450
has answer: http://stackoverflow.com/a/30395096
score: 40
tagged with: import
type: Question
accepted answer: http://stackoverflow.com/a/24578744
tagged with: apache
linked to: http://stackoverflow.com/q/54548820
has answer: http://stackoverflow.com/a/77505787
favorite count: 0
has answer: http://stackoverflow.com/a/24578744
has title: Cannot resolve symbol 'IOUtils'
linked to: http://stackoverflow.com/q/17895557
answer count: 5

http://stackoverflow.com/comment/37861827
type: QuestionComment
has text: @alfasin Your argumentation is pointless as the example test I have posted clearly shows that a) LinkedHashSet's idea of insertion ordering matches with my own and b) it does what I want it to do. Your idea of insertion order may be different (which doesn't make it any less valid) but it's pointless to argue what *should be* vs. *what is*.
comment on: http://stackoverflow.com/q/24464279
score: 0
type: Comment

http://stackoverflow.com/comment/37797312
has text: r u using eclipse?have a look here http://stackoverflow.com/questions/7539590/can-not-send-special-characters-utf-8-from-jsp-to-servlet-question-marks-disp
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24429763

http://stackoverflow.com/a/24584325
score: 10
accepted answer of: http://stackoverflow.com/q/24584295
answers question: http://stackoverflow.com/q/24584295
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: When I have 2 Threads that increment and decrement on a int variable than sometimes i still got race conditions. Yes, you will - because even though the "get" and "set" operations on the int variable are each atomic, that doesn't mean the "increment" operation is atomic. Is atomic in this case every single operation (getfield, iadd...) and not the full addition? Yes, exactly. It's not actually the primitive types are atomic - it's read and write operations that are atomic. That's a big difference.
upvote count: 10

http://stackoverflow.com/comment/38069621
has text: The customer object is actually already in the database that is why i am doing session.load. I am trying to update the object.
comment on: http://stackoverflow.com/q/24575780
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37873521
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24470719
has text: @HovercraftFullOfEels I should be after the new Cifra()

kinect
type: Tag
tags question: http://stackoverflow.com/q/24477563
tag name: kinect

http://stackoverflow.com/q/24586544
answer count: 4
has comment: http://stackoverflow.com/comment/38089178
type: AnsweredQuestion
has title: Java Calculator Not Functioning
has answer: http://stackoverflow.com/a/24586579
tagged with: java
downvote count: 3
possible better answer: http://stackoverflow.com/a/24586586
upvote count: 1
accepted answer: http://stackoverflow.com/a/24586560
has answer: http://stackoverflow.com/a/24586586
type: Question
has comment: http://stackoverflow.com/comment/38088599
score: -2
has answer: http://stackoverflow.com/a/24586582
tagged with: calculator
favorite count: 0
has answer: http://stackoverflow.com/a/24586560
has body: I am new to programming. I Even made this code using help. I Want to know why it is not executing successfully.. When I tried to execute it, then I have to type the number twice to make it Run. And the yes or no exit does not work either! import java.util.*; public class Cal{ public static void main (String[] args) { String i; char in; int sol; int x; int y; System.out.println("Hello! \nWelcome to The Calculator"); System.out.println("Use the following Commands to use The Calulator, \nType the following letters: \na for Addition \ns for Subtraction \nm for for Multipication \nd for Division" ); Scanner keyIn = new Scanner(System.in); do { System.out.println("Now enter the letter for you operation: "); keyIn.nextLine(); i = keyIn.nextLine(); in = i.charAt(0); if (in == 'a') { System.out.println("Type in the first number "); keyIn.nextInt(); x = keyIn.nextInt(); System.out.println("Type in the second number "); keyIn.nextInt(); y = keyIn.nextInt(); sol = x + y; System.out.println("You chose + operation. \nAnswer = " + sol); } if (in == 's') { System.out.println("Type in your first number"); keyIn.nextInt(); x = keyIn.nextInt(); System.out.println("Type in the second number"); keyIn.nextInt(); y = keyIn.nextInt(); sol = x - y; System.out.println("You chose + operation. \nAnswer = " + sol); } if (in == 'm') { System.out.println("Type in your first number"); keyIn.nextInt(); x = keyIn.nextInt(); System.out.println("Type in the second number"); keyIn.nextInt(); y = keyIn.nextInt(); sol = x * y; System.out.println("You chose + operation. \nAnswer = " + sol); } if (in == 's') { System.out.println("Type in your first number"); keyIn.nextInt(); x = keyIn.nextInt(); System.out.println("Type in the second number"); keyIn.nextInt(); y = keyIn.nextInt(); sol = x / y; System.out.println("You chose + operation. \nAnswer = " + sol); } System.out.println("Do you want to do another calculation? No:n Yes:y"); keyIn.nextLine(); } while(keyIn.equals("y")); if (keyIn.equals("n")); System.…

http://stackoverflow.com/comment/37804663
has text: Proposal: change `int[]` to `int...`
comment on: http://stackoverflow.com/a/24433428
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/37899556
comment on: http://stackoverflow.com/a/24482032
type: AnswerComment
type: Comment
has text: @jtahlborn: my default CS was windows-1252 until I changed the sample string to "I♥café". Adding the heart made Java switch to UTF-8. Very educative.
score: 1

http://stackoverflow.com/comment/38038991
type: AnswerComment
type: Comment
has text: Thanks for taking your time to answer, but I need to have the values stored in the different objects. Each object has a double array data field and I need to store the first column in one of them and the next in another.
comment on: http://stackoverflow.com/a/24558883
score: 0

http://stackoverflow.com/q/24492874
has answer: http://stackoverflow.com/a/24492972
has comment: http://stackoverflow.com/comment/37915407
answer count: 2
accepted answer: http://stackoverflow.com/a/24492972
tagged with: sql
has body: I'm using the following method to run a prepared sql statement in java, but it give me an syntax error message: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update temp_test inner join ups_bill on temp_test.tracking_number=ups_bill.tra' at line 6 can some one point out what might be wrong please? Very much appreciated! Here the code for the method: private void updateTemp(){ try{ String sql="insert into temp_test (tracking_number, account_number, service, to_name, to_address, to_city, to_state, to_zip, to_zone, invoice_number, invoice_date, ship_date, account_code,entry_type_1,entry_type_2) \n" + "select distinct trackingnumber1, AccountNumber, chargetypedescription, receiverorganization, receiveraddressline1, receivercity, receiverstate, receiverzipcode, zone, invoicenumber, invoicedate, pickupdate, mid(ref4,1,3),entrytype, entrytype2 \n" + "from ups_bill \n" + "where trackingnumber1!= ' ' and ChargeType = 'FRT' and entrytype = 'SHP' and entrycategorycode!='DFC' and entrycategorycode!='DTP' \n" + "and not exists (select * from temp_test where temp_test.tracking_number=trackingnumber1 and temp_test.invoice_date=invoicedate);\n" + "update temp_test \n" + "inner join ups_bill \n" + "on temp_test.tracking_number=ups_bill.trackingnumber1 \n" + "set temp_test.account_code=mid(ups_bill.ref2,1,3) \n" + "where mid(temp_test.account_code,1,1) between 'a' and 'z';\n" + "update temp_test \n" + "inner join ups_bill \n" + "on temp_test.tracking_number=ups_bill.trackingnumber1 \n" + "set temp_test.account_code=mid(ups_bill.ref1,1,3) \n" + "where mid(temp_test.account_code,1,1) \n" + "between 'a' and 'z';\n" + "update temp_test \n" + "inner join customer_account \n" + "on temp_test.account_code=customer_account.customer_code \n" + "set temp_test.customer_name=\"Dyson Inc\";\n" + "update temp_test \n" + "inner join customer_info \n" + …
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24492967
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24492967
tagged with: mysql
type: Question
has title: sql syntaxt that runs correctly in MySQL workbench return syntax error in Java as prepared statement

http://stackoverflow.com/comment/37799136
score: 0
has text: If I do that will not run as multithreading. The requests will be in the row for one thread only. I want to execute the requests concurently.
comment on: http://stackoverflow.com/q/24429943
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24490912
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse crashes when it tries to auto-fill option for populating the methods
tagged with: crash
accepted answer: http://stackoverflow.com/a/24517569
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24517569
tagged with: android
favorite count: 0
has body: I am using Eclipse, Juno version. It loads well. But when it tries to use the autofill features for methods pop-down, it crashes. With the following log: # A fatal error has been detected by the Java Runtime Environment: # SIGSEGV (0xb) at pc=0x00007f66acbd82a1, pid=6895, tid=140080532424448 # # JRE version: OpenJDK Runtime Environment (7.0_55-b14) (build 1.7.0_55-b14) # Java VM: OpenJDK 64-Bit Server VM (24.51-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libsoup-2.4.so.1+0x6c2a1] soup_session_feature_detach+0x11 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /home/nithin/hs_err_pid6895.log # # If you would like to submit a bug report, please include # instructions on how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. Tried the answer by the BugZilla as the log inicated. But still it's the same. Any ideas to resolve this?
upvote count: 2
linked to: http://stackoverflow.com/q/16383992
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/37992225
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24534775
has text: Are they in the same package?

http://stackoverflow.com/comment/38038925
score: 1
comment on: http://stackoverflow.com/q/24559723
has text: `/photos` would be from root of file system, what you mean by count from the project
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24463524
has comment: http://stackoverflow.com/comment/37859912
has title: NPE in MultiSelect option JSP
has body: i have written a jsp code which contains mutiple select and when i click on submit i get the null pointer exception . i am using the request.getParametervalues() to fetch the data from multiple select: jsp code is as follows <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page language="java" import="java.lang.* ,javax.servlet.*,javax.servlet.http.*"%> Insert title here Select Color red blue green yellow pink black brown purple <% String [] x = request.getParameterValues("color1"); if(!x.equals("")) { for (int i = 0; i < x.length; i++) out.println (x[i]); } %> i am getting null pointer exception in out.println (x[i]); part i have also tried if(x ! = null) which is giving error i have also tried this : if(request.getParameterValues("color1").equals(null)) { out.println("abcd"); } its giving the same exception
tagged with: nullpointerexception
answer count: 1
has comment: http://stackoverflow.com/comment/37860090
favorite count: 0
has comment: http://stackoverflow.com/comment/37859992
has comment: http://stackoverflow.com/comment/37865094
has answer: http://stackoverflow.com/a/24463532
has comment: http://stackoverflow.com/comment/37859987
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37859897
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37859881
upvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24463532
score: -1

http://stackoverflow.com/a/24459327
type: Answer
has comment: http://stackoverflow.com/comment/37853511
has comment: http://stackoverflow.com/comment/37852399
has comment: http://stackoverflow.com/comment/37852497
has comment: http://stackoverflow.com/comment/37853719
has comment: http://stackoverflow.com/comment/37852980
has body: your problem is here: convertView = inflater.inflate(R.layout.messagelistrow, null); you not initialize inflater in your code you need: inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); in getView method, so getView method must be: @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView==null) { inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); holder = new ViewHolder(); convertView = inflater.inflate(R.layout.messagelistrow, null); holder.icon = (ImageView) convertView.findViewById(R.id.icon); holder.messageSnippet = (TextView) convertView.findViewById(R.id.messageSnippet); holder.messageDate = (TextView) convertView.findViewById(R.id.messageDate); convertView.setTag(holder); } else holder=(ViewHolder)convertView.getTag(); MessageListItem ml = (MessageListItem) rowItems.get(position); holder.icon.setImageResource(ml.getIconId()); holder.messageSnippet.setText(ml.getMessageSnippet()); holder.messageDate.setText(ml.getMessageDate()); return convertView; } another problem is in history xml file: line 8 Binary XML file line #8: Error inflating class fragment you need change fragment to FrameLayout
has comment: http://stackoverflow.com/comment/37853464
has comment: http://stackoverflow.com/comment/37854540
has comment: http://stackoverflow.com/comment/37852484
accepted answer of: http://stackoverflow.com/q/24459226
has comment: http://stackoverflow.com/comment/37853789
answers question: http://stackoverflow.com/q/24459226
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37853616
has comment: http://stackoverflow.com/comment/37852222
has comment: http://stackoverflow.com/comment/37853654
has comment: http://stackoverflow.com/comment/37852200
has comment: http://stackoverflow.com/comment/37852660

http://stackoverflow.com/q/24480237
has comment: http://stackoverflow.com/comment/37894986
type: Question
has body: I'm trying to create a GUI that allows the user to input a number, then the GUI creates an array of Points of that size, then draws that number of circles. However, when I run this code, the GUI only displays a black panel and using a system.out.println it says that the number in the JTextField never reaches the panel. How can I alter my code so that the user can input a number in the textfield, press enter, then the GUI draws that number of circles? import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; class ControlPanel extends JPanel{ JLabel inLabel; JTextField inText; public ControlPanel(){ setBackground(Color.lightGray); inLabel = new JLabel("Enter the number of points: "); inText = new JTextField(20); add(inLabel); add(inText); } public JTextField getInText(){ return inText; } public int getNPoints(){ int nP = Integer.parseInt(inText.getText()); return nP; } } class PiPanel2 extends JPanel{ private Point[] points; int nPoints; Dimension d = new Dimension(); private int X = d.width; private int Y = d.height; private int w = 5; private int h = 5; public PiPanel2(){ setBackground(Color.BLACK); } public void setNPoints(int nPoints){ this.nPoints = nPoints; } public int getNP(){ return nPoints; } public void paintComponent(Graphics g){ int n = getNP(); points = new Point[n]; System.out.println(n); for(int i = 0; i &lt; n; i++){ points[i] = new Point(Math.random(), Math.random()); } g.setColor(getBackground()); super.paintComponent(g); g.setColor(Color.red); g.drawOval(-X, -Y, X*2, Y*2); for(int i = 0; i &lt; points.length; i++){ int x = (int)(points[i].getX()*X); int y = (int)(points[i].getY()*Y); if(points[i].withinR()){ g.setColor(Color.blue); g.fillOval(x, y,…
has title: Using a GUI to input then draw several shapes
tagged with: event-handling
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/37891915
type: UnansweredQuestion
tagged with: swing
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37891953
tagged with: jtextfield

http://stackoverflow.com/comment/37960572
type: QuestionComment
score: 0
has text: Never assign to a loop counter (`i = j`, `i = count`) unless you really know what you're doing (but then you wouldn't do it anyway).
comment on: http://stackoverflow.com/q/24517643
type: Comment

http://stackoverflow.com/comment/37921668
comment on: http://stackoverflow.com/q/24495684
score: 0
type: Comment
type: QuestionComment
has text: @wckd that was the first problem but now I am getting an error under the get in driver.get(ENV.valueOf(args[1])); that says"the method get(String) in the type Webdriver is not applicable for the arguments (WebDriver2.ENV)"

http://stackoverflow.com/comment/37926387
comment on: http://stackoverflow.com/a/24495224
score: 0
type: Comment
has text: @Id does not require ObjectId. Your ID field can be whatever you'd like (including a complex object/document). So in this case, you can change your _id Java field to a String and be fine.
type: AnswerComment

http://stackoverflow.com/q/24478821
accepted answer: http://stackoverflow.com/a/24479161
answer count: 1
has comment: http://stackoverflow.com/comment/37889093
score: 0
tagged with: android
has body: hey:) I would like to do somethin when I click on my ListView item but I got these Exception Thread [&lt;1&gt; main] (Suspended (exception NumberFormatException)) &lt;VM does not provide monitor information&gt; StringToReal.invalidReal(String, boolean) line: 63 StringToReal.parseDouble(String) line: 248 Double.parseDouble(String) line: 295 Double.valueOf(String) line: 332 MainActivity$5.onItemClick(AdapterView, View, int, long) line: 719 ListView(AdapterView).performItemClick(View, int, long) line: 299 ListView(AbsListView).performItemClick(View, int, long) line: 1282 ListView.performItemClick(View, int, long) line: 4450 AbsListView$PerformClick.run() line: 3174 AbsListView$3.run() line: 3925 Handler.handleCallback(Message) line: 733 ViewRootImpl$ViewRootHandler(Handler).dispatchMessage(Message) line: 95 Looper.loop() line: 157 ActivityThread.main(String[]) line: 5872 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 515 ZygoteInit$MethodAndArgsCaller.run() line: 858 ZygoteInit.main(String[]) line: 674 NativeStart.main(String[]) line: not available [native method] Here is my code which gives the exception: void registerListClickCallback() { ListView myList = (ListView) findViewById(R.id.listViewFave); myList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View viewClicked, int position, long idInDB) { Cursor cursor = myDBAF.getRow(idInDB); if (cursor.moveToFirst()) { long idDB = cursor.getLong(DBAdapter.COL_ROWID); int Kalo = cursor.getInt(DBAdapter.COL_KALO); int Hydrate = cursor.getInt(DBAdapter.COL_HYDRATE); int Fat = cursor.getInt(DBAdapter.COL_FAT); int Protein = cursor.getInt(DBAdapter.COL_PROTEIN); //int to double KalorienenVerzehrt=KalorienenVerzehrt+(double)Kalo; KalorienenUebrig=KalorienenUebrig-(double)Kalo; HydrateG=HydrateG+(double)Hydrate; FetteG=FetteG+(double)Fat; EiweisseG=E…
has title: exception NumberFormatException ListView OnItemClickListener
tagged with: double
has answer: http://stackoverflow.com/a/24479161
has comment: http://stackoverflow.com/comment/37888831
has comment: http://stackoverflow.com/comment/37889129
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: listview
type: Question

http://stackoverflow.com/a/24491975
score: 0
answers question: http://stackoverflow.com/q/24491764
type: Answer
has comment: http://stackoverflow.com/comment/37913564
has body: ^[A-Z]{6}-[A-Z]{4}-[A-Z]{4}$ It's just you shouldn't put backslashes at the start and the end. Put instead ^ and $. And ow I didn't see you have used the Javscript's syntax ! Java != Javascript
has comment: http://stackoverflow.com/comment/37913669

http://stackoverflow.com/comment/37844050
comment on: http://stackoverflow.com/a/24454868
type: AnswerComment
score: 0
type: Comment
has text: @BoristheSpider yes, strange, I first even wrote `os.close()`. The problem is wrote: `'39942' bytes instead of stated: '40220' bytes..` - bytes are missing!

http://stackoverflow.com/q/24562576
has answer: http://stackoverflow.com/a/24562759
tagged with: spring
upvote count: 3
tagged with: java
tagged with: spring-data
has body: Is it possible to write a Service that provides a method that selects entities by a parent field but returns a child class that gets passed in by a parameter (or generic on the method)? Assuming the Parent has a String field called flag and two childs Child1 and Child2, the ParentService should be usable like this: Child1 child1 = parentService.findFlag(Child1.class, "de"); Child2 child2 = parentService.findFlag(Child2.class, "de"); or Child1 child1 = parentService.findFlag&lt;Child1&gt;("de"); Child2 child2 = parentService.findFlag&lt;Child2&gt;("de"); Detailed example: Because it is quite hard to explain, this code should explain the scenario from above: Java Classes: Parameter - abstract parent class having a common field for all childs UiParameter extends Parameter BatchParameter extends Parameter ParameterService - provides a save(Parameter) method that can be used for UiParameter and BatchParameter This method is used by other services to save all kinds of children Now it would be handy to add a find(UiParameter.class, commonFieldSelector) or find(BatchParameter.class, commonFieldSelector) method to the ParameterService. Currently there are 4 boilerblate classes (UiParameterService, UiParameterRepository, BatchParameterService, BatchParameterRepository) with just 1 method that looks almost similar. @Data @EqualsAndHashCode(callSuper = true) @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING) @DiscriminatorValue("PARAMETER") public abstract class Parameter extends AbstractEntity { // all children will share that @ManyToOne private Application commonField; } @Data @Entity @EqualsAndHashCode(callSuper = true) public class UiParameter extends Parameter { private String foo; } @Data @Entity @EqualsAndHashCode(callSuper = true) public class BatchParameter extends Parameter { private int size; } public interface ParameterRepository extends JpaRepository&lt;Parameter, Long&gt; { // That works great, …
answer count: 1
has title: Query by a parent field but return a child class
accepted answer: http://stackoverflow.com/a/24562759
tagged with: spring-data-jpa
type: AnsweredQuestion
score: 3
tagged with: jpa
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/37836736
has text: So is it the problem due to MediaPlayer class
comment on: http://stackoverflow.com/q/24450973
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24428353
has body: I have generated a Fortify report for my application. In a Fortify report it is showing Log forging issues in the below code: holDate = ((MaintainHolidayCalenderForm) form).getCALENDER_DATE(); logger.info("This is some description" + holDate + holName ); and as per some people's suggestions I have replaced the "/n" with "" and "/r" with "" but still the issue is not resolved. Can any one tell me how to resolve this? Thanks in advance.
tagged with: log-forging
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Log forging issues in fortify report
tagged with: fortify
has answer: http://stackoverflow.com/a/24638463
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24569518
score: -1
has answer: http://stackoverflow.com/a/24721648
type: Question
accepted answer: http://stackoverflow.com/a/24721648
downvote count: 1
has title: Application not appearing in share via list of android
has answer: http://stackoverflow.com/a/24570155
favorite count: 0
has body: Am trying to make my application to respond to action when user perform share via on any type of file in android, particularly audio and images for that i have added following code into my manifiest declaration of responding activity. &lt;activity android:name="com.example.TestActivity" android:label="@string/app_name" &gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;action android:name="android.intent.action.SEND" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:mimeType="audio/*" /&gt; &lt;data android:mimeType="image/*" /&gt; &lt;/activity&gt; But even after doing show, my app is nowhere in the choose list, any clue any one where am going wrong?
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/24569767
has comment: http://stackoverflow.com/comment/38148038
upvote count: 0
has comment: http://stackoverflow.com/comment/38057686
has comment: http://stackoverflow.com/comment/38148393
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8951182
has comment: http://stackoverflow.com/comment/38061130
tagged with: java
possible better answer: http://stackoverflow.com/a/24569767

http://stackoverflow.com/comment/38007109
has text: Starting to create a simple SIP client is like opening Pandora's box. But why don't you start over here: https://trac.pjsip.org/repos/wiki/Python_SIP_Tutorial. Good Luck!
type: QuestionComment
comment on: http://stackoverflow.com/q/24542211
score: 0
type: Comment

http://stackoverflow.com/q/24477047
score: 1
tagged with: java
tagged with: stream
upvote count: 1
type: Question
has body: I created a java chat application (client and server) Everything works fine when I'm on my LAN (using LAN IP address of the server into my client). But when I'm using the Internet address of my server in my client, the strings are sent only when I close the output Data stream of my client (and all the strings are sent at once). Here's a quick snap of my code (I have port forward from 6791 to 6790 in the example below), My server (thread): // this line is actually on my global server class, used below with theServer ServerSocket svrSocket= new ServerSocket(6790); //wait for incoming connection connectionSocket = svrSocket.accept(); connectionSocket.setSoTimeout(10000); // free the accepting port svrSocket.close(); //create a new thread to accept future connections (creates a new svrSocket) theServer.openNewConnection(); //create input stream BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); boolean threadRunning = true); while (threadRunning) { //System.out.println("thread: in the while"); try { Thread.sleep(100); clientSentence = inFromClient.readLine(); System.out.println(clientSentence); } catch... } My client: InetAddress dnsName; Socket clientSocket; PrintWriter out; dnsName = InetAddress.getByName("myAddress.me"); clientSocket = new Socket(dnsName.getHostAddress(), 6791); Thread.sleep(10); out = new PrintWriter(clientSocket.getOutputStream(), true ); int i=140; while (i&gt;130){ try { out.println(Integer.toString(i)); out.flush(); Thread.sleep(200); } catch(Exception e) { e.printStackTrace(); } i--; } out.flush(); out.close(); clientSocket.close(); I've tried with DataOutStreams, there's nothing to do. My server will only receive the strings when out.close() is called on client side. Is there a reason why, over the Internet, the data stream has to be closed for data to be sent? Is there a way around this? Am I doing something wrong?
has title: My java chat client only sends strings when the dataStream is closed
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
answer count: 0

http://stackoverflow.com/comment/38069818
comment on: http://stackoverflow.com/a/24575364
type: AnswerComment
has text: @anupsahu if this is pure request-response, w/o keep-alive connection, you can consider transaction cancelled if some timeout elapsed and there was no response from client.
score: 0
type: Comment

http://stackoverflow.com/q/24458204
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/37850035
has title: Put Sql Data to a Number Array
accepted answer: http://stackoverflow.com/a/24458748
tagged with: android
has comment: http://stackoverflow.com/comment/37849997
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has body: I have a problem. How can I put data from a SQL database to a Number array. I would like to put them in a Graph I got a NullPointerException for these command Number[] series2Numbers={s1nInt[1]}; Here is my full code openDB(); Cursor c = myDb.getSpalte(); while (c.moveToPrevious()) { s1nInt[i] = c.getInt(1); i++; c.moveToPrevious(); } c.close(); closeDB(); Number[] series2Numbers={s1nInt[1]}; And here is my exception: Graph.onStart() line: 85 Graph(Fragment).performStart() line: 1801 FragmentManagerImpl.moveToState(Fragment, int, int, int, boolean) line: 937 FragmentManagerImpl.moveToState(int, int, int, boolean) line: 1106 BackStackRecord.run() line: 690 FragmentManagerImpl.execPendingActions() line: 1571 FragmentManagerImpl$1.run() line: 447 Handler.handleCallback(Message) line: 733 Handler.dispatchMessage(Message) line: 95 My getSpalte() public Cursor getSpalte(){ String where= null; String Order = "_id DESC"; Cursor c = db.query(true, DATABASE_TABLE, KEY_KALOA, where, null, null, null, Order, null); if (c != null) { c.moveToFirst(); } return c; } i need the array for this: XYSeries series1 = new SimpleXYSeries( Arrays.asList(series1Numbers), // SimpleXYSeries takes a List so turn our array into a List SimpleXYSeries.ArrayFormat.Y_VALS_ONLY, // Y_VALS_ONLY means use the element index as the x value "Series1"); // Set the display title of the series
type: Question
linked to: http://stackoverflow.com/q/9467381
tagged with: arrays
has comment: http://stackoverflow.com/comment/37850193
has answer: http://stackoverflow.com/a/24458748
has comment: http://stackoverflow.com/comment/37850115

http://stackoverflow.com/comment/37940306
comment on: http://stackoverflow.com/q/24506600
type: QuestionComment
score: 1
has text: If the reader is reading faster than the writers are writing, eventually it will arrive to the end of the file and then it will return null. If not, then it will finish when your filesystem runs out of free space and the writers stop with an IOException
type: Comment

http://stackoverflow.com/comment/37830375
has text: Looks like you have a problem connecting to your Postgres database, in the log you are getting "PSQLException: The connection attempt failed" do you have Postgres running and can you connect to it using pgAdmin with the setting you have defined in the sessionFactory above?
comment on: http://stackoverflow.com/a/24441413
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24568703
has title: Size of a formbean inside jsp Struts1
tagged with: java
type: Question
has body: I'm using Struts 1.xx and i want to get the size of bean in jsp. So How to find a size of a list inside jsp.
has answer: http://stackoverflow.com/a/24568894
tagged with: jsp
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38056001
type: UnansweredQuestion
tagged with: jsp-tags
has comment: http://stackoverflow.com/comment/38055921
tagged with: struts-1

http://stackoverflow.com/q/24492835
score: 1
tagged with: java
has title: Spring security OAuth stackoverflowException
type: Question
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/24549764
has body: I would like to use Spring security with OAuth and JWT tokens. My current configurations are: @Configuration @EnableResourceServer public class OAuth2ServerConfig { @Configuration @EnableWebSecurity protected static class ResourceServer extends WebSecurityConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http.anonymous().disable() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .exceptionHandling() .accessDeniedHandler(accessDeniedHandler()) // handle access denied in general (for example comming from @PreAuthorization .authenticationEntryPoint(entryPointBean()) // handle authentication exceptions for unauthorized calls. .and() .authorizeRequests() // only allow this three endpoint to NOT be authenticated. .antMatchers(HttpMethod.POST, "/users").permitAll() .antMatchers(HttpMethod.POST, "/users/authenticate").permitAll() .antMatchers(HttpMethod.GET, "/users/inviationCode/{code}").permitAll() .antMatchers(HttpMethod.POST, "/**").fullyAuthenticated() .antMatchers(HttpMethod.GET, "/**").fullyAuthenticated() .antMatchers(HttpMethod.PUT, "/**").fullyAuthenticated() .antMatchers(HttpMethod.DELETE, "/**").fullyAuthenticated() .antMatchers(HttpMethod.OPTIONS, "/**").fullyAuthenticated() .and() .addFilterBefore(filterBean(), AbstractPreAuthenticatedProcessingFilter.class) .requestMatcher(new NegatedRequestMatcher(new AntPathRequestMatcher("/oauth/**"))) .authorizeRequests().anyRequest().authenticated().expressionHandler(new OAuth2WebSecurityExpressionHandler()) .and() .csrf().disable(); // for chrome/FF plugins to work. for now we shouldn't face any problem since there is no point that JS can be injected into our page... // @formatter:on } @Bean(name="authenticationManager") @Override public AuthenticationManager authenticationManager() throws Exception { return super.authenticationManagerBean(); } @Bean @Autowired AccessDeniedHandler accessDeniedHandler() { return new AccessDeniedE…
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24549764
tagged with: oauth-2.0
tagged with: spring
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/38061151
type: Comment
has text: thank you for very detailed and clear answer! you teached me a lot of things
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24571126

http://stackoverflow.com/q/24539026
has title: Execute .bat file from java and wait till its finished
downvote count: 0
has comment: http://stackoverflow.com/comment/38031207
has comment: http://stackoverflow.com/comment/38019129
has comment: http://stackoverflow.com/comment/38000533
tagged with: batch-file
has comment: http://stackoverflow.com/comment/38001140
tagged with: windows
has answer: http://stackoverflow.com/a/72537236
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24540007
has answer: http://stackoverflow.com/a/72537329
has comment: http://stackoverflow.com/comment/38000407
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/41425698
linked to: http://stackoverflow.com/q/6444812
score: 1
tagged with: java
has body: I have gone through few questions raised on how to achieve this. I used process.waitFor() and /wait as mentioned here. The problem is by doing so it waits not just till the command is executed but until cmd prompt is closed (can be done by adding exit in the bat file). But I cannot modify bat file as its a Product file. Runtime run = Runtime.getRuntime(); try { String path = "C:/Folder/c.bat"; String executeCmd= "cmd /c start /wait "+path; final Process process =run.exec(executeCmd); process.waitFor(); System.out.println("did I wait?"); } catch (Exception e) { e.printStackTrace(); } How to make it wait only till the command is executed.
has comment: http://stackoverflow.com/comment/38000798
type: Question
has comment: http://stackoverflow.com/comment/38002812

http://stackoverflow.com/q/24584198
has body: I know it's possible to bundle the regular Oracle JRE in a Java application if you want to distribute it as a stand-alone application without requiring users to have the JRE already installed, but is it possible to do the same thing with OpenJDK?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/64079612
tagged with: java
has comment: http://stackoverflow.com/comment/111759864
has comment: http://stackoverflow.com/comment/38085603
type: Question
score: 5
has title: Embedding OpenJDK in Application
answer count: 1
has comment: http://stackoverflow.com/comment/38093761
downvote count: 0
favorite count: 0
upvote count: 5

http://stackoverflow.com/comment/37898531
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24483199
score: 2
has text: @CommuSoft jumps in any form are poor coding style more often than not. I just wanted to point out that exceed is superfluous.

http://stackoverflow.com/comment/37904460
has text: I think it's unlikely that the error code will be set, since it's not a database error but a driver error.
type: Comment
comment on: http://stackoverflow.com/a/24487056
type: AnswerComment
score: 0

http://stackoverflow.com/q/24512068
tagged with: struts-tags
tagged with: struts
upvote count: 2
answer count: 2
tagged with: jstl
possible better answer: http://stackoverflow.com/a/24512614
has comment: http://stackoverflow.com/comment/37950085
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24512680
favorite count: 0
has comment: http://stackoverflow.com/comment/37950364
has answer: http://stackoverflow.com/a/24512680
has comment: http://stackoverflow.com/comment/37950580
has comment: http://stackoverflow.com/comment/37950205
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37949851
has answer: http://stackoverflow.com/a/24512614
has body: I'm beginning on bug fixes for a program with which I have little familiarity. I've changed a section of code on one of the JSPs. I need it to print names with either of the two following formats (depending on whether or not the middle name property exists): LastName, FirstName M. LastName, FirstName I believe my code should print the middle initial and the period if and only if that property exists, but for each name in the list, it prints: LastName, FirstName . It prints either no middle initial or a middle initial that is an empty string, followed by the period. The relevant code is as follows: &lt;html:link styleClass="recordLink" action="/secure/admin/users?actionMethod=details" paramId="userId" paramName="users" paramProperty="userId"&gt; &lt;bean:write name="users" property="lastName"/&gt;, &lt;bean:write name="users" property="firstName"/&gt; &lt;logic:notEmpty name="users" property="middleName"&gt; &lt;bean:write name="users" property="middleName"/&gt;. &lt;/logic:notEmpty&gt; &lt;/html:link&gt; Why is the &lt;logic:notEmpty&gt; tag not working? Could the middleName property be determined to be non-empty if the property doesn't exist? Is there something wrong with my syntax? I've also tried to use JSTL tags, but I could not get it working in OC4J (Error: "http://java.sun.com/jsp/jstl/core" is not a registered TLD namespace.)
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37950303
has title: Struts <logic:notEmpty> not working or bean property not being written properly to JSP?

http://stackoverflow.com/a/24457857
accepted answer of: http://stackoverflow.com/q/24455349
has comment: http://stackoverflow.com/comment/39857994
has body: Guess what - I had to patch the thing. The gist of it: https://gist.github.com/anonymous/017b23c1d7c97c37d167
upvote count: 5
answers question: http://stackoverflow.com/q/24455349
type: Answer
has comment: http://stackoverflow.com/comment/39409619
has comment: http://stackoverflow.com/comment/39990580
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24558285
has answer: http://stackoverflow.com/a/24558479
has body: I am using log.info to output my message and they are all red. How do you change the colour by modifying the C:\javahome\logging.properties.
tagged with: java
type: Question
has title: How to change the colour of log messages using javahome\logging.properties?
score: 0
has comment: http://stackoverflow.com/comment/38036689
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/38047298
score: 0
type: Comment
has text: @user3794585: Since I do not do native iOS development, I cannot answer that.
type: AnswerComment
comment on: http://stackoverflow.com/a/24563916

http://stackoverflow.com/q/24574478
has comment: http://stackoverflow.com/comment/38066307
has comment: http://stackoverflow.com/comment/38067106
has answer: http://stackoverflow.com/a/41939870
has body: I am currently trying to learn how to use Generics from a book. In this chapter it says to take a piece of data T and convert it to an integer. I am trying different things in Eclipse, but none of them seem to allow this. How could you perform the following task: LinkedList&lt;T&gt; arr = new LinkedList&lt;T&gt;(); Float fl = 8.74273123948; arr.add(fl); Then in another class: public int findValue(Node node) { T data = node.data; int value = Number.valueOf(data); return value; } I have tried using .valueOf() and (int) among a few other things and nothing seems to satiate Java. The book insists on keeping the method generic in case floats or doubles were used instead of strings or ints. EDIT: For other people that might have a similar question. Gleaned from all the comments to this question and the answer that was accepted: use the .toString() on the data and then parse it as you need to whichever data type you need.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38066643
tagged with: java
possible better answer: http://stackoverflow.com/a/24575268
has answer: http://stackoverflow.com/a/24575268
type: Question
has answer: http://stackoverflow.com/a/24575113
upvote count: 4
has comment: http://stackoverflow.com/comment/38066880
has comment: http://stackoverflow.com/comment/38066246
tagged with: casting
downvote count: 0
has comment: http://stackoverflow.com/comment/38066557
score: 4
has title: Java generics and casting to a primitive type
answer count: 3
accepted answer: http://stackoverflow.com/a/24575113
tagged with: generics
has comment: http://stackoverflow.com/comment/38066413
favorite count: 0
has comment: http://stackoverflow.com/comment/38066236

http://stackoverflow.com/a/24556108
answers question: http://stackoverflow.com/q/24556060
has body: Did you override .equals()? If not, it is using Object.equals() which only returns true if they are the exact same instance.
upvote count: 1
has comment: http://stackoverflow.com/comment/38031895
has comment: http://stackoverflow.com/comment/38031939
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/37864632
has text: @GiruBhai no it wont help as its the most inefficient solution i ever seen
type: Comment
comment on: http://stackoverflow.com/a/24465910
score: 0
type: AnswerComment

http://stackoverflow.com/a/24433698
score: 0
has body: public static void main(String[] args) { List&lt;Number&gt; foo = new ArrayList&lt;&gt;(); List&lt;Integer&gt; a = cast(foo); System.out.println("a = " + a); } public static &lt;T, C extends T&gt; List&lt;C&gt; cast( List&lt;T&gt; l ) { return (List&lt;C&gt;) l; }
type: Answer
answers question: http://stackoverflow.com/q/24433591

http://stackoverflow.com/a/25182309
type: Answer
has body: a) It sounds like you might want a GridValueLayer on a 2D grid, rather than a 3D grid. You use a 3D grid if you want the agents to be able to move in a 3 dimensional space, but a 2D grid if they move in 2D space, even if you want them to then read a value for each location. A GridValueLayer can be used on an n-dimensional grid and holds a value for each cell (location specified by n int values). For your example, you might want the GridValueLayer to hold the value x+y for each cell in the 2D grid. e.g. int[] dimensions = new int[]{xMax, yMax}; AbstractGrid myBasicGrid = new AbstractGrid("exampleGrid", new SimpleGridAdder(), new WrapAroundBorders(), new SingleOccupancyCellAccessor(), dimensions); GridValueLayer mySimpleGridValueLayer = new GridValueLayer("simpleAddLayer",true,dimensions); for (int i = 0; i &lt; xMax, i++) { for (int j = 0; j &lt; yMax, j++) { int[] coord = new int[]{i,j}; mySimpleGridValueLayer.set(i+j, coord); } } b) This could be done in a number of ways. I suggest the GridValueLayer again. In the agent code, at the point that you do the move to a point in the grid, you set the GridValueLayer for that coordinate to 1. A final note. You could implement your own grid. As long as it conforms to Repast's Grid interface, or you can extend AbstractGrid. For instance, if you extend AbstractGrid and then have methods getSum(int... coords), which simply returns the sum of the coords array and getVisited(int... coords) to solve your problem. You could also make it implement the ProjectionListener interface, listening for a ProjectionEvent of type OBJECT_MOVED and then setting the value of visited to true for that location.
score: 0
answers question: http://stackoverflow.com/q/24487686

http://stackoverflow.com/a/24504387
has comment: http://stackoverflow.com/comment/37937001
has comment: http://stackoverflow.com/comment/37937107
has comment: http://stackoverflow.com/comment/38067474
accepted answer of: http://stackoverflow.com/q/24504013
answers question: http://stackoverflow.com/q/24504013
has comment: http://stackoverflow.com/comment/38063284
downvote count: 0
has comment: http://stackoverflow.com/comment/37937200
has comment: http://stackoverflow.com/comment/38063438
has comment: http://stackoverflow.com/comment/38064974
upvote count: 8
type: AcceptedAnswer
score: 8
has comment: http://stackoverflow.com/comment/38063903
has body: Gotta love Nimbus. Okay to start with, you're going to want to keep these values close... Button.background = DerivedColor(color=214,217,223 parent=control offsets=0.0,0.0,0.0,0 pColor=214,217,223 Button.contentMargins = javax.swing.plaf.InsetsUIResource[top=6,left=14,bottom=6,right=14] Button.defaultButtonFollowsFocus = false Button.disabled = DerivedColor(color=214,217,223 parent=control offsets=0.0,0.0,0.0,0 pColor=214,217,223 Button.disabledText = DerivedColor(color=142,143,145 parent=nimbusDisabledText offsets=0.0,0.0,0.0,0 pColor=142,143,145 Button.focusInputMap = javax.swing.plaf.InputMapUIResource@70e4bd3a Button.font = javax.swing.plaf.FontUIResource[family=SansSerif,name=sansserif,style=plain,size=12] Button.foreground = DerivedColor(color=0,0,0 parent=text offsets=0.0,0.0,0.0,0 pColor=0,0,0 ButtonUI = javax.swing.plaf.synth.SynthLookAndFeel Button[Default+Focused+MouseOver].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@3e5d2085 Button[Default+Focused+Pressed].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@78662669 Button[Default+Focused].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@2988e80b Button[Default+MouseOver].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@7c508d6d Button[Default+Pressed].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@2b5ec36a Button[Default+Pressed].textForeground = DerivedColor(color=255,255,255 parent=nimbusSelectedText offsets=0.0,0.0,0.0,0 pColor=255,255,255 Button[Default].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@62c2ed06 Button[Disabled].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@c6499e5 Button[Disabled].textForeground = DerivedColor(color=142,143,145 parent=nimbusDisabledText offsets=0.0,0.0,0.0,0 pColor=142,143,145 Button[Enabled].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@742746e1 Button[Focused+MouseOver].backgroundPainter = javax.swing.plaf.nimbus.ButtonPainter@293f9e9c Button[Focused+Pressed].backgroundPainter = java…
type: Answer

http://stackoverflow.com/comment/37926293
type: QuestionComment
has text: You mean the text of an element??
type: Comment
comment on: http://stackoverflow.com/q/24497150
score: 0

http://stackoverflow.com/comment/104981790
has text: The former, the mvn dependency, does not exist. At the latter, the oracle link, the version 1.1.3 is not present. Perhaps at one point the answer was correct, but it currently is not.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24443973
type: Comment

http://stackoverflow.com/q/24459541
tagged with: java
downvote count: 1
type: Question
tagged with: arrays
score: 0
has title: How to Print a specific point from an array from another method ? #Java
tagged with: printing
has answer: http://stackoverflow.com/a/24459594
answer count: 1
has comment: http://stackoverflow.com/comment/37853014
has body: public class NewTest { public static void main(String[] args) { String [][] table; table = new String [4][4]; for(int y=0; y&lt;4; y++){ for(int x=0; x&lt;4; x++){ table[y][x] = " ~ " ; } } int y, x; for(y=0; y&lt;4; y++) { System.out.print(y+": "); for(x=0; x&lt;4; x++) System.out.print(table[y][x]+" "); System.out.println(); } } public void table () { System.out.println(table[2][2]); } } //this is the line where I have problems ! System.out.println(table[2][2]);
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24459594

http://stackoverflow.com/q/24555558
type: AnsweredQuestion
type: Question
tagged with: lambda
has answer: http://stackoverflow.com/a/24555652
score: 0
has title: docs.oracle.com lambda expression example won't compile
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24555652
has body: I've been using docs.oracle.com as my way to learn java and when I tried to compile this code example below, I got 8 errors. I'm running java 7 u51. It seems like the compiler isn't recognizing the syntax of lambda expressions that oracle is teaching me. I really hope these tutorials aren't outdated because they're the first ones I've found that explain everything clearly. import java.util.function.Consumer; public class LambdaScopeTest { public int x = 0; class FirstLevel { public int x = 1; void methodInFirstLevel(int x) { // The following statement causes the compiler to generate // the error "local variables referenced from a lambda expression // must be final or effectively final" in statement A: // // x = 99; Consumer&lt;Integer&gt; myConsumer = (y) -&gt; { System.out.println("x = " + x); // Statement A System.out.println("y = " + y); System.out.println("this.x = " + this.x); System.out.println("LambdaScopeTest.this.x = " + LambdaScopeTest.this.x); }; myConsumer.accept(x); } } public static void main(String... args) { LambdaScopeTest st = new LambdaScopeTest(); LambdaScopeTest.FirstLevel fl = st.new FirstLevel(); fl.methodInFirstLevel(23); } } And the errors: C:\java&gt;javac LambdaScopeTest.java LambdaScopeTest.java:19: illegal start of expression Consumer&lt;Integer&gt; myConsumer = (y) -&gt; ^ LambdaScopeTest.java:20: illegal start of expression { ^ LambdaScopeTest.java:28: &lt;identifier&gt; expected myConsumer.accept(x); ^ LambdaScopeTest.java:28: &lt;identifier&gt; expected myConsumer.accept(x); ^ LambdaScopeTest.java:33: class, interface, or enum expected public static void main(String... args) { ^ LambdaScopeTest.java:35: class, interface, or enum expected LambdaScopeTest.FirstLevel fl = st.new FirstLevel(); ^ LambdaScopeTest.java:36: class, interface, or enum expected fl.methodInFirstLevel(23); ^ LambdaScopeTest.java:37: class, interface, or enum expected } ^ 8 errors

http://stackoverflow.com/a/24532856
answers question: http://stackoverflow.com/q/24514510
score: 0
accepted answer of: http://stackoverflow.com/q/24514510
type: Answer
has body: Solved it in a not very good way, but still.. So now I'm just added to that method with JS just one more Date arg. Now it looks like native void doSomething(Object object, Date date) /*-{ ..... .....::setDate(Ljava/util/Date;)(date); ..... }-*/; and calling it like doSomething(var1, new Date());
type: AcceptedAnswer

http://stackoverflow.com/comment/38022471
has text: Uhm... can you try the above code in a standalone page, not influenced by this CORS response changes ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24548266
score: 0

http://stackoverflow.com/comment/38190897
has text: @SarahSzabo: I will do so, if I'm back in the office, which may take a few days.
type: Comment
comment on: http://stackoverflow.com/a/24626593
score: 0
type: AnswerComment

http://stackoverflow.com/q/24567765
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17447045
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/38054845
upvote count: 1
tagged with: text-classification
type: Question
tagged with: java
tagged with: stemming
has title: Extracting keywords from a paragraph
has comment: http://stackoverflow.com/comment/38054309
has comment: http://stackoverflow.com/comment/38061077
has comment: http://stackoverflow.com/comment/38054533
downvote count: 0
has body: I want to extract keywords from my text. My article must be any sort related to music, sports,agriculture etc. So what I want is to extract keywords from a paragraph. I want to do this in Java and I searched a lot but couldn't be able to find any good algorithm or procedures for doing this. After searching I found out that there is keyword extraction algorithms in python. But I need to do this in Java. What I currently did is 1)Divided a paragraph into sentences. 2)Removed stop-words 3)calculated word frequency of each sentence. But the problem is that we can't say that the sentence with max word frequency will be the main sentence. I'm planning to do summarizer too to extract main sentences from a paragraph..Now I'm totally stuck with this. Can anyone help me.Any help will be appreciated.

http://stackoverflow.com/comment/59632953
comment on: http://stackoverflow.com/q/24442672
type: Comment
type: QuestionComment
has text: Good question. Too bad it's been closed. "We are using Swing for X"-type answers would have been extremely helpful.
score: 6

synchronization
tags question: http://stackoverflow.com/q/24579683
tags question: http://stackoverflow.com/q/24468593
tags question: http://stackoverflow.com/q/24536131
tags question: http://stackoverflow.com/q/24463734
tag name: synchronization
tags question: http://stackoverflow.com/q/24487633
tags question: http://stackoverflow.com/q/24540610
type: Tag
tags question: http://stackoverflow.com/q/24517456
tags question: http://stackoverflow.com/q/24520129
tags question: http://stackoverflow.com/q/24468356
tags question: http://stackoverflow.com/q/24440084

http://stackoverflow.com/comment/37899079
score: 0
type: Comment
type: QuestionComment
has text: Y this people are putting negative votes, i have researched a lot and it didn't help that y asked a question instead of answering,they put negative votes...
comment on: http://stackoverflow.com/q/24483668

http://stackoverflow.com/a/24580627
has comment: http://stackoverflow.com/comment/38078394
has body: Well, think it this way: if an interface defined private methods then these methods would only be called by the class implementing the interface, and that doesn't make much sense, since (in Java) an interface defines the contracts between classes. When a class follows an interface then the methods defined in the interface can be called in the implementation by external classes. In your case, your class B is extending A while class A is not implementing the interface C. So, by extending A it inherits a method that has less access than the one defined in the interface, and that is not allowed. If your class A had implemented the interface you would have seen the error "Cannot reduce the visibility of the inherited method from C"
has comment: http://stackoverflow.com/comment/38078410
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24580541
has comment: http://stackoverflow.com/comment/38077978
upvote count: 1

http://stackoverflow.com/comment/38026205
score: 0
type: Comment
has text: I thought there must be an efficient way after [reading this](http://www.geeksforgeeks.org/print-all-possible-combinations-of-r-elements-in-a-given-array-of-size-n/).
comment on: http://stackoverflow.com/a/24552816
type: AnswerComment

http://stackoverflow.com/a/24528626
has comment: http://stackoverflow.com/comment/37980823
answers question: http://stackoverflow.com/q/24528446
type: Answer
score: 0
has body: First thing to check- is GPS enabled? Second thing to check- are you getting a location lock? Do you see the GPS symbol appear on your notification bar? If so is it flashing or stable? If it isn't appearing, GPS isn't turning on at all. If its flashing, you don't have a lock. Until you have a lock, it won't call onLocationChanged. Please note if you're inside you may never get a lock. Another thing you can do is add MOCK_LOCATIONS to your permissions and download a mock location app. It will fake the GPS data to your app for testing purposes. If you do this, remember to remove that permission before release.

http://stackoverflow.com/a/24461145
score: 1
answers question: http://stackoverflow.com/q/24461088
has body: EventSite is a public inner class of SetUpSite, and this is messing you up. Get your EventSite class code out of the SetUpSite class and instead put it in its own file where it belongs. A Java file cannot have more than one top-level public class. You could make it a private inner class, and make it static internal class, but with no good reason for doing so, or could make it private and create it on top of a SetUpSite instance, but this is an ugly and unnecessary kludge.
upvote count: 1
type: Answer
downvote count: 0

jquery
tags question: http://stackoverflow.com/q/24430521
tags question: http://stackoverflow.com/q/24472244
tags question: http://stackoverflow.com/q/24457646
type: Tag
tags question: http://stackoverflow.com/q/24482578
tags question: http://stackoverflow.com/q/24523571
tags question: http://stackoverflow.com/q/24520325
tags question: http://stackoverflow.com/q/24513884
tags question: http://stackoverflow.com/q/24527235
tags question: http://stackoverflow.com/q/24450483
tags question: http://stackoverflow.com/q/24484399
tags question: http://stackoverflow.com/q/24487189
tag name: jquery
tags question: http://stackoverflow.com/q/24508424
tags question: http://stackoverflow.com/q/24446767
tags question: http://stackoverflow.com/q/24507567
tags question: http://stackoverflow.com/q/24490102
tags question: http://stackoverflow.com/q/24493488
tags question: http://stackoverflow.com/q/24495102
tags question: http://stackoverflow.com/q/24559149
tags question: http://stackoverflow.com/q/24579671
tags question: http://stackoverflow.com/q/24494543
tags question: http://stackoverflow.com/q/24568053

http://stackoverflow.com/q/24481237
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: Looking at other questions that are similar, the error i am receiving is sometimes due to an Eclipse bug. However, since i am a novice, this may not be the case. The error: Values cannot be resolved to a type The code: @Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch(item.getItemId()){ case R.id.bNewStory: startActivity(new Intent(MainActivity.this, AddStory.class)); case R.id.bAddTopic: CustomDialogClass cdd=new CustomDialogClass(Values.this); //ERROR OCCURS cdd.show(); } return true; } Notes: Already tried restarting Eclipse Already tried cleaning project Package has been declared
has comment: http://stackoverflow.com/comment/37893623
has comment: http://stackoverflow.com/comment/37894267
tagged with: eclipse
has title: Eclipse - Cannot be resolved to a type
type: Question
has comment: http://stackoverflow.com/comment/37893686
has comment: http://stackoverflow.com/comment/37893643
has comment: http://stackoverflow.com/comment/37893619
has comment: http://stackoverflow.com/comment/37900129
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/13341560
has comment: http://stackoverflow.com/comment/37906167

http://stackoverflow.com/a/24475438
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24473035
has comment: http://stackoverflow.com/comment/37891465
type: AcceptedAnswer
downvote count: 0
has body: I guess this is a bug. The properties should be preserved and not be removed by the aggregation strategy. I opened a Jira issue in the hope that this will be fixed: CAMEL-7555. As as workaround extend ZipAggregationStrategy and override aggregate: public class MyZipAggregationStrategy extends ZipAggregationStrategy { @Override public Exchange aggregate(final Exchange oldExchange, final Exchange newExchange) { final Exchange answer = super.aggregate(oldExchange, newExchange); answer.setProperty("myZipName", newExchange.getProperty("myZipName")); // Hack!! return answer; } } Use MyZipAggregationStrategy as follows: public class MyRouteBuilder extends RouteBuilder { @Override public void configure() { from("file:zipper/in?include=.*.xml&amp;noop=true") .process(new Processor() { @Override public void process(final Exchange exchange) throws Exception { exchange.setProperty("myZipName", "messages.zip"); } }) .aggregate(new MyZipAggregationStrategy()) .constant(true) .completionFromBatchConsumer() .eagerCheckCompletion() .setHeader(Exchange.FILE_NAME, simple("${property.myZipName}")) // setting ZIP file name .to("file:zipper/out"); } }
accepted answer of: http://stackoverflow.com/q/24473035

http://stackoverflow.com/a/72722443
answers question: http://stackoverflow.com/q/24548956
score: 0
type: Answer
has body: Solution with ByteArrayInputStream I had a similar problem with CSV files. If they were read in Java with the wrong charset, only a part of the records could be imported. The method from my library assigns the correct encoding to the file and prevents reading errors. public static String lib_getCharset( String fullFile ) { // Initialize variables. String returnValue = ""; BodyContentHandler handler = new BodyContentHandler( -1 ); Metadata meta = new Metadata(); // Convert the BufferedInputStream to a ByteArrayInputStream. try( final InputStream is = new BufferedInputStream( new FileInputStream( fullFile ) ) ) { InputStream bais = new ByteArrayInputStream( is.readAllBytes() ); ParseContext context = new ParseContext(); TXTParser parser = new TXTParser(); // Run the Tika TXTParser and read the metadata. try { parser.parse( bais, handler, meta, context ); // Fill the metadata's names in an array ... String[] metaNames = meta.names(); // ... and iterate over it. for( String metaName : metaNames ) { // Check if a charset is described. if( metaName.equals( "Content-Encoding" ) ) { returnValue = meta.get( metaName ); } } } catch( SAXException | TikaException se_te ) { se_te.printStackTrace(); } } catch( IOException e ) { e.printStackTrace(); } return returnValue; } Using scanner, the file can then be imported as follows. Scanner scanner = null; String charsetChar = TrnsLib.lib_getCharset( fullFileName ); try { // Scan the file, e.g. with UTF-8 or // ISO8859-1 or windows-1252 for ANSI. scanner = new Scanner( new File( fullFileName ), charsetChar ); } catch( FileNotFoundException e ) { e.printStackTrace(); } Don't forget the assignment of the two dependencies in the POM.XML: https://repo1.maven.org/maven2/org/apache/tika/tika-core/2.4.1/ https://repo1.maven.org/maven2/org/apache/tika/tika-parser-text-module/2.4.1/ and the definition of the requires in module-info.java: module org.wnt.wnt94lib { requires transitive org.apache.tika.core; requires transitive org.apache.tika.par…

http://stackoverflow.com/a/24428847
has body: Why not make your own shortcut? static double[] doubleListToArray(List&lt;Double&gt; list) { int k = 0; double[] result = new double[list.size()]; for(double value : list) result[k++] = value; return result; }
type: Answer
has comment: http://stackoverflow.com/comment/37795607
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37795735
upvote count: 1
answers question: http://stackoverflow.com/q/24428748

http://stackoverflow.com/comment/37897975
comment on: http://stackoverflow.com/q/24483546
type: QuestionComment
type: Comment
has text: Well, its not about "time", its about progress in the flow of the algorithm, so you can change the bars % depending on how much progress you think you have made after every method, since you cant be sure how long its going to take.
score: 1

http://stackoverflow.com/a/24428857
has comment: http://stackoverflow.com/comment/37797667
accepted answer of: http://stackoverflow.com/q/24428369
has body: Webservices won't support HTTP GET. If you enter the service url its directly making a HTTP GET. Thats the reason it responds with the error No such operation Instead you need to make a SOAP POST to get response from webservice. Write a webservice client for this. You can refer this link for creating webservice clients
type: Answer
has comment: http://stackoverflow.com/comment/37797414
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37796929
has comment: http://stackoverflow.com/comment/37796061
answers question: http://stackoverflow.com/q/24428369
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/115056525
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26940812
type: Comment
has text: There are some other ways to get a reference to the full list row View, using the ViewHolder: 1 - `ViewGroup rowView = (ViewGroup)viewHolder.imageIV.getParent()`. 2 - `View rowView = viewHolder.itemView`. Then you can add `onClickListeners` to these `rowViews`.

http://stackoverflow.com/comment/37980197
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24528214
type: Comment
has text: @user2792920 You're likely to have problems with the hour field, as the format will be in your timezone, not GMT (forgot it's my default, hence worked for me). I added setting the timezone as well, should be fine now.

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/24455263
tags question: http://stackoverflow.com/q/24477648
tags question: http://stackoverflow.com/q/24449024
tags question: http://stackoverflow.com/q/24490129
tags question: http://stackoverflow.com/q/24579038
tags question: http://stackoverflow.com/q/24504642
tags question: http://stackoverflow.com/q/24493816
tags question: http://stackoverflow.com/q/24534842
tags question: http://stackoverflow.com/q/24496771
tags question: http://stackoverflow.com/q/24495624
tags question: http://stackoverflow.com/q/24469302
type: Tag
tags question: http://stackoverflow.com/q/24550436
tags question: http://stackoverflow.com/q/24496364
tags question: http://stackoverflow.com/q/24563016
tags question: http://stackoverflow.com/q/24547873
tags question: http://stackoverflow.com/q/24551244
tags question: http://stackoverflow.com/q/24587420
tags question: http://stackoverflow.com/q/24582155
tags question: http://stackoverflow.com/q/24541672

http://stackoverflow.com/comment/38058484
type: QuestionComment
comment on: http://stackoverflow.com/q/24570005
has text: You mean there is more than one copy of the database? One in each computer?
score: 0
type: Comment

http://stackoverflow.com/comment/38099049
comment on: http://stackoverflow.com/q/24586954
has text: So everything is in one .java file? Question: Do you, by any chance, have a copy of Utility.class elsewhere, in a directory that's in your classpath?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24471475
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37875399
has answer: http://stackoverflow.com/a/24471652
score: 1
favorite count: 0
has title: Box2d Arrow Transformation - Java
type: UnansweredQuestion
upvote count: 1
tagged with: java
has body: I'm making an archer game with LibGdx supported with Box2d. Many of the Box2D tutorials are in C++ so some methods are different with Java. I want to do is stick the arrow when it collide with a box.I found a tutorial but it is in C++ and I couldn't find a way to solve the issue. Actually it's a Math question. Here is the C++ code //start with standard positions as for normal arrow creation b2Vec2 vertices[4]; vertices[0].Set( -1.4f, 0 ); vertices[1].Set( 0, -0.1f ); vertices[2].Set( 0.6f, 0 ); vertices[3].Set( 0, 0.1f ); //now multiply by difference between arrow and target transforms b2Transform diffTransform = b2MulT( si.targetBody-&gt;GetTransform(), si.arrowBody-&gt;GetTransform() ); for (int i = 0; i &lt; 4; i++) vertices[i] = b2Mul(diffTransform, vertices[i]); b2PolygonShape polygonShape; polygonShape.Set(vertices, 4); //create a new fixture in the target body b2FixtureDef fixtureDef; fixtureDef.shape = &amp;polygonShape; fixtureDef.density = 1; si.targetBody-&gt;CreateFixture( &amp;fixtureDef ); //discard the original arrow body m_world-&gt;DestroyBody( si.arrowBody ); The aim is when the arrow collide with a box, create a new arrow fixture add it to the box's body then remove the old arrow body. All done except transformation of arrow. The problem is there is no b2MulT or b2Mul functions in Java. I want to transform the arrow with a position and angle of the old arrow's values when the collision occurs.
tagged with: box2d
type: Question
tagged with: libgdx

http://stackoverflow.com/comment/37942211
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24507567
type: QuestionComment
has text: could you tell me what to do ?

http://stackoverflow.com/q/24549607
tagged with: criteria-api
linked to: http://stackoverflow.com/q/5790602
type: Question
score: 4
has body: I have an entity with a java.util.Date field stored as a TemporalType.DATE. When passing a java.util.Date with hours, minutes or seconds to the where clause of a criteria query I can't seem to get a match from the database. The setup is an embedded H2-database in Spring with Hibernate. I've tried using PostgreSQL instead of H2 and it works. I've also tried to set H2 in PostgreSQL-mode, but it doesn't change anything. Given the entity @Entity public class SomeEntity { @Id private int id; @Temporal(TemporalType.DATE) private java.util.Date aDate; public int getId() { return id; } public void setId(int id) { this.id = id; } public Date getDate() { return aDate; } public void setDate(Date aDate) { this.aDate = aDate; } } The following query only returns a match if the hours, minutes and seconds of the parameter have been set to 0. public List&lt;SomeEntity&gt; someQueryOnDate(Date date) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;SomeEntity&gt; query = cb.createQuery(SomeEntity.class); Root&lt;SomeEntity&gt; root = query.from(SomeEntity.class); Predicate dateEquals = cb.equal(root.get(SomeEntity_.date), date); query.where(dateEquals); // This list is always empty if the date in the predicate has a time part return em.createQuery(query).getResultList(); } A full example follows. The test fails on the last assertion, where I query the database using a Date with hours, minutes and seconds set. @Test public void testDateEquals() throws ParseException { Date dateWithoutTime = new SimpleDateFormat("yyyy-MM-dd").parse("2014-07-03"); Date dateWithTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2014-07-03 09:45:01"); createEntity(dateWithoutTime); List&lt;SomeEntity&gt; entitiesMatchingDateWithTime = listAllEntitiesWithDate(dateWithTime); List&lt;SomeEntity&gt; entitiesMatchingDateWithoutTime = listAllEntitiesWithDate(dateWithoutTime); Assert.assertFalse("No entities matched the date without time", entitiesMatchingDateWithoutTime.isEmpty()); Assert…
answer count: 1
has answer: http://stackoverflow.com/a/24550133
favorite count: 0
has title: Using dates in Criteria Query where clause
type: UnansweredQuestion
upvote count: 4
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: h2

http://stackoverflow.com/comment/38076751
has text: i did install the android sdk as an admin. Is there any way i can still use the application though?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24579822

http://stackoverflow.com/comment/37861299
type: QuestionComment
has text: Why did you use a `Set` in the first place if insertion order is important? And what is the meaning of "last element inserted" if the element was already present in the set?
comment on: http://stackoverflow.com/q/24464279
score: 1
type: Comment

http://stackoverflow.com/a/24551080
answers question: http://stackoverflow.com/q/24550783
has body: Convert res into text format by applying following code and try String str = String.valueOf(res); value.setText(str);
score: 0
has comment: http://stackoverflow.com/comment/38026566
type: Answer
has comment: http://stackoverflow.com/comment/38023378

http://stackoverflow.com/a/24555415
score: 1
has comment: http://stackoverflow.com/comment/38030785
upvote count: 1
has body: When overriding you cannot throw Broader or newer exception. Not throwing a super class method's exception is allowed. The overriding method must NOT throw checked exceptions that are new or broader than those declared by the overridden method. For example, a method that declares a FileNotFoundException cannot be overridden by a method that declares a SQLException, Exception, or any other non-runtime exception unless it's a subclass of FileNotFoundException.
accepted answer of: http://stackoverflow.com/q/24555352
answers question: http://stackoverflow.com/q/24555352
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38030891
type: Answer

selected
tags question: http://stackoverflow.com/q/24500048
type: Tag
tag name: selected

http://stackoverflow.com/a/24543835
has comment: http://stackoverflow.com/comment/38009631
answers question: http://stackoverflow.com/q/24543811
type: Answer
has body: I would separate the code into a separate function, and call that function if the scanner returns a "y". For example: public static void main(String[] args) { function(); } public static void function(){ Scanner sc = new Scanner (System.in); String name; System.out.println("Input Name"); name = sc.nextLine(); StringBuilder rev = new StringBuilder(name); System.out.println("NAME: "+name+"\n"); System.out.println("REVERSE:" +rev.reverse()+"\n"); System.out.println("Would you like to do it again?(Y/N)\n"); char repeat; repeat = sc.next().charAt(0); if(repeat == 'n'){ System.out.println("Program Stopped"); } if(repeat == 'y'){ function(); } } Hope that helps
has comment: http://stackoverflow.com/comment/38009913
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38009643
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24543811
type: AcceptedAnswer

http://stackoverflow.com/q/24448440
answer count: 1
has answer: http://stackoverflow.com/a/24449240
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37831783
has title: Text File writing in Java
has body: I am writing String content to text file in Java code but after writing saving file onto disk, I am getting Incorrect encoding exception, Please suggest me correct Java Code? String content =fileContent;//fileContent.toString(); System.out.println("File Contt===&gt;"+content); File fileWrite = new File("/homeDesktop/NormalFile/"+filename); // if file doesnt exists, then create it if (!fileWrite.exists()) { fileWrite.createNewFile(); } FileWriter fw = new FileWriter(fileWrite.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(fileContent); bw.close();
has comment: http://stackoverflow.com/comment/37831836
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37832183
tagged with: java
score: -1
upvote count: 0

http://stackoverflow.com/q/24556376
tagged with: jsf
type: Question
tagged with: primefaces
tagged with: java
accepted answer: http://stackoverflow.com/a/24557244
has title: PrimeFaces CellEditEvent - Method not found error
has body: [ERROR ] An exception occurred javax.el.MethodNotFoundException: /partner/index.xhtml at line 44 and column 78 action="#{PartnerEdit.cellRowEdit()}": Method not found: com.ibm.ic.partner.view.PartnerEdit@3302e49a.cellRowEdit() &lt;p:ajax event="cellEdit" listener="#{PartnerEdit.cellRowEdit()}" /&gt; @ManagedBean(name="PartnerEdit") @ViewScoped public class PartnerEdit implements Serializable { public void cellRowEdit(CellEditEvent event){ System.out.println(event.getNewValue()); }
has answer: http://stackoverflow.com/a/24557244
answer count: 1
favorite count: 0
downvote count: 3
score: -3
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/a/24447212
score: 0
answers question: http://stackoverflow.com/q/24447079
has body: Use a filter and get the ip from the request. However in case the request comes from behind a firewall, you'll get the firewall's ip.
type: Answer

http://stackoverflow.com/comment/37866169
comment on: http://stackoverflow.com/a/24466679
score: 0
type: Comment
has text: could anyone please explain me,How that above code is going to work because i am not understating that please.
type: AnswerComment

http://stackoverflow.com/comment/37840109
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24452951
has text: hahaha wow simple mistake, and results are devestating to logic. Especially since this is for reminders. Kind of need the time! Thanks so much, sometimes it takes a second set of eyes!
score: 0

http://stackoverflow.com/q/24478423
downvote count: 0
tagged with: multithreading
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24479970
upvote count: 1
answer count: 1
favorite count: 0
has title: Access shared data with handler
type: UnansweredQuestion
tagged with: android
has body: In my Android project, I have a class in which I registered a BroadcastReceiver: public MyClass { private MyData mData; public MyClass(Context context) { mData = GET_PERSISTED_DATA(); //code to register receiver ... context.registerReceiver(myReceiver, filter); } public void accessData() { //Code to access mData ... } private BroadcastReceiver myReceiver= new BroadcastReceiver() { @Override public void onReceive (Context context, Intent intent) { //This is called in main UI thread accessData(); } } As you see above, in onReceive() of myReceiver, it calls accessData() method to access mData. However, there is another worker thread (other than main thread) could also call accessData() method. Which means it is not thread safe. Since Handler handles messages one by one from message queue, could I use an Handler in the following way to make above case thread-safe? Or is there a more elegant way? public MyClass { private MyData mData; private Handler mHandler; public MyClass(Context context) { mData = GET_PERSISTED_DATA(); //code to register receiver ... context.registerReceiver(myReceiver, filter); mHandler = new MyHandler(); } public void accessData() { mHandler.sendMessage(mHandler.obtainMessage(1)); } private class MyHandler extends Handler() { @Override void handleMessage(Message msg){ if(msg.what == 1){ //Code to access mData ... } } } private BroadcastReceiver myReceiver= new BroadcastReceiver() { @Override public void onReceive (Context context, Intent intent) { //This is called in main UI thread accessData(); } } Am I thread safe now by using handler in above way?
tagged with: android-handler

http://stackoverflow.com/comment/37894253
has text: Use the `JPanel` instead of the button, this will be added to the `CENTER` position of the `JLabel`, but, so long as it's transparent, you won't even know it's there. Something like `GridBagLayout` will then allow you to add components which will be positioned around the center of the container (the panel). If you need to switch between views, you might consider using a [`CardLayout`](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) as well
type: Comment
comment on: http://stackoverflow.com/a/24481508
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37843987
type: Comment
comment on: http://stackoverflow.com/q/24454822
score: 0
has text: @Sam I am Now I have `[valueOne, valueTwo, valueFive, valueTen, valueOne, valueOne]`
type: QuestionComment

http://stackoverflow.com/comment/37942972
score: 0
comment on: http://stackoverflow.com/q/24507626
type: Comment
has text: I want it to show for half a sec then disappear.
type: QuestionComment

http://stackoverflow.com/a/24480017
has comment: http://stackoverflow.com/comment/37891990
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37892605
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37891528
accepted answer of: http://stackoverflow.com/q/24479732
answers question: http://stackoverflow.com/q/24479732
has comment: http://stackoverflow.com/comment/37891357
has comment: http://stackoverflow.com/comment/37892131
has body: The way you've structured your data, what you need is not a reference to the node n (which you are already getting), but a reference to its parent. So for .left.left.right you need to cut off the last bit and call getNode with .left.left that will give you your Node's parent Node. The target node itself you can refer to by using the returned parent node and using the bit you cut off (.right) parent.right Also that way you can reassign the node by parent.right = new-node btw, you don't need to create a binary string to implement your scheme. You just need to use the shift operators and 'bitwise AND'

http://stackoverflow.com/a/24573695
score: 0
answers question: http://stackoverflow.com/q/24547767
type: Answer
has body: I think your JSON is too verbose: you have an entry named "dateFrom" that has an entry named "dateFrom", try to keep it simple and "flat". What about this option?: { "dateFrom": "someDate", "operandFrom": "less", "dateTo": "someDate", "operandTo": "greater", "season": "someSeason", "operandSeason": "equals" } I know that group data by semantic is tempting, but in a GET request you have to think the best way to process the parameters.The data can be easily transformed to: dateFrom=someDate&amp;operandFrom=less&amp;dateTo=someDate&amp;operandTo=greater&amp;season=someSeason&amp;operandSeason=equals or just send one parameter with the JSON as value: q={"dateFrom": "someDate","operandFrom":"less","dateTo":"someDate","operandTo":"greater","season":"someSeason","operandSeason":"equals"} But then you'd need to parse it in your controller.

http://stackoverflow.com/comment/38079084
type: QuestionComment
has text: @besnep if it is more than the Integer.MAX then that is the overflow
comment on: http://stackoverflow.com/q/24581202
score: 0
type: Comment

http://stackoverflow.com/q/24485819
has comment: http://stackoverflow.com/comment/37903078
answer count: 1
has comment: http://stackoverflow.com/comment/37902342
has comment: http://stackoverflow.com/comment/37902227
has comment: http://stackoverflow.com/comment/37902989
has comment: http://stackoverflow.com/comment/37902829
has comment: http://stackoverflow.com/comment/37902883
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/24486260
type: UnansweredQuestion
has body: I have some nested Fragments and I want to display a Fragment inside a FragmentTabHost. In the FragmentTabHost setup(...) method, the second parameter should be a FragmentManager but I am targeting Android API 15 which doesn't have the getChildFragmentManager() method available so I have to use the support library. I am getting an error saying that: 'setup(android.content.Context, android.app.FragmentManager, int)' in 'android.support.v13.app.FragmentTabHost' cannot be applied to '(android.support.v4.app.FragmentActivity, android.support.v4.app.FragmentManager, int)' In Android Studio: I want to use getChildFragmentManager() to avoid problems if things get even more nested in the future. Does anyone knows how to overcome this? EDIT: My imports: import android.app.Activity; import android.app.ActionBar; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v13.app.FragmentTabHost; import android.view.Window; import android.view.WindowManager;
has comment: http://stackoverflow.com/comment/37902603
has comment: http://stackoverflow.com/comment/37902715
tagged with: android-support-library
type: Question
tagged with: android
has title: Android - Convert adroid.support.v4.app.FragmentManager to FragmentManager
score: 0

http://stackoverflow.com/comment/38074249
type: AnswerComment
has text: Fantastic. made a few changes for the time being n it worked... Added a boolean flag to check if the sensor is already registered. It solved my current problem. Step two is modifying it as "service". I'll do it pretty soon and keep you guys posted. Thanks a lot.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24578465

http://stackoverflow.com/q/24542565
downvote count: 0
answer count: 1
favorite count: 0
tagged with: notifications
tagged with: android
has comment: http://stackoverflow.com/comment/38007410
tagged with: service
has body: In my app a timepicker is used by the user to set an alarm to notify them on when to use the app. When they set the reminder it will notify the user every 24 hours. I have used AlarmManager and Service to solve the problem. When I set the time I get notification every 24 hours, but sometimes I keep getting notifications randomly again and again. This is an error I can't debug and I don't know where the problem is. This is how I have done: To set an Reminder and cancel it here is my code: I use AlarmManager to set the Time. private void setReminder(){ Calendar calendar = Calendar.getInstance(); Calendar currentCalendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute()); SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT, Locale.US); String time = sdf.format(calendar.getTime()); SavingData.setReminder(time, true); long intendedTime = calendar.getTimeInMillis(); long currentTime = currentCalendar.getTimeInMillis(); alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); Intent intent = new Intent(this, MyReceiver.class); pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); if((intendedTime &gt;= currentTime) == false){ // This will set the alarm for the next day, if time is below intentedTime calendar.add(Calendar.DAY_OF_MONTH, 1); intendedTime = calendar.getTimeInMillis(); } alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, intendedTime, AlarmManager.INTERVAL_DAY, pendingIntent); Toast.makeText(this, "Alarm Scheduled!", Toast.LENGTH_LONG).show(); } private void cancelId() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, timePicker.getCurrentHour()); calendar.set(Calendar.MINUTE, timePicker.getCurrentMinute()); // Time format to String SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT, Locale.US); String time = sdf.format(calendar.getTime()); SavingData.setReminder(time, false); alarmManager = (AlarmManager)ge…
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/24542683
has comment: http://stackoverflow.com/comment/38007545
linked to: http://stackoverflow.com/q/6522792
score: 1
tagged with: java
type: Question
has title: Bug when firing notification using AlarmManager at specific time every day

http://stackoverflow.com/q/24583956
tagged with: regex
tagged with: java
has comment: http://stackoverflow.com/comment/38084991
has answer: http://stackoverflow.com/a/24584104
has comment: http://stackoverflow.com/comment/38084966
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38083886
upvote count: 0
has comment: http://stackoverflow.com/comment/38083896
score: -1
has answer: http://stackoverflow.com/a/24585110
has comment: http://stackoverflow.com/comment/38083854
answer count: 2
has title: How to find a link in some text?
tagged with: rfc
has comment: http://stackoverflow.com/comment/38084934
favorite count: 0
has body: I have a string in java that might or might not contain some link (url like www.google.com, stackoverflow.com, stanford.edu, etc). Now I want to search in the string if it contains any link. I have two problems here: What to search while searching for links. I mean link may or may not contain www, https, com, etc, so how to differentiate it from text. What is the RFC specifications for links? Which function to use in Java for searching that regex? I am fairly new to Java.
type: UnansweredQuestion

http://stackoverflow.com/a/24600853
type: Answer
score: 0
has body: I have followed instructions found here and tried to fix my old Eclipse + SDK + ADT, but with no luck. The basic problem keeps beeing the same; I still get the error message: This Android SDK requires Android Developer Toolkit version 23.0.0 or above. Current version is 22.6.3.v201404151837-1123206. Please update ADT to the latest version. But my eclipse can't find updates and can't install ADT 23 as new software. So I can't compile my old project in my workspace. I tested a fresh eclipode bundle for Windows&nbsp;8, followed instructions found from Android's developers page, step by step, and it worked fine. So it seems that the Windows Eclipse build is not broken. But I wan't use my Linux installation, my old Ubuntu 10. It seems obvious, that to getting the Linux Eclipse environment working again, I must install a new Eclipse bundle, my old Eclipse won't ever see updates for ADT 23 to get things working. Again, these intructions are for Linux developers that wan't to get their old workspace projects working again without changes in the developing environment, except you must install a new Eclipse bundle, but after that your projects will work as well as before the version 23 SDK/ADT-mess. If you are an Android developer you want to be sure, that you developing environment won't be messed up. Backup: ~./android (Here are your developer keys) Your old SDK dirrectory Your workspace Download the Eclipse bundle, Get the Android SDK. Follow instructions, create directory ~/Development and unzip bundle there. You get Eclipse and SDK directories. Start Eclipse from that directory Eclipse asks for a workspace. You can give it the old one. In Eclipse settings set SDK as downloaded SDK. Start Android SDK manager and download tools, Android versions you use and extras said in the Android developer tool page instructions You should now be ready to compile your old projects again, but for me it was not that simple. My old projects had errors. So open problems windows and you get…
answers question: http://stackoverflow.com/q/24437564

http://stackoverflow.com/q/24563533
has title: No appropriate connection provider encountered: JPA Hibernate
has body: I'm trying to connect to my local database with user root and password: password. I'm just trying to learn this stuff and it's difficult to get going. I understand that there needs to be a connection provided to the entitymanager and transaction system, but I thought I specified that already in my persistence file. Lastly I'm running standalone jboss so maybe theres something else I have to configure server side, but I feel everything should be configured in my container. Lastly I do not have a hibernate.cfg.xml file since everything is annotated for my entities. <?xml version="1.0" encoding="UTF-8" ?> org.hibernate.ejb.HibernatePersistence <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/hello" /> <property name="javax.persistence.jdbc.user" value="root" /> <property name="javax.persistence.jdbc.password" value="password" /> <property name="hbm2ddl.auto" value="create" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> Edit 13:54:17,474 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "hello.war" (runtime-name: "hello.war") 13:54:17,474 INFO [org.jboss.web] (ServerService Thread Pool -- 529) JBAS018224: Unregister web context: /taylor 13:54:17,508 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment taylor.war (runtime-name: taylor.war) in 34ms 13:54:17,578 INFO [org.jboss.as.jpa] (MSC service thread 1-10) JBAS011401: Read persistence.xml for persistenceUnit 13:54:17,604 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1) 13:54:17,604 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1) 13:54:17,606 INFO [o…
has answer: http://stackoverflow.com/a/24568101
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/38048937
type: Question
tagged with: jakarta-ee
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/38046698
has comment: http://stackoverflow.com/comment/84708297
has comment: http://stackoverflow.com/comment/38049522
answer count: 1
tagged with: jpa
favorite count: 0
linked to: http://stackoverflow.com/q/41990213

http://stackoverflow.com/a/29832200
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24577480
has body: I'm using Grails installed with GVM, and I've also run into this issue after updating environment variables in the profile and sourcing in the new changes. I was able to fix the problem simply by closing and reopening the terminal.

http://stackoverflow.com/q/24529808
linked to: http://stackoverflow.com/q/16362302
has comment: http://stackoverflow.com/comment/37983790
accepted answer: http://stackoverflow.com/a/24530521
favorite count: 0
has comment: http://stackoverflow.com/comment/37982694
downvote count: 0
has comment: http://stackoverflow.com/comment/37982844
has comment: http://stackoverflow.com/comment/37982783
has answer: http://stackoverflow.com/a/24529967
has answer: http://stackoverflow.com/a/24530521
has comment: http://stackoverflow.com/comment/37982717
has comment: http://stackoverflow.com/comment/37983198
type: AnsweredQuestion
score: 2
duplicate of: http://stackoverflow.com/q/16362302
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am trying to pass json data from servlet to jsp in string format , but i am facin error's when trying to execute the same i am not sure whether issue is with my code or tomcat server (7.0.33) i am using here's my servlet code import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONException; import org.json.JSONObject; /** * Servlet implementation class ChartDemo */ @WebServlet("/ChartDemo") public class ChartDemo extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ChartDemo() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String[] label = { "India", "Pak", "China" }; int[] val = { 30, 5, 65 }; JSONObject objMain = new JSONObject(); for (int i = 0; i &lt; label.length &amp;&amp; i &lt; val.length; i++) { try { JSONObject objNew = new JSONObject(); objNew.put("label", label[i]); objNew.put("val", val[i]); objMain.append("data", objNew); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } request.setAttribute("json", objMain.toString()); request.getRequestDispatcher("index.jsp").forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } } here's my jsp code &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;!DOCTYPE html…
tagged with: servlets
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/37983290
has title: java.lang.ClassNotFoundException: org.json.JSONException
has comment: http://stackoverflow.com/comment/37983144
possible better answer: http://stackoverflow.com/a/24529967

http://stackoverflow.com/comment/37871293
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24467982
type: Comment
has text: Generally, a lot of inexplicable things come from places I would never think of looking twice, but the real shame is that this issue persisted for two days before it was actually located. However, the MCVE request is what lead me to finding it, so thanks for that!

http://stackoverflow.com/comment/37889459
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24479155
has text: It doesn't say `it doesn't own the object`. It says `it doesn't own the object's monitor`. What is that monitor?

http://stackoverflow.com/q/24540670
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24540754
score: 0
answer count: 2
has title: Guava Collections2.transform not work
has body: I launch the code below in debugger: List&lt;MyBean&gt; target = getMyBeans(); Collections2.transform(target, new Function&lt;MyBean, MyBean&gt;() { //BREAKPOINT: target.length equals 4 @Nullable @Override public MyBean apply(@Nullable MyBean bean) { return removeUnnecessaryProperties(bean); //BREAKPOINT: never invoked } }); Problem: Collections2.transform is never invoked despite target has 4 elements. Question: Why Collections2.transform is never invoked?
accepted answer: http://stackoverflow.com/a/24540739
possible better answer: http://stackoverflow.com/a/24540754
type: AnsweredQuestion
tagged with: guava
has answer: http://stackoverflow.com/a/24540739

http://stackoverflow.com/a/24512670
score: 0
has comment: http://stackoverflow.com/comment/37987521
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24511468
answers question: http://stackoverflow.com/q/24511468
has body: The way you declare uMVPMatrix in your shader does not match the way it is used. You declare it as a vec4 attribute, while you set it as a matrix uniform. So the declaration in the vertex shader should be: uniform mat4 uMVPMatrix; It depends on how your matrices are set up, but it's also somewhat unusual in GLSL shaders to multiply your vectors from the left. I haven't used the matrix utility functions in Android, but from the documentation I suspect that you will need to multiply the vectors from the right: gl_Position = uMVPMatrix * vPosition;

http://stackoverflow.com/q/24490033
upvote count: 1
answer count: 1
has body: Is it possible to avoid creating stream inside current stream from the same collection like in below example to collect some data (listOfA is used two times to create stream) ? List&lt;A&gt; listOfA = Arrays.asList(new A(1L, "A1", "V1"), new A(2L, "A2", "V1"), new A(1L, "A1", "V2")); List&lt;B&gt; listOfB = listOfA.stream().map(r -&gt; new B(r.getId(), r.getName(), listOfA.stream().filter(r2 -&gt; r.getId().equals(r2.getId())).map(A::getVal).collect(toSet()) )).distinct().collect(toList()); class A { private final Long id; private final String name; private final String val; A(Long id, String name, String val) //constructor //getters } class B { private final Long id; private final String name; private final Set&lt;String&gt; values; B(Long id, String name, Set&lt;String&gt; values) //constructor //getters @Override public boolean equals(Object o) { ... return id.equals(a.id); } //hashCode } The final result should be a list of 2 objects: B{id=1, name='A1', values=[V1, V2]} B{id=2, name='A2', values=[V1] Thanks in advance!
favorite count: 0
tagged with: lambda
has title: java 8 lambda - use stream multiple times
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24490959

http://stackoverflow.com/comment/37997407
comment on: http://stackoverflow.com/a/24536589
score: 0
type: Comment
has text: Thank you! That did get some of the numbers to display in the GUI but I still need to work on it some more.
type: AnswerComment

http://stackoverflow.com/q/24491184
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24491372
tagged with: java
type: Question
answer count: 1
tagged with: nio
score: 0
has body: I'm manipulating MS word DOCX files using java.nio.FileSystems, but it is available with java 7 only but the problem is our server environment don't have a support for java 7. I really might need some aspects of java.nio.* in order to manipulate word document (editing the styles.xml using dom parsers APIs). Is there any other public, open-source APIs out there in order to do the same?
tagged with: http://stackoverflow.com/tag/xml
has title: Manipulating DOCX files using java.nio.FileSystems
tagged with: openxml
tagged with: http://stackoverflow.com/tag/docx

http://stackoverflow.com/comment/38053646
type: Comment
has text: @Anand For the purposes of determining distinctness, a `TreeMap` will _only_ consider what the comparator returns, and when it returns 0, the elements are considered equivalent. It does not call `equals` on the keys.
type: AnswerComment
comment on: http://stackoverflow.com/a/24567287
score: 0

http://stackoverflow.com/q/24468602
has comment: http://stackoverflow.com/comment/37870310
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37869895
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
linked to: http://stackoverflow.com/q/8046662
upvote count: 2
has title: org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
has body: I'm getting this exception when i want to connect to my database via hibernate, i was trying a lot of things i found on the internet but nothing helped, some of my files: dao class with connection: @Repository public class UserDaoImpl implements UserDao { @Autowired SessionFactory sessionFactory; //the problem with query is here public List<User> getAllUsers() { return sessionFactory.getCurrentSession().createSQLQuery("SELECT * FROM user").list(); } } web.xml: <?xml version="1.0" encoding="UTF-8"?> Archetype Created Web Application dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher *.htm contextConfigLocation classpath:context.xml org.springframework.web.context.ContextLoaderListener my servlet: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> <context:annotation-config /> <context:component-scan base-package="com.lime" /> <mvc:annotation-driven /> <mvc:default-servlet-handler /> and context.xml: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.dialect.PostgreSQL9Dialect true thread org.postgresql.Driver jdbc:postgresql://localhost:5432/come_to_blog_db postgres admin com.lime.model.User
has comment: http://stackoverflow.com/comment/37870202
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24469155
tagged with: spring
accepted answer: http://stackoverflow.com/a/24469155
has comment: http://stackoverflow.com/comment/37869778

http://stackoverflow.com/q/24486636
tagged with: spring
has answer: http://stackoverflow.com/a/24486791
has title: Why is that only messageSource is allowed as bean id for ResourceBundleMessageSource?
has body: For Beans, usually we can customise the id attribute but for ResourceBundleMessageSource class, if we dont specify id="messageSource" then a exception is thrown. <property name="basename" value="message" /> It throws the Exception Exception in thread "main" org.springframework.context.NoSuchMessageException: for code new ClassPathXmlApplicationContext("springconfig.xml").getMessage("code");
upvote count: 3
has comment: http://stackoverflow.com/comment/50569728
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24486793
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24486793
type: Question
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24486791

http://stackoverflow.com/q/24484399
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/37899872
type: Question
has title: how to send common request for the multiple tabs?
answer count: 1
tagged with: javascript
tagged with: jquery
tagged with: ajax
score: 0
has answer: http://stackoverflow.com/a/24484492
has comment: http://stackoverflow.com/comment/37900068
has body: I am developing one timer in web application. in this timer i am sending update request at every 2 minutes to update the time in server. now problem is that when multiple tabs are open in browser with this application then at 2 minutes every tabs will send request for update time. so the traffic is increase.I want to send one common request from every tabs how it is possible? I Have tried ajax for that. i am using java for the web development.
has comment: http://stackoverflow.com/comment/37900101
has comment: http://stackoverflow.com/comment/37899513
has comment: http://stackoverflow.com/comment/37900252
has comment: http://stackoverflow.com/comment/37899539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37899976
has comment: http://stackoverflow.com/comment/37900639
has comment: http://stackoverflow.com/comment/37899554

http://stackoverflow.com/comment/38165074
has text: please refer the KPI list in the above image
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24568053
type: QuestionComment

http://stackoverflow.com/q/24522209
downvote count: 3
has comment: http://stackoverflow.com/comment/37968949
duplicate of: http://stackoverflow.com/q/15725370
has comment: http://stackoverflow.com/comment/37968871
type: Question
accepted answer: http://stackoverflow.com/a/24522323
possible better answer: http://stackoverflow.com/a/24522421
tagged with: java
duplicate of: http://stackoverflow.com/q/9448950
score: 0
has title: Finding the mode of an array method (java)
answer count: 3
favorite count: 0
has body: I have to write methods to find the mean, median, mode, etc given an array of numbers. I've gotten everything else worked out, but mode is giving me a hell of a time and don't know why. The array is 22, 26, 45, 46, 49, 55, 57, 63, 63, 65, 66, 67, 67, 68, 68, 69, 70, 71, 72, 73, 75, 76, 76, 77, 77, 78, 78, 78, 79, 82, 82, 83, 84, 85, 87, 88, 88, 89, 89, 91, 92, 98, 99 It is returning 22, when the answer should be 78. Here is my code: public static int mode(int[] array){ int[] countArray = new int[101]; //counts each number for(int i = 0; i &lt; array.length; i++){ countArray[array[i]]++; }// end for loop int mode = array[0], modeIndex = 0; //finds which number occurs the most System.out.println(Arrays.toString(countArray)); for(int i = 1; i &lt; array.length; i++){ if(countArray[i] &gt; mode){ mode = countArray[i]; modeIndex = i; System.out.println(mode + " " + modeIndex); }// end if }// end for loop return modeIndex; }// end method mode
linked to: http://stackoverflow.com/q/15725370
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24522421
has answer: http://stackoverflow.com/a/24522323
has answer: http://stackoverflow.com/a/24522657
upvote count: 3

http://stackoverflow.com/a/26569517
has comment: http://stackoverflow.com/comment/72739129
type: Answer
answers question: http://stackoverflow.com/q/24536907
upvote count: 7
has body: The line: GlassFish Server, deploy, Connection refused: connect, false ... is a clue. I had the same error, but I solved it. The steps: 1) Grant privileges to write on the glassfish server installation folder. If you use Windows the path is: C:\Program Files\glassfish-xx 2) Run C:\Program Files\glassfish-xx\bin\asadmin.bat as Administrator. Then in the console type: start-domain 3) Clean and Build the project 4) Deploy 5) Run PD: I recommend use JDK7
score: 7
downvote count: 0

http://stackoverflow.com/q/24547211
score: 1
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38015592
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24547609
accepted answer: http://stackoverflow.com/a/24547609
has comment: http://stackoverflow.com/comment/38015631
has comment: http://stackoverflow.com/comment/38016357
tagged with: gson
has body: I have these two classes: public class Root { public ProfileInfoResult ProfileInfoResult = new ProfileInfoResult(); } public class ProfileInfoResult { public String joiningYear; } this is my json string which i have to deserialize: {"ProfileInfoResult":{"joiningYear":"2009"}} This is code to deserialize: Gson gson = new Gson(); JSONObject obj = new JSONObject(responseString); //responseString= {"ProfileInfoResult":{"joiningYear":"2009"}} Root resultObj = new Root(); String resStr = obj.toString(); try { resultObj = gson.fromJson(resStr, Root.class); } catch(Exception e) { Log.i("myyyy", e.getMessage()); e.printStackTrace(); } Java debug says that resultObj cannotbe resolved to a variable.
has title: Deserializing Json to java classes using gson library
answer count: 1
downvote count: 0
tagged with: deserialization
favorite count: 0
has comment: http://stackoverflow.com/comment/38016562
tagged with: android
has comment: http://stackoverflow.com/comment/38015621
has comment: http://stackoverflow.com/comment/38015872
has comment: http://stackoverflow.com/comment/38015666

hadoop-plugins
type: Tag
tags question: http://stackoverflow.com/q/24440443
tag name: hadoop-plugins

http://stackoverflow.com/comment/38027315
comment on: http://stackoverflow.com/q/24548266
type: Comment
type: QuestionComment
score: 0
has text: I can't update the struts2-core but I can update the struts2-json plugin

http://stackoverflow.com/a/24575207
downvote count: 0
has body: You can cast a null to the type and then invoke the method on that (which will work, since the target object isn't involved in invocation of static methods). ((net.foo.X) null).doSomething(); This has the benefits of being side-effect free (a problem with instantiating net.foo.X), not requiring renaming of anything (so you can give the method in B the name you want it to have; that's why a import static won't work in your exact case), not requiring the introduction of delegate class (though that might be a good idea…), and not requiring the overhead or complexity of working with the reflection API. The downside is that this code is really horrible! For me, it generates a warning, and that's a good thing in general. But since it's working around a problem that is otherwise thoroughly impractical, adding a @SuppressWarnings("static-access") at an appropriate (minimal!) enclosing point will shut the compiler up.
accepted answer of: http://stackoverflow.com/q/24572214
type: Answer
answers question: http://stackoverflow.com/q/24572214
score: 85
has comment: http://stackoverflow.com/comment/38107036
has comment: http://stackoverflow.com/comment/38853094
has comment: http://stackoverflow.com/comment/38090796
has comment: http://stackoverflow.com/comment/38067724
upvote count: 85
has comment: http://stackoverflow.com/comment/38069814
type: AcceptedAnswer

http://stackoverflow.com/comment/37959288
has text: Where are you repositioning the Joystick view? If you're only translating the View, you probably want to read `getTranslationX()` and `getTranslationY()`, not `getX()` and `getY()`.
comment on: http://stackoverflow.com/q/24517126
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24583688
linked to: http://stackoverflow.com/q/12365403
downvote count: 1
type: Question
upvote count: 0
duplicate of: http://stackoverflow.com/q/12365403
answer count: 6
has title: How can I convert string to double and store it in two different variables?
has answer: http://stackoverflow.com/a/24583747
has comment: http://stackoverflow.com/comment/38083417
has answer: http://stackoverflow.com/a/24583707
score: -1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24583709
tagged with: android
has body: I am new to Java and Android, so I really don't know all the codes and syntax. And I have to convert String to Double. For example if I have a string: Double dob1,dob2; String str = "12345,56789"; Now I have to convert this into double format and want the values to be stored like: dob1 = 12345 dob2 = 56789 How can I do this?
has answer: http://stackoverflow.com/a/24583710
tagged with: java
has answer: http://stackoverflow.com/a/24583698
has answer: http://stackoverflow.com/a/24583716

http://stackoverflow.com/comment/38062656
type: Comment
comment on: http://stackoverflow.com/a/24554095
type: AnswerComment
score: 2
has text: I don’t get what you want to say with “each filter is behind its own `Predicate`”. The term “filter” and the type `Predicate` have the same meaning here.

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/24585013
tag name: grouplayout

http://stackoverflow.com/a/25019538
has comment: http://stackoverflow.com/comment/38912980
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Insets are gaps around the borders of the container. MigLayout has ins constraint for this. The spaces between the components are controlled by the gap constraint. MigLayout has some initial gaps between components which are calculated specifically for the current platform. So I assume it is a bug that is related to the port, not to the MigLayout manager.
answers question: http://stackoverflow.com/q/24584368
accepted answer of: http://stackoverflow.com/q/24584368
type: Answer
has comment: http://stackoverflow.com/comment/38926478
has comment: http://stackoverflow.com/comment/38911941
upvote count: 1

http://stackoverflow.com/comment/37837731
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24449774
type: Comment
has text: @AndreaLigios If you read that right in the linked answer I used indexing via object reference using a key to identify an object in the collection. In this example there's no indexes.

http://stackoverflow.com/comment/37887736
type: QuestionComment
type: Comment
score: 0
has text: This bug has been running through SO since morning today -- guess the update needs an update and hope its done sooner.
comment on: http://stackoverflow.com/q/24478186

http://stackoverflow.com/comment/37969360
type: Comment
has text: How would I go about doing that?
comment on: http://stackoverflow.com/q/24522458
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37999443
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24526748
has text: I got that inner arraylist order_details and its underlying object by just renaming orderList to order_details.you have solved my another issue. Thank you
type: AnswerComment

http://stackoverflow.com/a/24481214
has body: The reason for intervals is integer arithmetic. Change: int cellSize, xOffSet; to: float cellSize, xOffSet; Also, change: cellSize = (int)getHeight()/numOfCells; to: cellSize = getHeight()/(float)numOfCells; Some other side notes: Do not change visibility of paintComponent, it is defined as protected. Don't forget to add super.paintComponent(comp); in paintComponent() Do not call setSize(), override panel's getPreferredSize() and pack() the frame. For example: public Dimension getPreferredSize(){return new Dimension(400, 400);} Then, add frame.pack(); before making the frame visible. Try to make paintComponent as fast as possible for better performance and user experience. You can move some things out of it, leaving only painting logic.
accepted answer of: http://stackoverflow.com/q/24481035
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24481035
type: Answer

http://stackoverflow.com/comment/38066760
has text: Try `Collections.shuffle(List)` and pick first N colors.
score: 3
comment on: http://stackoverflow.com/q/24574804
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24565735
has answer: http://stackoverflow.com/a/24565806
favorite count: 0
has title: Java stringBuilder value gets cleared
type: UnansweredQuestion
tagged with: android
has body: I have 2 stringBuilder values email and password that are cleared (deleted) in certain places but I want to keep it if one is correct. I thought my logic was correct but the value keeps telling me its empty after the if statement... else if(email.toString().equals(login_test_name) &amp;&amp; password.toString().isEmpty() || password.toString().equals(login_test_name) &amp;&amp; email.toString().isEmpty()) public class MainActivity extends ActionBarActivity { //variables String login_test_name = "t"; String login_test_pass = "t"; EditText username; EditText pass; private StringBuilder email = new StringBuilder(); private StringBuilder password = new StringBuilder(); //Remember password variables @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); //Remove action bar from screen setContentView(R.layout.activity_main); //get EditText field data by id name username = (EditText)findViewById(R.id.emailTxt); pass = (EditText)findViewById(R.id.passTxt); }//end oncreate @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; } //code to change activity with BTN click (to register user) public void registerUser(View v) { Intent i = new Intent(MainActivity.this, UserRegister.class ); startActivity(i); } // code to change activity (to order menu if username and pass are ture) public void orderMenu(View v) { // change EditText type to String type //String u = username.getText().toString(); //String p = pass.getText().toString(); email.append(username.getText().toString()); password.append(pass.getText().toString()); //test login username and password if (!email.toString().equals(login_test_name) || !password.toString().equals(login_test_pass) || email.toString().isEmpty() || password.toString().isEmpty()) { if(!email.toString().equals(login_test_name…
has comment: http://stackoverflow.com/comment/38050518
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/38050503
has comment: http://stackoverflow.com/comment/38050456
type: Question
has comment: http://stackoverflow.com/comment/38050987
tagged with: stringbuilder
score: -2
upvote count: 0
answer count: 1
tagged with: string

response-time
tags question: http://stackoverflow.com/q/24548964
tag name: response-time
type: Tag

http://stackoverflow.com/a/24464673
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24464663
type: Answer
has comment: http://stackoverflow.com/comment/37861951
accepted answer of: http://stackoverflow.com/q/24464663
has body: If you don't want it reset - make it static: currently the counter is per object

http://stackoverflow.com/q/24542816
upvote count: 2
linked to: http://stackoverflow.com/q/513832
downvote count: 3
has answer: http://stackoverflow.com/a/24543072
has answer: http://stackoverflow.com/a/24542945
accepted answer: http://stackoverflow.com/a/24542945
favorite count: 0
has comment: http://stackoverflow.com/comment/38007810
has title: Main method not executing certain methods
has body: I am having a problem with some code I wrote for a rock paper scissors game. In my main method I have another method that decides the winner and it isn't performing that method. It's acting as if it isn't even there. Sorry if there is an obvious answer I am just a beginner. For example if it is a tie it won't perform the tie method inside of the decideWinner() method. Thanks for any help import java.util.Scanner; import java.util.Random; public class appels { public static Scanner Andrew = new Scanner(System.in); public static Random Hello = new Random(); public static double compAnswer; public static String compChoice; public static String answer; public static void main(String [] args){ getAnswer(answer); showCompAnswer(); decideWinner(); } public static void getAnswer(String answer){ System.out.println("Welcome to Rock, Paper, Scissors Vs. the computer.\nWhich do you choose:"); answer = Andrew.nextLine(); } public static void showCompAnswer(){ compAnswer = Hello.nextDouble(); //System.out.println(compAnswer); if(compAnswer &gt; .66){ compChoice = "rock"; }else if(compAnswer&gt;.33 &amp; compAnswer&lt;.66){ compChoice = "paper"; }else{ compChoice = "scissors"; } System.out.println(compChoice); } public static void decideWinner(){ if(compChoice == answer){ tie(); System.out.println("Hi"); } } public static void tie(){ System.out.println("It's a tie."); } public static void compWin(){ System.out.println("The computer wins. :("); } public static void userWin(){ System.out.println("You win!"); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38007787
tagged with: java
possible better answer: http://stackoverflow.com/a/24543072
has comment: http://stackoverflow.com/comment/38007819
tagged with: methods
has comment: http://stackoverflow.com/comment/38007795
has comment: http://stackoverflow.com/comment/38007905
type: Question
has comment: http://stackoverflow.com/comment/38007780
answer count: 2
tagged with: program-entry-point
score: -1

http://stackoverflow.com/comment/38042289
score: 1
has text: @Constantin Actually I don't. I want to use my c++ code within my java application (not the Invocation API). Therefore I wrote the java class "Coordinates" containing the methods with the "native" modifiers, created the headerfile and imported it into my c++-project. Which I then edited and compiled as a .dll (using VisualStudio2013 setting the "Configuration Type" to .dll). I only posted the code that doesn't work, the other JNIEXPORT-methods work fine.
comment on: http://stackoverflow.com/q/24556672
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37802851
type: Comment
comment on: http://stackoverflow.com/a/24432587
has text: Thanks! I guess I have to study a little bit more. Coursera looks like a good starting point!
score: 0
type: AnswerComment

http://stackoverflow.com/q/24560996
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24569520
type: Question
has body: I'm trying to ignore multiple user clicks in the same button using tokenSession interceptor of struts2, but I'm always getting a null pointer exception when the action should be successfully completed. When a validation error happens it behaves like expected. I'd like to know what else do I need to do to get a tokenSession working besides put a <s:token /> in the form and enable the tokenSession interceptor? My struts configuration is: true ERROR dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...* input,back,cancel,browse input,back,cancel,browse I already tried that token session in several places (begining, after i18n, and at the end) within the interceptor stack, but I had no success either. My action code is: listParameters.do2 newParameter And issued error is: java.lang.NullPointerException at org.apache.struts2.RequestUtils.getServletPath(RequestUtils.java:55) at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getUri(DefaultActionMapper.java:507) at org.apache.struts2.dispatcher.mapper.DefaultActionMapper.getMapping(DefaultActionMapper.java:304) at org.apache.struts2.dispatcher.ServletRedirectResult.doExecute(ServletRedirectResult.java:179) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) at org.apache.struts2.dispatcher.ServletRedirectResult.execute(ServletRedirectResult.java:161) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:374) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Meth…
tagged with: struts2
has comment: http://stackoverflow.com/comment/38062800
tagged with: token
answer count: 1
downvote count: 0
favorite count: 0
tagged with: interceptor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38054878
has title: TokenSession interceptor in Struts2
has comment: http://stackoverflow.com/comment/38056795
score: 1

http://stackoverflow.com/a/32273774
score: 0
type: Answer
has body: You can check whether your app is in Background/foreground using below code. ActivityManager activityManager = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE); ArrayList&lt;ActivityManager.RunningAppProcessInfo&gt; appInfo = (ArrayList)activityManager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo app : appInfo) { Log.d(TAG, "App: " + app.processName + " State: " + (app.importance == 100 ? "Foreground" : "Background")); if (app.processName.equals(YourApp().getPackageName())) { Log.d(TAG, app.processName); if (app.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { // Cancel notification } break; } }
answers question: http://stackoverflow.com/q/24444474

http://stackoverflow.com/comment/37964251
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24503005
has text: That sounds like it would work but I plan on trying to render random terrain made up of small 8x8 blocks/images. Unfortunately, I cant pre generate that:( Nevertheless, I will try adjusting the directional delta.
type: AnswerComment

http://stackoverflow.com/a/24578281
accepted answer of: http://stackoverflow.com/q/24542272
type: Answer
has body: Remove instance variable // initialise image object up to its total Image Pictures[] = new Image[total]; Or at least on next and previous - remove elements more than n places away from current. You are caching all images now. Instead make some of the Pictures variable's index null. In paint check if its null - if it is load image of that slot alone. Also consider reading up on naming conventions and camel case - name instance variables being with lower case so picutures and not Pictures. You have done that for other vars so maybe just typo here :-) And dont mix java awt components with swing. can use java.awt.BorderLayout; java.awt.Color; java.awt.Graphics; java.awt.Image; etc but not components like Panel, Button use JButton ... It takes more memory when you try to release ... until garbage collection takes place. A good idea if you have more than 20 images i guess, so maybe cache size can be 10. Sample code - made into an app can make into a Japplet again - getdocument base etc import java.net.URL; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import javax.swing.JPanel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import javax.imageio.*; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JApplet; import javax.swing.JComponent; public class JAppletGallery extends JApplet implements ActionListener { private JButton first; private JButton previous; private JButton next; private JButton last; private int cacheSize = 2; static int total = 400; // initial total total images int imageIndex = 0; // current image String msg = ""; // gets folder's location String folderName = "/Users/Martynas/pictures/leicester/"; File folder = new File(folderName); // initialise image object up to its total Image pictures[] = new Image[total]; static String[] imageName = new String[total]; public static void main(String[] args){ final JAppletGallery ap = new JAppl…
answers question: http://stackoverflow.com/q/24542272
has comment: http://stackoverflow.com/comment/38085310
score: 0
has comment: http://stackoverflow.com/comment/38077235
type: AcceptedAnswer

http://stackoverflow.com/q/24563401
tagged with: simple-framework
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: java
tagged with: marshalling
type: Question
answer count: 1
has title: demarshalling an xml where attributes determine type
has answer: http://stackoverflow.com/a/24620147
has body: I'm being given xml documents (which I have no control its format). I would like to know if it is possible to demarshal this xml based on element attribute id. So different object types will share the same element name. Also, I'm planning on using Simpile XML because I'm on Android and JAXB doesn't like Android. So I would like something like: class Root { Person p; Car c; ArrayList<Person> plist; } class Person{ String name; } class Car { String type; } from bob <model> ford </ford> bob bob However, I know for sure that the document I am receiving will always be in the same order with the same number of top level elements. For example, Rool will always have: 1 person, 1 car, 1 person, 2 cars, and a unknnown-size sequence of cars. <person /> <car /> <person /> <car /> <car /> I don't know how many objects will be in here Thanks so much.
score: 0

http://stackoverflow.com/comment/37889766
comment on: http://stackoverflow.com/a/24479179
type: Comment
has text: Or just use the concurrent classes that already do most of this sort of thing.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38043572
type: Comment
comment on: http://stackoverflow.com/q/24562025
score: 0
type: QuestionComment
has text: @Vikas Mangal: You should search for a beginners book or a tutorial, the internet has plenty of them instead of flooding this site with questions.

http://stackoverflow.com/a/24496247
has body: I would start by designing a SudokuGrid class. You should use a 2-D Array of ints as your backing storage. Here's how I would structure it: public class SudokuGrid { // private instance variables private int[] grid; // constructor initializes sudoku grid with random values public SudokuGrid() { // TODO - I'll let you complete this method } // add value to the grid; throws an exception if an invalid value is added public void addValue(int value, int x, int y) { // TODO - I'll let you complete this method } } You can use this class to represent your grid. Let a 0 in the array represent a blank square. I would create this as a console program first, then you can experiment with swing once you get the sudoku logic working. Please leave a comment if you would like any additional clarifications or explanations.
answers question: http://stackoverflow.com/q/24494731
score: 0
type: Answer

http://stackoverflow.com/comment/37819293
score: 2
has text: I can't reproduce your problem. Are you using `Color` from `java.awt` package or from somewhere else (maybe you created your own `Color` class)? Also `new Color(red,green,blue)` should use `Color(int r, int g, int b)`, not `new Color(float,float,float)` since `red`, `green` and `blue` are integers.
comment on: http://stackoverflow.com/q/24441343
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37924107
type: Comment
has text: That js function is just for the ui. Nothing important.
comment on: http://stackoverflow.com/a/24483175
score: 0
type: AnswerComment

security
tags question: http://stackoverflow.com/q/24486751
tags question: http://stackoverflow.com/q/24532340
tags question: http://stackoverflow.com/q/24526122
tags question: http://stackoverflow.com/q/24546397
tags question: http://stackoverflow.com/q/24537436
tags question: http://stackoverflow.com/q/24503518
tags question: http://stackoverflow.com/q/24577690
tags question: http://stackoverflow.com/q/24534724
tags question: http://stackoverflow.com/q/24455117
tags question: http://stackoverflow.com/q/24502672
tags question: http://stackoverflow.com/q/24507163
tags question: http://stackoverflow.com/q/24526897
tags question: http://stackoverflow.com/q/24438799
tags question: http://stackoverflow.com/q/24505283
tags question: http://stackoverflow.com/q/24498599
tags question: http://stackoverflow.com/q/24490074
tags question: http://stackoverflow.com/q/24585075
type: Tag
tags question: http://stackoverflow.com/q/24587531
tag name: security

http://stackoverflow.com/q/24448063
tagged with: ejb
has title: Import javax.ejb.Schedule cannot be resolved
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24449371
has comment: http://stackoverflow.com/comment/37831256
accepted answer: http://stackoverflow.com/a/24449371
has comment: http://stackoverflow.com/comment/37831158
has body: I have a problem, eclipse say that it cannot found javax.ejb.Schedule (or Schedules) but no problem with other class like javax.ejb.MessageDriven. I work on a very big application that I don't really know. So my question is how to resolve this? Or a way to look for?
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/37832031
tagged with: java
has comment: http://stackoverflow.com/comment/37833190
upvote count: 1
type: Question

http://stackoverflow.com/comment/37825860
comment on: http://stackoverflow.com/q/24445075
has text: `HashMap` by definition has one value per key... Not quite sure what the interviewer was getting at.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37984121
has text: Yes, I deleted my side note
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24530412
type: Comment

http://stackoverflow.com/comment/38012961
type: AnswerComment
score: 0
has text: Did you try the GitHub project?
type: Comment
comment on: http://stackoverflow.com/a/24545007

http://stackoverflow.com/q/24461687
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/37920833
has comment: http://stackoverflow.com/comment/37856877
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/37926133
score: 4
has body: I am using JUnit to test an android program that uses the JNI and depends on multiple .so files which are all in the same folder. When I run unit tests that call System.loadLibrary("Name") This statement throws the following error: UnsatisfiedLinkerError: no libName in java.library.path Based on the answers to other SO questions, I decided to try adding -Djava.library.path=path/to/libs as an argument to my emulator. This did not help anything. I even had my program print the value of java.library.path, and it included the correct path to my library, but somehow still threw the unsatisfiedLinkError. I can only conclude that something strange is happening as a result of running with JUnit, as when I run my program normally (as an android application), I have no such errors. What's going on?
tagged with: junit
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37921188
type: UnansweredQuestion
has title: JNI: cannot find library in java.library.path when running JUnit
tagged with: android
linked to: http://stackoverflow.com/q/10425591
tagged with: c++
answer count: 0
tagged with: java

file
type: Tag
tags question: http://stackoverflow.com/q/24430565
tags question: http://stackoverflow.com/q/24506600
tag name: file
tags question: http://stackoverflow.com/q/24439656
tags question: http://stackoverflow.com/q/24443167
tags question: http://stackoverflow.com/q/24430809
tags question: http://stackoverflow.com/q/24560970
tags question: http://stackoverflow.com/q/24437087
tags question: http://stackoverflow.com/q/24439760
tags question: http://stackoverflow.com/q/24504956
tags question: http://stackoverflow.com/q/24482716
tags question: http://stackoverflow.com/q/24570161
tags question: http://stackoverflow.com/q/24521830
tags question: http://stackoverflow.com/q/24558674
tags question: http://stackoverflow.com/q/24530564
tags question: http://stackoverflow.com/q/24473018
tags question: http://stackoverflow.com/q/24533208
tags question: http://stackoverflow.com/q/24441757
tags question: http://stackoverflow.com/q/24483822
tags question: http://stackoverflow.com/q/24452332
tags question: http://stackoverflow.com/q/24509454
tags question: http://stackoverflow.com/q/24528671
tags question: http://stackoverflow.com/q/24449092
tags question: http://stackoverflow.com/q/24550072
tags question: http://stackoverflow.com/q/24460982
tags question: http://stackoverflow.com/q/24442086

http://stackoverflow.com/comment/37804025
type: QuestionComment
has text: Just given that a try- and it doesn't do what I was hoping... What that does is add another three columns next to the three I already have there (giving me a total of 6 columns). What I want to do, is add a new row, underneath the row that I already have. The row that I already have is just there to contain the column headings, and I now want to add a row of empty cells underneath, which the user will populate themselves.
score: 0
comment on: http://stackoverflow.com/q/24432812
type: Comment

http://stackoverflow.com/comment/39782710
score: 0
has text: @PeGiannOS and what Tim says is simple - override paint() method, in which don't call super.paint() as the first line, because by default paint() calls the following, in order: 1) paintComponent() 2) paintBorder() 3) paintChildren(). You want to not trigger paintChildren() all the time (you want, but not all of them). Read this article: http://docs.oracle.com/javase/tutorial/uiswing/painting/closer.html
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24445840

http://stackoverflow.com/a/24523116
has comment: http://stackoverflow.com/comment/37970632
has comment: http://stackoverflow.com/comment/37970894
has comment: http://stackoverflow.com/comment/37970537
has comment: http://stackoverflow.com/comment/37970670
downvote count: 0
has comment: http://stackoverflow.com/comment/37970450
has body: Before sending pdf file to output, you need to generate it on the server side. To convert your file to PDF I recommend to use OpenOffice in headless mode and JODConverter. To run OpenOffice in headless mode (in Windows) run the command (assume you have OpenOfficePortable, installed in C:\Apps: "C:\Apps\OpenOfficePortable\OpenOfficePortable.exe" -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard As you have OpenOffice started in headless mode, run a simple working prototype using JODConverter library: import com.artofsolving.jodconverter.DocumentConverter; import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; import java.io.File; import java.net.ConnectException; public class JODConv { public static void main(String[] args) throws ConnectException { if (args.length!=2) { System.out.println("Usage:\nJODConv &lt;file-to-convert&gt; &lt;pdf-file&gt;"); System.exit(0); } String sourceFilePath = args[0]; String destFilePath = args[1]; File inputFile = new File(sourceFilePath); File outputFile = new File(destFilePath); // connect to an OpenOffice.org instance running on port 8100 OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); connection.connect(); // convert DocumentConverter converter = new OpenOfficeDocumentConverter(connection); converter.convert(inputFile, outputFile); // close the connection connection.disconnect(); } }
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37970568
has comment: http://stackoverflow.com/comment/37970506
accepted answer of: http://stackoverflow.com/q/24523010
type: Answer
answers question: http://stackoverflow.com/q/24523010
has comment: http://stackoverflow.com/comment/37970475
upvote count: 3

http://stackoverflow.com/q/24469403
tagged with: ejb
has answer: http://stackoverflow.com/a/24474932
has comment: http://stackoverflow.com/comment/37881292
has comment: http://stackoverflow.com/comment/37870908
score: 0
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/37881175
has comment: http://stackoverflow.com/comment/37881268
has title: EntityManager remove throws Object: null is not a known entity type
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37871355
has body: I am trying to delete a record in the database using EntityManager. I am using EJB JPA. It produces the error : Object: null is not a known entity type. Here is my code: public void deleteAppointment(int staffID, int appointmentID) { try { StaffApointmentsPK staffApointmentsPK = new StaffApointmentsPK(); staffApointmentsPK.setAppointmentId(appointmentID); staffApointmentsPK.setStaffId(staffID); StaffApointments staffApointments = staffApointmentsFacade.find(staffApointmentsPK); System.out.println("staff app type " + staffApointments); em.remove(staffApointments); em.flush(); But in my early call to the function below, it is very similar but it is working. I do not understand what is the problem because I am searching for the entity first using staffApointmentsFacade. Here is my other function which works: public StaffApointments getPatientAppointmentDetails(int appointmentID, int staffID) { StaffApointmentsPK staffApointmentsPK = new StaffApointmentsPK(); staffApointmentsPK.setAppointmentId(appointmentID); staffApointmentsPK.setStaffId(staffID); StaffApointments staffApointments = staffApointmentsFacade.find(staffApointmentsPK); return staffApointments; } Any help would be appreciated. Thanks EDIT I solved it by switching the int staffID, int appointmentID respectively. Thanks for all your help!
tagged with: java
has comment: http://stackoverflow.com/comment/37872379
type: Question
has comment: http://stackoverflow.com/comment/37873021

http://stackoverflow.com/comment/38039943
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24555842
type: Comment
has text: My concern with the explanations is you're trying to describe a formal model in an intuitive manner which is not something I expect as I understand how it works on this level myself. I want to derive the inability of the reordering formally from the model specification and the "happens-before" statements are not enough here as it may be violated, like you said, if a change is "not observable".

http://stackoverflow.com/a/24554311
score: 1
accepted answer of: http://stackoverflow.com/q/24554158
answers question: http://stackoverflow.com/q/24554158
upvote count: 1
has body: Verify if you put the (correct version) of jstl-xxx.jar inside your WEB-INF/lib directory of your application.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38033007
type: Answer
downvote count: 0

http://stackoverflow.com/comment/38087501
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24585821
score: 0
has text: It is my "second" account of gmail.. If I have an alternative, of course I'll remove my account

http://stackoverflow.com/comment/38056241
type: Comment
has text: it`s useful for me) and how do for get numbers without "+"? i know that i can cut this after splitting but intresting how do it with just one regexp
type: AnswerComment
comment on: http://stackoverflow.com/a/24568615
score: 0

http://stackoverflow.com/comment/37814811
type: QuestionComment
comment on: http://stackoverflow.com/q/24439007
score: 2
has text: Creating an array != creating the contents of the array
type: Comment

http://stackoverflow.com/q/24429788
tagged with: spring-security
favorite count: 0
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24430174
type: Question
has body: Thank you for your time:Could you please provide me my error.I am getting an error on dependecies tag stating "The markup in the document following the root element must be well-formed." Please provide your valuable comments . <jdk.version>1.6</jdk.version> <spring.version>3.2.8.RELEASE</spring.version> <spring.security.version>3.2.3.RELEASE</spring.security.version> <jstl.version>1.2</jstl.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework.security spring-security-web ${spring.security.version} org.springframework.security spring-security-config ${spring.security.version} jstl jstl ${jstl.version}
has title: i am getting this error: The markup in the document following the root element must be well-formed
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37938770
type: Comment
has text: Hi, Thanks for your quick response. I don't think I explained my question fully so I don't think this is quite what I want. Question edited.
comment on: http://stackoverflow.com/a/24499992
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37965719
has text: It appears that the functionality to support @JsonPropertyDescription has not yet been added to the jackson-module-jsonSchema project. https://github.com/FasterXML/jackson-module-jsonSchema/issues/37
type: AnswerComment
comment on: http://stackoverflow.com/a/24518309
score: 0
type: Comment

http://stackoverflow.com/q/24538502
tagged with: sequence
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24540565
tagged with: java
has body: After a few weeks, my application now has a strange behaviour. When I try to do an insert, the sequence value is always zero, but the database gives me the correct value. The sequence is as follows: CREATE SEQUENCE SEQ_ID_PERSONA_AUTOMATICKEY INCREMENT BY 1 START WITH 1 MAXVALUE 999 MINVALUE 1 NOCYCLE; The entity has the necessary annotations and as I said it worked perfect. @Id @SequenceGenerator(name = "MY_SEQUENCE", sequenceName = "SEQ_ID_PERSONA_AUTOMATICKEY", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQUENCE") @Column(name = "ID_PERSONA") private Long idPersona; The insert method has nothing special, just em.persist(persona); I don't know what to do. I tried to recompile the project and redeploy it but it always gives me zero. Any suggestions? Thanks. Using Oracle Database 11g Express, Oracle Weblogic 12c, Java EE 6
type: Question
tagged with: jpa
has title: Suddenly JPA ignores the Oracle sequence value
linked to: http://stackoverflow.com/q/10210273
score: 0
tagged with: oracle-database
answer count: 1

http://stackoverflow.com/a/25305996
has comment: http://stackoverflow.com/comment/40573785
type: Answer
answers question: http://stackoverflow.com/q/24430121
has comment: http://stackoverflow.com/comment/40574803
has comment: http://stackoverflow.com/comment/106064959
has comment: http://stackoverflow.com/comment/40491976
score: 15
has body: I achieved using FA Icons by adapting Jens Deters's approach. His routines target dynamic gui composition opposing fxml's declarative way. Nevertheless, his AwesomeIcon enumeration (which maps FA comprehensible names with unicode characters) suited perfectly to my intents. It should start by statically load the font in main/app class: public class App extends Application { static { Font.loadFont(App.class.getResource("/font/fontawesome-webfont.ttf").toExternalForm(), 10); } @Override public void start(final Stage primaryStage) throws Exception { URL resource = getClass().getResource("/fxml/app.fxml"); primaryStage.setScene(new Scene((Parent) FXMLLoader.load(resource), 500, 500)); primaryStage.setTitle("FontAwesomeFX demo"); primaryStage.show(); } public static void main(String... args){ launch(args); } } One can not use unicode characters in fxml (as needed to specify FA Icons), but can dynamic set attributes with such values. Hence having the above mentioned enumeration (AwesomeIcon), the job was done: The import: &lt;?import de.jensd.fx.fontawesome.AwesomeIcon?&gt; The node: &lt;Label styleClass="awesome" style="-fx-font-family: FontAwesome; -fx-font-size: 16.0;"&gt; &lt;text&gt;&lt;AwesomeIcon fx:constant="FILE"/&gt;&lt;/text&gt; &lt;/Label&gt; I end up implementing an Icon Widget/Control/Component for resuming the amount of code with two properties: value: FA Icon Name; size: styleable attribute for style -fx-font-size on label. New code (same effect): &lt;Icon value="FILE" size="16"/&gt; The code for that control can be found here. You can also find an working example as it includes the font and testing code.
upvote count: 15
downvote count: 0

http://stackoverflow.com/comment/37801055
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24431409
score: 0
has text: I seriously doubt that your interface is called `interface` as you say, because that's a Java reserved keyword. Please post the real class and interface declarations rather than describing them in English; that also tells us what your class hierarchy looks like.

http://stackoverflow.com/a/24509575
score: 0
has body: If you want to convert String to a JSONObject - Use this library - http://www.json.org/java/ JAR file is available at http://code.google.com/p/org-json-java/downloads/list Use below code to convert a string to JSONObject - JSONObject final_result = new JSONObject(result);
answers question: http://stackoverflow.com/q/24504447
type: Answer

http://stackoverflow.com/q/24559964
tagged with: sprite
type: Question
has title: Disappearing a sprite during boundary collision in libgdx
has body: I have a rectangular group that holds a bunch of sprites. Sprites are moving (say up). As they reach the top, they collide with the boundary. I have set up logic that kills the sprites as they exit the group. However, the way it is now, I can see the sprite leaving the group. I want to make it so that as the sprite is crossing the boundary, it's gradually disappearing until it's out (and dead). Here's a crude mockup of what I want to achieve. I was playing around with cameras thinking I have to modify the viewport, but it's not working. What's the proper way of achieving this effect? Thanks! EDIT: My camera was set up like this: camera = new OrthographicCamera(width, height); camera.setToOrtho(false, width, height); camera.position.set(width/2, height/2, 0); Right now it's operating from the group's parent level (layer). Width and height are Gdx.graphics.getWidth(), etc. My update(): camera.position.x = (width / 2) - resolver.getxPixelOffset()*parallax; camera.update(); batch.setProjectionMatrix(camera.combined); batch.begin(); g.drawGroup(batch); batch.end(); I moved my camera controls to my group class. I then changed the width and height to groupWidth and groupHeight. Since the group is not the entire screen, I figured it has to be smaller. This made the group massive. I don't want to change the size (or zoom?) of the group :(
tagged with: libgdx
answer count: 1
has comment: http://stackoverflow.com/comment/38039392
has comment: http://stackoverflow.com/comment/38041159
has answer: http://stackoverflow.com/a/24563428
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24563428

http://stackoverflow.com/comment/38067265
has text: Perhaps, your `sourceColors` list contains duplicated colors? ;)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24574804
score: 0

http://stackoverflow.com/comment/37981698
comment on: http://stackoverflow.com/a/24529297
type: Comment
has text: @TheLostMind, I'm late ^^
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37969225
comment on: http://stackoverflow.com/q/24522458
score: 0
has text: Calculate the rotations per normal (facing right), then try scaling the image in a negative direction (`-1`), this will invert/mirror the image
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24516880
has comment: http://stackoverflow.com/comment/37959048
tagged with: java
tagged with: twitter
type: Question
has body: I want to implement ActionBarBullTorefresh in my android project but it give me errors. Here are the code. Please help me. package com.mejorandola.android; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONObject; import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher; import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher.OnRefreshListener; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.ListView; import android.widget.Toast; import com.mejorandola.android.adapter.TweetAdapter; import com.mejorandola.android.models.Tweet; import com.mejorandola.android.utils.ConstantsUtils; import com.mejorandola.android.utils.TwitterUtils; public class TimelineActivity extends Activity implements OnRefreshListener{ private ListView listView; private PullToRefreshAttacher pullToRefreshAttacher; private void updateListView(ArrayList&lt;Tweet&gt; tweets){ listView.setAdapter(new TweetAdapter(this, R.layout.row_tweet, tweets)); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_timeline); listView = (ListView)findViewById(R.id.list); new GetTimeLineTask().execute(); pullToRefreshAttacher = PullToRefreshAttacher.get(this); pullToRefreshAttacher.addRefreshableView(listView, this); } class GetTimeLineTask extends AsyncTask&lt;Object, Void, ArrayList&lt;Tweet&gt;&gt;{ private ProgressDialog progressDialog; @Override protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(TimelineActivity.this); progressDialog.setTitle(getResources().getString(R.string.label_tweet_search_loader)); progressDialog.show(); } @Override protected ArrayList&lt;Tweet&gt; doInBackground(Object... arg0) { ArrayList&lt;Tweet&gt; tweets = new ArrayList&lt;Tweet&gt;(); try { String timeline = TwitterUtils.getTimelineForSearchTerm(C…
score: 0
has comment: http://stackoverflow.com/comment/37958889
answer count: 1
has title: How to use ActionBarPullToRefresh on android
has comment: http://stackoverflow.com/comment/37959146
has comment: http://stackoverflow.com/comment/37959118
tagged with: android
has comment: http://stackoverflow.com/comment/37959028
has answer: http://stackoverflow.com/a/24965674
type: UnansweredQuestion
tagged with: android-actionbar

http://stackoverflow.com/comment/37905020
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24487248
has text: I am using a SignalComparator Class which implements Comparator interface to sort my map based on the bandwidth value of each signal in the map

http://stackoverflow.com/comment/37831464
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24446280
has text: So what i have to do to resolve the issue?

http://stackoverflow.com/a/24605449
upvote count: 2
downvote count: 1
score: 1
has body: Yes, you can. When you do: connection.prepareStatement(sqlquery2); It creates a new statement object using the same connection. So the ResultSets that you obtain from them will belong to different Statements and will be different and there will be NO PROBLEM for you. In short: Different Statements manage different ResultSets. If you get 2 ResultSets from the same Statement when you get the second one the first one will be dropped but if you have 2 Statements you can manage 2 ResulSets without problem (while the connection is open, of course)
answers question: http://stackoverflow.com/q/24585884
type: Answer

http://stackoverflow.com/a/24487285
answers question: http://stackoverflow.com/q/24487181
has comment: http://stackoverflow.com/comment/37905424
downvote count: 0
has body: In terms of performance is more efficient re-using a previously created socket. But this don't need to be the best solution, it depends on each case. The idiom case is having a ServerSocket in the server side that returns a Socket each time a new client connects to to it. If you require multiple clients to work against the server you could create a Thread to treat each client passing it the returned Socket. Moreover, you don't need a method to verify you have a client already connected, ServerSocket returns a new Socket each time it happens. Please, read more about this topic in Oracle tutorials.
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37935664
accepted answer of: http://stackoverflow.com/q/24487181
type: Answer

http://stackoverflow.com/q/24487391
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24487711
type: UnansweredQuestion
has title: Will ConcurrentHashMap with concurrencyLevel as 1 work as HashMap
tagged with: java
type: Question
has body: I created a `ConcurrentHashMap with following values : ConcurrentHashMap&lt;String,String&gt; concurrentHashMap = new ConcurrentHashMap&lt;&gt;(10,.9F,1); Above means only 1 thread can update the map at a given point of time. If this is the case then can I say that it will work like HashMap in case of concurrency .i.e.; only one write operation will be performed at a given point of time. Is my understanding correct or am I missing something here?
has answer: http://stackoverflow.com/a/24487524

http://stackoverflow.com/comment/37838353
has text: Says WARNING: Request method 'GET' not supported. Do I need to add Get method also in RequestMethod?
comment on: http://stackoverflow.com/a/24448809
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24782089
type: Answer
downvote count: 0
score: 1
has body: Apart from the limitations, you can check a little information about Package org.apache.poi.hssf.record.pivottable Though if I will have to do the same, I would create the table/chart manually once and will update the chart using apache poi as I have done here
upvote count: 1
answers question: http://stackoverflow.com/q/24554046

http://stackoverflow.com/comment/37823293
comment on: http://stackoverflow.com/q/24443351
score: 0
has text: when you run it second time means? what you are exactly doing?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37823285
comment on: http://stackoverflow.com/q/24443565
type: Comment
type: QuestionComment
has text: Is [`scala.collection.immutable.Stream`](http://www.scala-lang.org/api/2.11.1/index.html#scala.collection.immutable.Stream) not acceptable?
score: 2

http://stackoverflow.com/a/24516574
answers question: http://stackoverflow.com/q/24516479
type: Answer
has comment: http://stackoverflow.com/comment/37959164
has body: Just for the record, it is is pretty simple using the Jackson tree model. Here is an example: public class JacksonTree { public static final String JSON = "{ \"Person\" : { \"age\" : \"2\", " + "\"Location\" : \"san jose\"} }"; public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.readTree(JSON) .get("Person").get("Location").asText()); } } Output: san jose
has comment: http://stackoverflow.com/comment/37958801
score: 0
accepted answer of: http://stackoverflow.com/q/24516479
has comment: http://stackoverflow.com/comment/37959616
type: AcceptedAnswer

io
tags question: http://stackoverflow.com/q/24485303
tags question: http://stackoverflow.com/q/24474492
tags question: http://stackoverflow.com/q/24512909
tags question: http://stackoverflow.com/q/24529720
tags question: http://stackoverflow.com/q/24433908
tag name: io
tags question: http://stackoverflow.com/q/24477648
tags question: http://stackoverflow.com/q/24487641
tags question: http://stackoverflow.com/q/24481999
tags question: http://stackoverflow.com/q/24480095
tags question: http://stackoverflow.com/q/24435819
tags question: http://stackoverflow.com/q/24531089
type: Tag
tags question: http://stackoverflow.com/q/24484022
tags question: http://stackoverflow.com/q/24498423
tags question: http://stackoverflow.com/q/24464564
tags question: http://stackoverflow.com/q/24556629

http://stackoverflow.com/comment/37798350
type: AnswerComment
has text: hmm should i change my GetAllRow method in the second example too? @Girish Nair
type: Comment
comment on: http://stackoverflow.com/a/24430011
score: 0

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/24453602
type: Tag

http://stackoverflow.com/comment/37979803
comment on: http://stackoverflow.com/a/24525553
type: Comment
has text: Try removing .html extension in your request. If it solves it.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24505351
accepted answer of: http://stackoverflow.com/q/24505131
type: AcceptedAnswer
upvote count: 7
type: Answer
answers question: http://stackoverflow.com/q/24505131
downvote count: 0
score: 7
has body: The following is the way to do batch processing using hibernate. Keep in mind this is not 100% tested. It's kind of pseudo logic. int i=0; int batch = 100; List&lt;myNumber&gt; numList = getEntityManager().createQuery("select t.myNumber from myTable t").setFirstResult(i).setMaxResults(batch).getResultList(); while(numList.size() == batch){ //process numList i+=batch; numList = getEntityManager().createQuery("select t.myNumber from myTable t").setFirstResult(i).setMaxResults(batch).getResultList(); } Hibernate documentation for setFirstResult() and setMaxResults()

http://stackoverflow.com/a/24437737
type: Answer
has comment: http://stackoverflow.com/comment/37812572
has comment: http://stackoverflow.com/comment/41739931
has comment: http://stackoverflow.com/comment/37815846
has comment: http://stackoverflow.com/comment/41097275
has comment: http://stackoverflow.com/comment/38260034
has body: Google has released ADT v23.0.2. This solved many problems of previous ADT version 23. Step-by-step: Menu Help → Install New Software... For "Work with", select the Android source https://dl-ssl.google.com/android/eclipse Tick ADT v23.0 for installation, then click "Next" Eclipse will show "Install Remediation Page" since there is conflict with previous version. (If it does not, see below.) Select "Update my installation to be compatible with items being installed" to uninstall the old version and install the new one. After that, proceed with the usual steps. Note: When I installed the new version of ADT, I didn't include the new version of "Android Native Development Tools" package. Instead, I installed the rest of packages first, and then installed "Android Native Development Tools". For a reason, if I try to install all the new packages including "Android Native Development Tools", the installation fails. If there is no "Remediation page", the only way to remove the ADT plugin from Eclipse is to go to menu Help → About Eclipse → Installation Details and uninstall from there. But there is a risk of uninstalling Eclipse itself.
has comment: http://stackoverflow.com/comment/37882157
has comment: http://stackoverflow.com/comment/37812284
has comment: http://stackoverflow.com/comment/45624608
has comment: http://stackoverflow.com/comment/37826642
upvote count: 201
has comment: http://stackoverflow.com/comment/37815046
has comment: http://stackoverflow.com/comment/38109977
has comment: http://stackoverflow.com/comment/49176229
has comment: http://stackoverflow.com/comment/37861069
has comment: http://stackoverflow.com/comment/37815697
has comment: http://stackoverflow.com/comment/39315416
has comment: http://stackoverflow.com/comment/37851224
has comment: http://stackoverflow.com/comment/37816003
has comment: http://stackoverflow.com/comment/37816055
has comment: http://stackoverflow.com/comment/37825538
has comment: http://stackoverflow.com/comment/37847424
downvote count: 8
has comment: http://stackoverflow.com/comment/37847487
has comment: http://stackoverflow.com/comment/37812708
score: 193
has comment: http://stackoverflow.com/comment/37824201
has comment: http://stackoverflow.com/comment/37819533
answers question: http://stackoverflow.com/q/24437564
has comment: http://stackoverflow.com/comment/37815951
has comment: http://stackoverflow.com/comment/37890902

http://stackoverflow.com/a/24490240
score: 3
has body: This technique is called Method chaining Each method call retuns an object which is then in turn used to call another method which returns an other object and son on. Here is how you can read it (Object types are only assumptions): StringBuilder sb = new StringBuilder("Exception encountered when quiting driver: "); WebUXDriver w = WebUIDriver.getWebUXDriver(); Config c = w.getConfig(); Browser b = c.getBrowser(); sb.append(b.name()); sb.append(":"); sb.append(ex.getMessage()); String line = sb.toString(); TestLogging.log(line);
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24490062
type: Answer
answers question: http://stackoverflow.com/q/24490062
downvote count: 0

http://stackoverflow.com/comment/37874172
has text: Rather than declaring a `new Thing[X][Y]`, declare a `new Thing[X]` and then loop and set the arrays to the correct size.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24471104
type: Comment

http://stackoverflow.com/q/24458956
has answer: http://stackoverflow.com/a/24459823
type: Question
tagged with: alexa-internet
tagged with: pagerank
tagged with: java
linked to: http://stackoverflow.com/q/3676376
has answer: http://stackoverflow.com/a/24459394
tagged with: web-crawler
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/37851417
favorite count: 0
has body: I'm trying to write a script which will crawl current top 10 PR/Alexa sites. since PR/Alexa frequently changes. so my script should take care of this I mean if today there is not a site in top 10 but could be tomorrow. I dont know how to start with. I know crawling concepts but here I'm stuck. there could be top50 sites or even top500 sites. which I can configure of course. I read about Google spider but its very complicated for this simple task. How do Google,Yahoo,Bing crawl billions of sites around the web. I'm just curious. what is the cursor point, I mean how google can Identify newly launch site. Ok these are very deep details, I would read about these later. right now I'm more concern about my problem. how could I crawl top10 PR sites. Can you provide a sample program so that I can understand better?
type: UnansweredQuestion
tagged with: python
has title: Algorithm of crawling Top10 PR/Alexa sites
score: -1
has comment: http://stackoverflow.com/comment/56194168
downvote count: 1

http://stackoverflow.com/a/31941289
downvote count: 1
has comment: http://stackoverflow.com/comment/124550242
score: 4
has body: Unfortunately RecyclerView is missing a couple of features that ListView had built-in. For example the ability to add an OnItemClickListener that triggers when an item is clicked. RecyclerView allows you to set an OnClickListener in your adapter, but passing on that click listener from your calling code, to the adapter and to the ViewHolder, is complicated for catching a simple item click. public class ItemClickSupport { private final RecyclerView mRecyclerView; private OnItemClickListener mOnItemClickListener; private OnItemLongClickListener mOnItemLongClickListener; private View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { if (mOnItemClickListener != null) { RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v); } } }; private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mOnItemLongClickListener != null) { RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v); } return false; } }; private RecyclerView.OnChildAttachStateChangeListener mAttachListener = new RecyclerView.OnChildAttachStateChangeListener() { @Override public void onChildViewAttachedToWindow(View view) { if (mOnItemClickListener != null) { view.setOnClickListener(mOnClickListener); } if (mOnItemLongClickListener != null) { view.setOnLongClickListener(mOnLongClickListener); } } @Override public void onChildViewDetachedFromWindow(View view) { } }; private ItemClickSupport(RecyclerView recyclerView) { mRecyclerView = recyclerView; mRecyclerView.setTag(R.id.item_click_support, this); mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener); } public static ItemClickSupport addTo(RecyclerView view) { ItemClickSupport support = (ItemClickSupport) v…
answers question: http://stackoverflow.com/q/24471109
upvote count: 5
type: Answer

http://stackoverflow.com/comment/38058600
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24563823
has text: Thanks for helping :) I edited the post for more information.
score: 0

http://stackoverflow.com/comment/38062037
type: AnswerComment
comment on: http://stackoverflow.com/a/24549986
type: Comment
has text: that doesn't give the solution when i go to Install New Software then shows error conflict dependency
score: 0

http://stackoverflow.com/comment/37880040
score: 0
type: Comment
type: QuestionComment
has text: It's seems that's a UTF-8 problem, because there is "é" in the url. So my var urlenf contains url like : "www.exemple.com/pédalier", and the loop stop whith that. But if I put in urlenf : "www.exemple.com/p%C3%A9dalier", the loop works. How could I correct that ?
comment on: http://stackoverflow.com/q/24465320

http://stackoverflow.com/comment/37956772
comment on: http://stackoverflow.com/a/24494169
has text: Since the problem is related to the IBM VM, I don't understand why a bug in Oracle's VM should be relevant here?
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/q/24480504
favorite count: 0
has body: I've been programming in Java for about six months now and have done many work with Graphics in JPanels and JFrames. But recently I got a problem. All the JFrames I've been making before were always setUndecorated(false), but I needed to make one that was setUndecorated(true). So I tried, like usual, just putting the frame.setUndecorated(true) above all the frame's specs, so it looked something like this: public static void main(String[] args){ JFrame frame = new JFrame("Frame"); frame.setUndecorated(true); frame.setSize(600, 800); frame.setVisible(true); frame.add(new custompanel()); } And the custompanel class: public class custompanel{ public void paintComponent(Graphics g){ g.fillRect(100, 100, 100, 100); } } The g in custompanel doesn't paint anything. However, if I remove the frame.setUndecorated(true) or change it to frame.setUndecorated(false) it will paint a rectangle. Any thoughts?
type: AnsweredQuestion
downvote count: 0
tagged with: jframe
tagged with: swing
type: Question
tagged with: graphics
accepted answer: http://stackoverflow.com/a/24480565
score: 1
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/24480565
upvote count: 1
answer count: 1
has title: Java: Undecorated JFrame not displaying Graphics?

http://stackoverflow.com/comment/37829342
type: AnswerComment
comment on: http://stackoverflow.com/a/24446591
score: 0
type: Comment
has text: thanks, ant -Dfile.encoding=UTF-8 build-xmlbeans did the trick

http://stackoverflow.com/comment/37826916
score: 1
comment on: http://stackoverflow.com/q/24444265
type: Comment
type: QuestionComment
has text: [This answer](http://stackoverflow.com/questions/20351916/how-to-make-my-watermark-text-in-any-pdf-file-as-non-selectable/20361261#20361261) among other stuff contains code for using outline-only overcontent marks. It is using iText/Java but should be easy to translate for iTextSharp/C#.

http://stackoverflow.com/comment/37932789
comment on: http://stackoverflow.com/a/24498544
has text: Acutally, it worked for one entity. I don't know why for this entity is not working.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37937001
type: AnswerComment
comment on: http://stackoverflow.com/a/24504387
has text: *"Gotta love Nimbus."* I think the 'Gotta' part is debatable. I've considered a PLAF changer combo. that filters Nimbus out. ;)
type: Comment
score: 0

http://stackoverflow.com/a/29443931
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24482578
score: 1
upvote count: 1
has body: the error message "You, or this app's Open Graph Test User, must have published this action at least once" means: before you require this permission, you must call the api at least once. I have occur this kind error before. when I require publish_actions permission, the facebook tell me this: then I used my app call /me/feed api post a feed, then the error disappeared. if you are the owner, developers or test users of the app, you can use these api before review approval. you can add roles for app in dashboard.

http://stackoverflow.com/q/24497555
tagged with: java
linked to: http://stackoverflow.com/q/10090829
has body: This is not another noob question about referencing. I have a framework that when compiled...generate a JAR file...As of now I just reference as an external JAR. The problem is, I need to edit the framework and I don't want to constantly export framework project and recompile my main project. I need to to be where I compile the main project and it compiles the referenced JAR file from the framework project. How to reference a different Java project in Eclipse Doesnt work...this is not a web project. I also tried: Adding a reference between Eclipse Java projects Doesnt work. How is this really done?
tagged with: eclipse
linked to: http://stackoverflow.com/q/4798694
type: Question
has answer: http://stackoverflow.com/a/24499169
answer count: 2
downvote count: 0
tagged with: jar
possible better answer: http://stackoverflow.com/a/24498014
has answer: http://stackoverflow.com/a/24498014
accepted answer: http://stackoverflow.com/a/24499169
tagged with: reference
favorite count: 0
has title: Reference Output JAR Of Project In Another Project Eclipse
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/31899338
has body: From most of the answers above, they seem to be setting their onclicklisteners to individual items. However, the solution am about to offer is very simple but yet not intuitive to many. Many are forgetting that the other components are always in a parent component which is used to display items in the List or Recycler views. This solution is just about setting a single onclick listener to this parent view and the turn is played. The solution also includes a way to pass the position of the item being clicked on from the list or recycler view. Here, our main rootview is a CardView from the android support library. Here is sample code public class ListAdapter extends RecyclerView.Adapter&lt;ListAdapter.ViewHolder&gt; { public static final String LOG_TAG = ListAdapter.class.getSimpleName(); private Cursor mDataset; private Context mContext; private ViewHolder mViewHolder; // Provide a suitable constructor (depends on the kind of dataset) public ListAdapter(Context context, Cursor Dataset) { mDataset = Dataset; mContext = context; } // Create new views (invoked by the layout manager) @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // create a new view View v = LayoutInflater.from(parent.getContext()) .inflate(R.layout.list_business_view, parent, false); mViewHolder = new ViewHolder(v); return mViewHolder; } public void setData(Cursor newdata) { this.mDataset = newdata; } // Replace the contents of a view (invoked by the layout manager) @Override public void onBindViewHolder(ViewHolder holder, int position) { //Bind data to other items here. To save time, i have ommited that. //here is where we attach a click listerner for an item in the recycler list rather than for each element of a given item. holder.card.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mContext, " Just cliked item at position " + itemPosition, Toast.LENGTH_LONG).show(); } }); } } // Return the size of your dataset (…
answers question: http://stackoverflow.com/q/24471109
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24520834
answers question: http://stackoverflow.com/q/24520833
has body: I found a way which apparently should create an SSLSocket based on a SSLContext which is based on a TrustManager which trusts mykeystore. The trick is, we need to load the keystore in to a custom trust manager, such that the SSLSocket is based on an SSLContext which trusts my own self-signed certificate. This is done by loading the keystore into the trust manager. The code I found to do this was as follows: KeyStore keyStore = KeyStore.getInstance("JKS"); keyStore.load(getResources().openRawResource(R.raw.mykeystore), "MY_PASSWORD".toCharArray()); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); SSLContext sslctx = SSLContext.getInstance("TLS"); sslctx.init(null, trustManagerFactory.getTrustManagers(), new SecureRandom()); SSLSocketFactory factory = sslctx.getSocketFactory(); Which promptly failed. java.security.KeyStoreException: java.security.NoSuchAlgorithmException: KeyStore JKS implementation not found Apparently, Android doesn't support JKS. It has to be in the BKS format. So I found a way to convert from JKS to BKS by running the following command: keytool -importkeystore -srckeystore mykeystore.jks -destkeystore mykeystore.bks -srcstoretype JKS -deststoretype BKS -srcstorepass MY_PASSWORD -deststorepass MY_PASSWORD -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath bcprov-jdk15on-150.jar Now, I have a file called mykeystore.bks which is exactly the same as mykeystore.jks, except in BKS format (which is the only format Android accepts). Using "mykeystore.bks" with my Android app, and "mykeystore.jks" with my server, it works! Client output: Connected to server /SERVER_IP_ADDRESS: 8081 Sending request: Hello World Received from the Server: You said 'Hello World'! Server output: received: Hello World response: You said 'Hello World'! We're done! The SSLServerSocket / SSLSocket connection between my Android application and my server is n…
accepted answer of: http://stackoverflow.com/q/24520833
type: Answer
upvote count: 4
downvote count: 0
score: 4
type: AcceptedAnswer

maven-3
tags question: http://stackoverflow.com/q/24514272
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/24579236
tags question: http://stackoverflow.com/q/24576059
tags question: http://stackoverflow.com/q/24519849

http://stackoverflow.com/q/24534142
has comment: http://stackoverflow.com/comment/37991101
has comment: http://stackoverflow.com/comment/37991177
type: Question
has comment: http://stackoverflow.com/comment/37991106
has comment: http://stackoverflow.com/comment/37991314
answer count: 2
tagged with: sorting
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/24534536
has answer: http://stackoverflow.com/a/24534392
has answer: http://stackoverflow.com/a/24534536
favorite count: 0
has comment: http://stackoverflow.com/comment/37991381
has title: Sorting ArrayList of Objects by objects property and organize them
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has body: I am writing a Java app which is supposed to read an input file with records on each line and the fields are seperated by commas. The output of the application should be on stdout in format as follows: Age1 Sex1 name1 name2 Sex2 name3 name4 e.g 33 Female Jayanta Kanupriya 44 Female Lajjo Rajjo Male Raghav Sitaram and so on.... I created a class Person to hold the data and implemented the Comparable interface with the compareTo interface doing primary sorting on age and secondary sorting on Sex. I can add tertiary sorting on name later. public class Person implements Comparable&lt;Person&gt;{ private String name; private int age; private String sex; /** * @param age, sex and name */ public Person(String name, int age, String sex) { this.setName(name); this.setAge(age); this.setSex(sex); } //getters and setters @Override public int compareTo(Person person) { return this.age &lt; person.getAge()?-1:this.age &gt; person.getAge()?1:sortOnGender(person); } public int sortOnGender(Person person) { if (this.sex.compareToIgnoreCase(person.getSex()) &lt; 0) { return -1; } else if (this.sex.compareToIgnoreCase(person.getSex()) &gt; 0) { return 1; } else { return 0; } } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(this.age)).append('-').append(this.sex).append('-').append(this.name); return sb.toString(); } } Next in the App class in main method I have created an ArrayList of Persons and populated the data and used Collections.sort() to sort. I printed the ArrayList and its coming in sorted order. However the problem is how do I get the data in the desired format. import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; public class App { //An array of persons private static List&lt;Person&gt; persons = new ArrayList&lt;Pe…
accepted answer: http://stackoverflow.com/a/24534392
tagged with: java

http://stackoverflow.com/a/44323508
upvote count: 7
answers question: http://stackoverflow.com/q/24551962
downvote count: 0
score: 7
has body: Revisiting this after some time because I had the same issue. I found another solution that does not need to buffer the output in a String: Write only the XML-declaration by passing an empty document. This will also append a linebreak. Write the document content without XML-declaration Code: StreamResult streamResult = new StreamResult(writer); // output XML declaration with an empty document transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.transform(new DOMSource(), streamResult); // output the document without XML declaration transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(new DOMSource(doc), streamResult);
type: Answer

http://stackoverflow.com/comment/38075159
type: AnswerComment
has text: **Note: volatile variable can be cached, depends on memory consistency model of architecture.** I don't understand context. cфn be cached WHERE?
type: Comment
comment on: http://stackoverflow.com/a/24579198
score: 0

http://stackoverflow.com/q/24436216
tagged with: groovy
answer count: 1
downvote count: 1
favorite count: 0
has title: Storm acking and failing
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: apache-storm
has body: The bolts we are using are all based on BaseBasicBolt, which is supposed to ensure that the input tuple for execute gets acked by default. After reading the documentation, it appeared we were not doing this right as we were not failing tuples when an exception was caught. So let's say your topology looks like this, where all bolts are BaseBasicBolts: Spout -&gt; Bolt A -&gt; Bolt B -&gt; Bolt C If an error happens in Bolt B we now call this: basicOutputCollector.getOutputter().fail(inputTuple) Is that enough to ensure that a failure at Bolt B will cause the tuple that failed at B to get kicked out of the topology?
type: Question
has answer: http://stackoverflow.com/a/24911559
upvote count: 2

http://stackoverflow.com/comment/38029861
type: Comment
type: QuestionComment
has text: You actually don't specify the package name. See this link for more details. [http://www.oracle.com/technetwork/java/compile-136656.html#comp]
score: 0
comment on: http://stackoverflow.com/q/24554931

http://stackoverflow.com/a/24560064
type: Answer
answers question: http://stackoverflow.com/q/24537594
score: 0
has body: By the way, Kafka 0.8.1.1 use gradle, and not sbt. That's why you don't have the sbt file in your directory.

apk
tags question: http://stackoverflow.com/q/24551822
tags question: http://stackoverflow.com/q/24515150
tag name: apk
type: Tag
tags question: http://stackoverflow.com/q/24505517

http://stackoverflow.com/q/24562875
favorite count: 0
type: Question
score: 3
tagged with: elasticsearch
upvote count: 3
has answer: http://stackoverflow.com/a/24582473
answer count: 1
tagged with: java
has title: ElasticSearch date mapping
has comment: http://stackoverflow.com/comment/38075291
tagged with: date
accepted answer: http://stackoverflow.com/a/24582473
type: AnsweredQuestion
downvote count: 0
has body: I want to map the following date String as it comes out of new Date().toString() Thu Jul 03 19:17:19 CEST 2014 but ElasticSearch gives me always the Errormessage Invalid format: "Thu Jul 03 19:17:19 CEST 2014" is malformed at "CEST 2014" and I have no idea what goes wrong. This is the mapping for the test type { "properties" : { "postDate" : { "type" : "date", "format" : "EEE MMM dd HH:mm:ss z yyyy" } } } I think it has the right pattern. I even tried to increase the number of 'z', but same error. So is there a solution or do I have to find a diffrent approch.

smartgwt
tags question: http://stackoverflow.com/q/24456769
type: Tag
tags question: http://stackoverflow.com/q/24427658
tags question: http://stackoverflow.com/q/24535782
tag name: smartgwt

http://stackoverflow.com/comment/37881575
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24474712
score: 0
has text: Alon Zilberman, thank you man for the answer, nevertheless there was still nothing on the screen after camera code update, though it was something that made me keep digging. Finally, I have loaded a `Windows BMP` tileset and voila, it worked. Thus, there is something with `PNG` maps or `Tiled Map Editor 0.8`. Why is everything not so simple? I have also checked `TmxMapLoader` fields deeper in debugger and found that `pixmap` is null but the size fields are ok.

http://stackoverflow.com/comment/95034787
type: AnswerComment
has text: Which 'Utils' are you using?
type: Comment
comment on: http://stackoverflow.com/a/49117195
score: 0

http://stackoverflow.com/a/24563132
has comment: http://stackoverflow.com/comment/45014685
upvote count: 1
has comment: http://stackoverflow.com/comment/38141494
type: Answer
has body: You're POSTing your credentials to "/api/accounts/j_spring_security_check", while the monitored URL is just "/j_spring_security_check". You should construct the action URL in the form using: &lt;c:url value="/j_spring_security_check"/&gt; So the result would be: &lt;form name="f" action="&lt;c:url value="/j_spring_security_check"/&gt;" method="post"&gt; Update after changed question... Your authentication fails throwing Exception or returning null. The result of call to your UserDetailsProvider are checked like this (inside DaoAuthenticationProvider) with the result of throwing AuthenticationServiceException: try { loadedUser = this.getUserDetailsService().loadUserByUsername(username); } catch (UsernameNotFoundException notFound) { throw notFound; } catch (Exception repositoryProblem) { throw new AuthenticationServiceException(repositoryProblem.getMessage(), repositoryProblem); } if (loadedUser == null) { throw new AuthenticationServiceException( "UserDetailsService returned null, which is an interface contract violation"); } You should: improve your code to include some logging start debugger and go through your code to see what fails or returns null or implement a custom AuthenticationFailureHandler which will print complete content of the exception it receives as a parameter and plug it instead of the default one
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24535164
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24535164

http://stackoverflow.com/comment/37895237
has text: My only alternative language is C# and even then just for Unity game development. Java is my main language. I don't mind jumping through hoops! Can you point me in a direction?
score: 0
comment on: http://stackoverflow.com/a/24482110
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37936978
score: 1
has text: Generally error code is returned from Database, then it's the job of the wrapper to show the user understandable message based on the code. So probably all this is done in the database driver.jar.
comment on: http://stackoverflow.com/q/24504712
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24453787
has comment: http://stackoverflow.com/comment/37848547
type: Answer
has comment: http://stackoverflow.com/comment/37853576
has comment: http://stackoverflow.com/comment/37846903
score: 1
answers question: http://stackoverflow.com/q/24446280
has comment: http://stackoverflow.com/comment/37841683
upvote count: 1
has comment: http://stackoverflow.com/comment/37897808
has body: You should add this property ; &lt;property name="validationQuery" value="SELECT 1" /&gt; This will validate the connection ,and if mysql closed the connection your app won't try to send packet.
has comment: http://stackoverflow.com/comment/37880841
has comment: http://stackoverflow.com/comment/37841873
downvote count: 0

http://stackoverflow.com/a/24487056
upvote count: 1
has comment: http://stackoverflow.com/comment/37904460
accepted answer of: http://stackoverflow.com/q/24486777
has comment: http://stackoverflow.com/comment/37905390
has comment: http://stackoverflow.com/comment/37905176
answers question: http://stackoverflow.com/q/24486777
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37904693
type: Answer
score: 1
has body: You can get it by two method. One is SQLException#getErrorCode() which will return an int, vendor-specific exception code for the SQLException object, and compare the int ( I don't know the exception code for "Invalid hex digit", but may be you can get this with System.out.println() ) And other method is you can get exception message by Throwable#getMessage() and check the message string. Further you can refer : Retrieving Exceptions

http://stackoverflow.com/comment/37967484
type: Comment
comment on: http://stackoverflow.com/a/24520788
type: AnswerComment
has text: I'm behind a firewall, but I use Chrome (through firewall) to get the certificate. And does it mean I need to ask IT to get the original certificate? Like the certificate I download without a proxy or firewall?
score: 0

http://stackoverflow.com/comment/38140803
has text: The title is currently "Passing actual parameters in a spock unit test specification". This question doesn't really have anything to do with parameter passing. You should give the question a title which better describes what is being asked.
score: 0
comment on: http://stackoverflow.com/q/24569534
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24445549
tagged with: http://stackoverflow.com/tag/xml
score: 1
tagged with: java
tagged with: jaxb
upvote count: 1
type: Question
tagged with: eclipse
has body: I'm trying to create java classes from xsd file. I used jaxb plugin from the link here. Now I am using eclipse-java-helios-SR2-win32 version. After added the plugin, I couldn't able to access JAXB project. But JAXB project (Jaxb - 2.1 and 2.2) is working fine in Kepler versions. But, I need JAXB Version 2.0 specifically. That's why I am using older eclipse versions. Any help?
has answer: http://stackoverflow.com/a/28330643
has title: Configure JAXB plugin for eclipse
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: xsd

http://stackoverflow.com/comment/38076388
type: QuestionComment
has text: @Downvoter, may I inquire as to why?
score: 0
comment on: http://stackoverflow.com/q/24579859
type: Comment

http://stackoverflow.com/q/24431088
has answer: http://stackoverflow.com/a/24431467
tagged with: android
type: UnansweredQuestion
has title: Leadbolt ad integration in libgdx
tagged with: libgdx
tagged with: java
type: Question
score: 0
has body: I'm new in Libgdx and I'm trying to show leadbolt ads in my app. i've found a forum thread http://www.badlogicgames.com/forum/viewtopic.php?f=11&amp;t=9072&amp;p=41323#p41323 about communicating with android and libgdx. I've build the related interfaces and etc. interface works well, i've tried to give message on showAd() and it works well. But when i'm trying to add the given code from leadbolt, it shows error on "this". Code is attached below. I guess that this has a very simple solution but my java knowledge not enough for this solution :) public class AndroidBrowserOpener implements ActionResolver{ private AdController ad; @Override public void showAd() { // TODO Auto-generated method stub ad = new AdController(this, "my ad id"); ad.loadAd(); } } My Main Activity public class MainActivity extends AndroidApplication { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new fatNinja(new AndroidBrowserOpener())); super.onCreate(savedInstanceState); } } Core Interface public interface ActionResolver { public void showAd(); } I'm calling showAd() from the main inside create(). Thanks for the replies. Edit: Thanks for the answer, i've found a context example from badlogic forums like below, but not showing ads. it gives error: E/LBAdController(5088): loadAd() failed - A Valid Activity not passed code is below: public class AndroidBrowserOpener implements ActionResolver { private AdController ad; public AndroidBrowserOpener(Context context){ ad = new AdController(context, "my id"); } @Override public void showAd() { // TODO Auto-generated method stub ad.loadAd(); System.out.println("it works"); } }
answer count: 1
tagged with: leadbolt

http://stackoverflow.com/comment/37862935
comment on: http://stackoverflow.com/a/24448088
type: AnswerComment
type: Comment
score: 1
has text: Thanks a bunch! I tried to figure out what's wrong with my code for hours, I guess I didn't notice that.

http://stackoverflow.com/comment/39309532
type: QuestionComment
has text: The client needed the listening socket to already exist so it could connect to it. Surely this is obvious?
score: 0
comment on: http://stackoverflow.com/q/24497951
type: Comment

http://stackoverflow.com/comment/37971630
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24519197
score: 0
has text: Annoying that the GetInt didn't work though. Thanks for your help!

http://stackoverflow.com/comment/37894640
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24481528
has text: does rs.next() happen by default? I never saw to do this explicitly?

http://stackoverflow.com/a/24526294
score: 1
has comment: http://stackoverflow.com/comment/37979907
upvote count: 1
has comment: http://stackoverflow.com/comment/38041599
answers question: http://stackoverflow.com/q/24526165
has comment: http://stackoverflow.com/comment/38001941
type: Answer
has body: You are doing it wrong. Change the loop from if to while You are populating JTextField when the loops end you will see only last values because other is over write. change it into System.out.println(); and adjust your GUI accordingly
downvote count: 0

http://stackoverflow.com/q/24557698
favorite count: 0
has comment: http://stackoverflow.com/comment/38035779
tagged with: bouncycastle
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/24559782
linked to: http://stackoverflow.com/q/11783062
has comment: http://stackoverflow.com/comment/38035128
tagged with: java
has comment: http://stackoverflow.com/comment/38037741
has body: I am attempting to encrypt/decrypt strings using AES-256-CBC and BouncyCastle. I have completed this for keys that are of length 16 bytes (128 bits) but I am required to use a key of 128 bytes (1024 bits). I have read numerous suggestions on SO and found that the restricted policy files for the JVM I am using had not been installed. This, theoretically, should allow keys greater than 128 bits to be used. However, after installing the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction policy files to my jdk (1.6.0.jdk/Contents/Home/lib/security) the issue remains. The code I am using to encrypt a String is as follows: String my_key = "2bc7fa12d..." // String of length 128 Security.addProvider(new BouncyCastleProvider()); byte[] original = my_key.getBytes(); key = new SecretKeySpec(original, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC"); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] encrypted = cipher.doFinal(toEncrypt.getBytes()); byte[] encryptedValue = Base64.encode(encrypted); return new String(encryptedValue); But after replacing the .jar's found in the Unlimited JCE download I still experience the error: java.security.InvalidKeyException: Key length not 128/192/256 bits. at org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineInit(Unknown Source) at javax.crypto.Cipher.init(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at EncyrptionTest.encrypt(EncyrptionTest.java:58) at EncyrptionTest.main(EncyrptionTest.java:33) Any advice or solutions to this issue would be greatly appreciated. Edit: As requested, the code I am trying to port from Ruby into Java is as follows: WithCred.entials_for(:to_encrypt) do |c| attr_encrypted :my_key, :algorithm =&gt; 'aes-256-cbc', :key =&gt; c[:key] end The gem it uses to encrypt (I believe) is attr_encypted. (I am afraid I know very little about Ruby)
downvote count: 1
type: Question
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/38037629
answer count: 1
has comment: http://stackoverflow.com/comment/38038273
has comment: http://stackoverflow.com/comment/38038646
has title: InvalidKeyException using BouncyCastle and Unlimited JCE
has comment: http://stackoverflow.com/comment/38035015

http://stackoverflow.com/comment/38077035
type: Comment
has text: have you added the `import` for your class?
type: QuestionComment
comment on: http://stackoverflow.com/q/24580166
score: 0

http://stackoverflow.com/q/24453762
has body: I have empId as 600 and custId as 400 under session object. I want to apply jstl function on it. Basically i want to apply my project specific Taglib function on "600-400" i tried like below "${myProject:Taglib(${sessionScope.empId}-${sessionScope.custId})}" but getting below error javax.el.ELException: Failed to parse the expression [${myProject:TaglibFunction(${sessionScope.empId] I know i can do it in two separate lines i.e &lt;c:set var="intermediateVar" value="${sessionScope.empId}-${sessionScope.custId}" scope="page" /&gt; var finalValue= "${myProject:TaglibFunction(intermediateVar)}"; But is there a way i can do it in single line ?
answer count: 1
has answer: http://stackoverflow.com/a/24454336
favorite count: 0
tagged with: el
type: UnansweredQuestion
has title: how to use nested EL in this case?
has comment: http://stackoverflow.com/comment/37845210
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: jstl
score: 0

http://stackoverflow.com/comment/38083059
type: AnswerComment
score: 0
type: Comment
has text: All right the Canvas lock part makes sense. By frameTime, do you mean my delta? How exactly would I use that? Would I need to recalculate that in the inner while loop as well? Or just keep using the delta found above?
comment on: http://stackoverflow.com/a/24561791

http://stackoverflow.com/comment/38136505
type: Comment
type: QuestionComment
has text: If the code compiles, your classpath is OK. The attached source message is just about pulling in the source code as Paul mentions in his answer. docx4j on its own isn't enough however, you may find you need to install the various dependencies as listed here: http://www.docx4java.org/downloads.html
comment on: http://stackoverflow.com/q/24575110
score: 0

http://stackoverflow.com/q/24483199
accepted answer: http://stackoverflow.com/a/24483426
downvote count: 0
answer count: 7
score: 8
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/36815996
has answer: http://stackoverflow.com/a/24487284
has comment: http://stackoverflow.com/comment/37899857
has answer: http://stackoverflow.com/a/24484915
linked to: http://stackoverflow.com/q/18172257
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24483360
has comment: http://stackoverflow.com/comment/37898236
has comment: http://stackoverflow.com/comment/37897351
has comment: http://stackoverflow.com/comment/37898631
has answer: http://stackoverflow.com/a/24483360
tagged with: java
has body: Problem: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. My code: (which works fine) public static void main(String[] agrs){ int prevFirst=0; int prevSecond=1; int bound=4_000_000; int evenSum=0; boolean exceed=false; //when fib numbers &gt; bound while(!exceed){ int newFib=prevFirst + prevSecond; prevFirst = prevSecond; prevSecond = newFib; if(newFib &gt; bound){ exceed=true; break; } if(newFib % 2 == 0){ evenSum += newFib; } } System.out.println(evenSum); } I'm looking for a more efficient algorithm to do this question. Any hints?
type: Question
has comment: http://stackoverflow.com/comment/37898531
has answer: http://stackoverflow.com/a/37517523
has comment: http://stackoverflow.com/comment/37897782
has answer: http://stackoverflow.com/a/24483426
has answer: http://stackoverflow.com/a/40174314
tagged with: algorithm
has title: More efficient solution: Project Euler #2: Even Fibonacci Numbers
has comment: http://stackoverflow.com/comment/37898589

http://stackoverflow.com/a/24539360
has body: These words are keywords in many other languages, and it could be confusing if they were used as identifiers.
score: 5
has comment: http://stackoverflow.com/comment/38001069
answers question: http://stackoverflow.com/q/24539332
upvote count: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24539332
type: Answer

http://stackoverflow.com/q/24551133
has answer: http://stackoverflow.com/a/24551223
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has title: Run code on application crash
score: -1
accepted answer: http://stackoverflow.com/a/24551223
has body: I want to run a block of code whenever my server crashes. However, the only way I can think about is to write a client checking if there's open for connections. Are there any way I can write some code on the actual server, being run just before the server shuts down?
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38022659
favorite count: 0

http://stackoverflow.com/a/24494715
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37919435
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37918725
has body: You can use reflections for this like that: Field f = Yourclass.class.getDeclaredField("logger"); f.setAccessible(true); f.set(Yourclass.class, yourMock ); When you need to search for your field up to super class, you could make some look-up loop: Class clazz = Yourclass.class; while ( clazz != null ) { Field f = null; try { f = clazz.getDeclaredField( "logger" ); } catch ( NoSuchFieldException e ) { clazz = clazz.getSuperclass(); } if ( f != null ) { f.setAccessible( true ); //here we must hack final modifier for field Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(f, f.getModifiers() &amp; ~Modifier.FINAL); //here pass your object which should contain logger field f.set( yourObject, mock(mockSomeClass) ); break; } }
answers question: http://stackoverflow.com/q/24494550
has comment: http://stackoverflow.com/comment/37918657
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24494550
has comment: http://stackoverflow.com/comment/37919262

http://stackoverflow.com/a/24495222
upvote count: 0
has body: Try this: if(protoInterface.getClass().isAssignableFrom(handler.getClass())
score: -1
answers question: http://stackoverflow.com/q/24495111
downvote count: 1
type: Answer

http://stackoverflow.com/q/24573020
has answer: http://stackoverflow.com/a/34367370
answer count: 1
has comment: http://stackoverflow.com/comment/38066283
favorite count: 0
has comment: http://stackoverflow.com/comment/38065392
has comment: http://stackoverflow.com/comment/38068159
upvote count: 4
tagged with: quicksort
has comment: http://stackoverflow.com/comment/38065205
type: AnsweredQuestion
tagged with: microbenchmark
has title: JMH microbenchmarking recursive quicksort
downvote count: 0
tagged with: java
type: Question
tagged with: benchmarking
has comment: http://stackoverflow.com/comment/38067047
accepted answer: http://stackoverflow.com/a/34367370
has body: Hello I'm trying to micro benchmark various sorting algorithms and I got a strange problem with jmh and benchmarking quicksort. Maybe there is something wrong with my implementation. I would be interested if someone could help me to see where is the problem. First of all I use ubuntu 14.04 with jdk 7 and jmh 0.9.1. Here is how I try to do a benchmark: @OutputTimeUnit(TimeUnit.MILLISECONDS) @BenchmarkMode(Mode.AverageTime) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 1) @State(Scope.Thread) public class SortingBenchmark { private int length = 100000; private Distribution distribution = Distribution.RANDOM; private int[] array; int i = 1; @Setup(Level.Iteration) public void setUp() { array = distribution.create(length); } @Benchmark public int timeQuickSort() { int[] sorted = Sorter.quickSort(array); return sorted[i]; } @Benchmark public int timeJDKSort() { Arrays.sort(array); return array[i]; } public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder().include(".*" + SortingBenchmark.class.getSimpleName() + ".*").forks(1) .build(); new Runner(opt).run(); } } There are other algorithms, but I left them out as they are more or less OK. Now quicksort for some reason is extremely slow. Magnitudes of time slower! And even more - I need to assign more stack space for it to run without StackOverflowException. It looks like for some reason quicksort just does a lot of recursive calls. The interesting thing is that when I simply run algorithm in my main class - it runs fine (with same random distribution and 100000 elements). No need for stack increase and simple nanotime benchmark shows times that are very close to other algorithms. And in benchmark JDK sort is very fast when testing with jmh and much more in line with other algorithms with naive nanotime benchmarking. Am I doing something wrong here or miss something? Here is my quicksort algorithm: public static int[] quickSort(int[] data) { Sorter.quickSort(…
score: 4
has comment: http://stackoverflow.com/comment/38065713
tagged with: jmh

http://stackoverflow.com/comment/38014862
type: QuestionComment
score: 0
has text: Where is that bean declared? How is it loaded and initialized?
comment on: http://stackoverflow.com/q/24546793
type: Comment

http://stackoverflow.com/comment/37832123
type: Comment
has text: I have not double escaped quotes. I have not done exactly in your way i have just used process builder instead of action.execute() and it worked fine.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24446386

http://stackoverflow.com/comment/37931347
type: Comment
score: 0
type: QuestionComment
has text: Okay, I made the changes.
comment on: http://stackoverflow.com/q/24501372

http://stackoverflow.com/a/24474202
answers question: http://stackoverflow.com/q/24474141
score: 0
has body: There is no problem with javac not being on your PATH, since the error you see is an error from javac, which could only occur if javacis on your path and running. The only possibility is that hello.java is not in the current working directory from which you are invoking the command. Putting the directory that hello.java lives in onto your PATH will not help here.
type: Answer

http://stackoverflow.com/q/24477235
has comment: http://stackoverflow.com/comment/37885656
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37885682
score: -1
has comment: http://stackoverflow.com/comment/37885657
has title: Two buttons, it mix between the links
has answer: http://stackoverflow.com/a/24477301
has body: Two buttons, it mix between the links I have a page with two buttons, when I had the first button, it took me to the link, when I had the second button, the first stopped and the second took me to the second link, help! PageOne.jave package com.d.di; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class PageOne extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.abus); setContentView(R.layout.weoff); } } MainActivity.java package com.d.di; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button = (Button) findViewById(R.id.abus); button = (Button) findViewById(R.id.weoff); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, PageOne.class); startActivity(intent); } }); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, PageOne.class); startActivity(intent); } }); } }
downvote count: 1
has comment: http://stackoverflow.com/comment/37885639
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 0

http://stackoverflow.com/comment/37905636
comment on: http://stackoverflow.com/q/24487095
type: Comment
type: QuestionComment
score: 1
has text: Here is my plan for world domination: 1) Prefer the `enum` Singleton pattern. 2) Realize that Singletons are a bad idea to begin with, no matter how you implement them. 3) Educate people on stackoverflow why Singletons are a bad idea. 4) Retire and drink Margaritas on the beach.

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/24487301
tags question: http://stackoverflow.com/q/24503393
type: Tag

http://stackoverflow.com/comment/38082647
has text: thanks for that i have tried it but it keeps having problems and i find the GUI is not a lot different, i cannot believe that professional developers use eclipse for Android to develop all the apps i see on the web. there must be a much better developer platform? that is more GUI reliable, and easy to use. and a lot more stable.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24564105

http://stackoverflow.com/comment/38087117
type: QuestionComment
has text: @JBNizet Thanks for the link. So I wasn't so far off the mark then! Obviously it's a feature others have wanted if it's going to be part of Java 8. Maybe you could add this as a sort of answer (with some basic commentary)?
comment on: http://stackoverflow.com/q/24585677
score: 0
type: Comment

http://stackoverflow.com/comment/37995323
has text: Thanks a bunch sailingthorns, this worked perfectly and I can definitely understand why the array for the sums was needed. I suppose I was stuck on summing all of the elements of a column one at a time in order instead of spreading it out and summing each incrementally. Thanks again!
comment on: http://stackoverflow.com/a/24518322
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24531526
score: 1
has body: Without using timestamp, you have these options: Keep a record of all previously generated numbers -- of course you have to store them somewhere, which is unwieldy Store the previous number, and increment each time. Simply assume that the PRNG will never come up with the same number twice. Since there are 2^64 == 1.8 * 10^19 possible values, this is a very safe bet.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24531366
upvote count: 1

http://stackoverflow.com/q/24546945
tagged with: serial-port
has title: How to read weight from a scale that reports weight continously =001.100 and so on?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24547015
type: Question
has body: I am trying to read weight from a scale that reports weight continuously .i.e., it keeps sending =000.000=001.100=001.100 and so on. I am able to read it using this generic serial port reader. But it don't know how to receive only the weight in double. I don't want the = only 001.100 as a double. the scale reports other weights =000.999 too before settling down to a max value say =001.100. How can I solve this? case SerialPortEvent.DATA_AVAILABLE: byte[] readBuffer = new byte[20]; try { // read data int numBytes = inputStream.read(readBuffer); inputStream.close(); String strWeight = new String(readBuffer, 0, numBytes, "UTF-8"); Weight=Double.parseDouble(strWeight);
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24547015

http://stackoverflow.com/comment/37810592
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24436871
has text: It would be helpful if you include in your question all the compilation error messages you are getting in all your tests.

http://stackoverflow.com/a/34692899
has body: If you want to base this on the metadata of the document, all you will get is estimates (according to the Microsoft specs). There are essentially two values which you can play around with: GKPIDSI_CHARCOUNT (which is what you already accessed in your own code sample) GKPIDDSI_CCHWITHSPACES Don't ask me about the exact differences of those two values, though. I haven't designed this stuff... Below is a code sample to illustrate the access to them (GKPIDDSI_CCHWITHSPACES is a little awkward): HWPFDocument document = [...]; SummaryInformation summaryInformation = document.getSummaryInformation(); System.out.println("GKPIDSI_CHARCOUNT: " + summaryInformation.getCharCount()); DocumentSummaryInformation documentSummaryInformation = document.getDocumentSummaryInformation(); Integer count = null; for (Property property : documentSummaryInformation.getProperties()) { if (property.getID() == 0x11) { count = (Integer) property.getValue(); break; } } System.out.println("GKPIDDSI_CCHWITHSPACES: " + count); The moment at which Word's internal algorithm that updates those values kicks in is rather unpredictable to me. So what you see in Word's own statistics may not necessarily be the same as when running the above code.
has comment: http://stackoverflow.com/comment/57269763
accepted answer of: http://stackoverflow.com/q/24571072
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/57266708
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24571072

http://stackoverflow.com/q/24452506
possible better answer: http://stackoverflow.com/a/24452599
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37839313
type: Question
accepted answer: http://stackoverflow.com/a/24452603
has title: Constructor error in my sub class constructor
has answer: http://stackoverflow.com/a/24452599
answer count: 2
has answer: http://stackoverflow.com/a/24452603
upvote count: 1
downvote count: 0
has body: Here is the Assignment: Design and implement a class representing a Person along with 3 subclasses using the following guidelines: a.Create a class named Person and its three subclasses named Employee, Student, Retired. b.The Person has the following data fields: name, year_of_birth, isStudying, and isEmployed. It also has methods for setting and getting the values of each of the fields along with a method to calculate the current age and display the status of a Person. A constructor that sets the isStudying and isEmployed fields to false is also included in the Person class. You are welcome to add additional data fields and methods if you like. 1.Finally, create a Java test class that simulates using your Person class. In your test class you should at a minimum: a) Construct 4 instances of a Person, b) print the names of your instances c) print the status of your instances based on the values of their age, isStudying and isEmployed attributes. public class Person2 {//begin class //declare variables String name; int year_of_birth; boolean isStudying; boolean isEmployed; int age; public Person2(String name, int year_of_birth, boolean isEmployed, boolean isStudying, int age){//begin constructor this.name = name; this.year_of_birth = year_of_birth; this.isEmployed = false; this.isStudying = false; this.age = age; }//end constructor public int getYear(){//get year method return year_of_birth; }//end method public String getName(){//get name method return name; }//end method public boolean getEmployed(){//get employed method return isEmployed; }//end method public boolean getStudying(){//get employed method return isStudying; }//end method public int getAge(){//get year method age = 2014 - year_of_birth; return age; }//end method public void setName(String name){//set name method this.name = name; }//end method public void setYear (int year){//set year method this.year_of_birth = year; }//end method public void setEmployed(boolean employed){//set employed method this.isE…
favorite count: 0
tagged with: constructor
tagged with: subclass

http://stackoverflow.com/a/24440905
has comment: http://stackoverflow.com/comment/37818373
has comment: http://stackoverflow.com/comment/37818442
has body: Because semantically you are creating two different things, whose type just happens to match. On the left hand side you are creating a reference, and on the right hand side you are creating an operator, and the assignment operator connects one to the other. Also, the type of the reference can be different from the type of the object. E.g. List&lt;? extends Number&gt; list = new ArrayList&lt;Integer&gt;(); If you adopted your solution of writing the type only once, how would you deal with this problem? However, the semantic sugar in Java 7 to avoid writing the type twice when it is intended to be the same is welcome, even if it can be confusing. For example, if the following works: List&lt;? extends Number&gt; list = new ArrayList&lt;Integer&gt;(); list = new ArrayList&lt;&gt;(); Then does list point towards an ArrayList&lt;Integer&gt; or an ArrayList&lt;Number&gt; ? I don't know if the code snippet above works in Java seven, but if it does I am uncomfortable with the idea that changing the reference type in one part of the code can change the type of object instantiated elsewhere, it could create very brittle code.
score: 0
answers question: http://stackoverflow.com/q/24440728
type: Answer

http://stackoverflow.com/a/24503478
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24499119
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24499119
type: Answer
has body: To use static method from SpEL you should study more about the last one: &lt;entry key="success" value="#{T(com.my.proj.pack.ClassLoader).getSystemResource("icons"+File.separator+"png"+File.separator+"24x24"+File.separator+"OK.png")}" /&gt;

http://stackoverflow.com/comment/37974158
comment on: http://stackoverflow.com/q/24524446
type: Comment
type: QuestionComment
has text: @mKorbel, I am not expected an exact solution here, I am just hoping to hear some general suggestions or hints that point me to right direction. Thanks
score: 0

http://stackoverflow.com/q/24456361
tagged with: itext
type: Question
has answer: http://stackoverflow.com/a/24456543
has body: I have a web application that will generate a PDF from data and allow a user to download. We have a custom font so I am registering four font files (regular, bold, italic, and bold italic ttf files). Is this necessary? Can I just use the regular font file and set the weight/styles through the font class or do I need all the files? It looks like it works ok but I am still learning. What is a good strategy or pattern for managing these different fonts to put into my documents? Has anyone done much with this from a Java perspective?
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/24456543
tagged with: fonts
type: AnsweredQuestion
tagged with: java
has title: iText Font Strategy

http://stackoverflow.com/comment/38028923
has text: You should always use `curly brackets { }` around your blocks, such as `if(something.equals(whatever)) { System.out.println("Hello!"); }` because lack of brackets can cause hidden errors later
comment on: http://stackoverflow.com/q/24553155
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37925479
type: QuestionComment
has text: What kind of database doesn't support transactions? :) [I'm assuming this is your case](http://docs.oracle.com/cd/E13222_01/wls/docs60/informix4/API_jinf4.html#647593). So you're running a non-ANSI, non logging database? Just out of curiosity, what is the benefit of having an Informix database configured that way?
comment on: http://stackoverflow.com/q/24494964
score: 0
type: Comment

http://stackoverflow.com/q/24579087
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/24585757
answer count: 1
has comment: http://stackoverflow.com/comment/38076933
tagged with: listener
has comment: http://stackoverflow.com/comment/38076570
has comment: http://stackoverflow.com/comment/38081418
has comment: http://stackoverflow.com/comment/38075645
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38075456
score: 0
tagged with: mouselistener
tagged with: java
has answer: http://stackoverflow.com/a/24585757
has comment: http://stackoverflow.com/comment/38079133
type: Question
tagged with: actionlistener
has title: ActionListener & MouseListener confliction
has body: I am trying to make my application minimize on taskbar and restore when I double click on the trayIcon. I also have a popup menu that has an item which restores the window when clicked. trayIcon = new TrayIcon(image, "Anything", popup); trayIcon.addActionListener(actionListener); trayIcon.addMouseListener(mouseListener); sysTray.add(trayIcon); And here is the code of the actionListener and mouseListener: private ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Restore")) { // RIGHT CLICK -&gt; RESTORE // Do something } } }; private MouseListener mouseListener = new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (javax.swing.SwingUtilities.isLeftMouseButton(e) &amp;&amp; e.getClickCount()&gt;1) { // DOUBLE LEFT MOUSE CLICK // Do something } } // Rest of the code } The Restore option of the popup menu works fine, however when I am double-clicking on the trayIcon at the System Tray I get a Null Pointer Exception at line if(e.getActionCommand().equals("Restore")) How can I eliminate this and if possible merge both listeners into one?

http://stackoverflow.com/comment/38070520
type: AnswerComment
has text: I don't think it's a problem of autoboxing. In the first example the pointer to i is changed after inserting, in the second example the object myc itself is changed.
type: Comment
comment on: http://stackoverflow.com/a/24576603
score: 1

http://stackoverflow.com/comment/37803873
has text: No- I haven't added any columns as such- just a row with the column headings. Presumably then, I should get rid of that row, and add the three columns as you've indicated instead?
comment on: http://stackoverflow.com/q/24432812
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24500450
upvote count: 1
has body: In an application I have a portlet rendered in a popup menu. Click of a button renders the popup modal box and PortletA is rendered in it. I want to access a pre set session variable in the doView of PortletA. But the value is always null. Can a portlet in popup menu has access to session variables in Liferay 6.2?
has comment: http://stackoverflow.com/comment/37970327
has comment: http://stackoverflow.com/comment/37931968
downvote count: 0
type: UnansweredQuestion
has title: How to access Session variables in Popup portlet - Liferay 6.2
score: 1
tagged with: session-variables
favorite count: 0
type: Question
tagged with: liferay-6
answer count: 0
tagged with: java

http://stackoverflow.com/a/24502651
type: Answer
has comment: http://stackoverflow.com/comment/37972542
has body: contentType: false, Try the above. This will force jQuery to generate the contentType headers and it will include the boundary information. If you sniff the http message that you are sending to the server you will see that now you are sending something like this Content-Type: multipart/form-data; boundary=???
score: 0
answers question: http://stackoverflow.com/q/24475134

http://stackoverflow.com/a/24568615
has comment: http://stackoverflow.com/comment/38056051
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24568525
has comment: http://stackoverflow.com/comment/38056241
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24568525
has comment: http://stackoverflow.com/comment/38056402
has body: You could try the below regex, ^([^-]*)-(.*)$ And the java regex would be, "^([^-]*)-(.*)$" DEMO First captured group contains all the numbers before - and the second captured group contains all the numbers which are after to - To get only the first and second numbers without spaces, String s = "+7312xxxx - +7657xxxx"; Pattern p = Pattern.compile("^([^\\s-]*)\\s*-\\s*(.*)$"); Matcher m = p.matcher(s); while (m.find()) { System.out.println(m.group(1)); System.out.println(m.group(2)); } Output: +7312xxxx +7657xxxx Ideone
has comment: http://stackoverflow.com/comment/38055889
score: 4
has comment: http://stackoverflow.com/comment/38055832
type: AcceptedAnswer

http://stackoverflow.com/comment/37967700
comment on: http://stackoverflow.com/a/24521388
has text: I'm probably wrong about getErrorStream(), as you would normally only call it after getResponseCode(). I should have added that if you use fixed-length or chunked transfer model, writing is direct, it isn't deferred like this. The deferral is only so it can set content-length for you, which isn't necessary in those modes.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37941729
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24506289
has text: @Santino'Sonny'Corleone I'm use brdbd class under line so i can't remove that line

http://stackoverflow.com/a/24507639
answers question: http://stackoverflow.com/q/24507445
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: On Ubuntu the recommended way seems to be to add the line JAVA_HOME=/usr/lib/jvm/default-java to /etc/environment and use the update-alternatives tool to manage the actual jvm. You may have a script in /etc/profile.d/ overriding this which should be removed. You can see which java alternatives are currently installed and available by running: update-java-alternatives --list To choose a jvm to use, run the following command with whatever version suits you: update-java-alternatives --set java-1.7.0-openjdk-amd64

http://stackoverflow.com/comment/41320322
has text: Thanks for this. I have been looking for this for months. :) Finally I do not need see those _ebean_intercept items in my code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24674593
type: AnswerComment

http://stackoverflow.com/comment/37894979
type: Comment
comment on: http://stackoverflow.com/a/24481508
has text: @Niknea you already got the guide in [this answer](http://stackoverflow.com/a/24472525/2587435). Are you actually going to look at it this time?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37795437
score: 0
type: Comment
has text: Hi I would appreciate if you could provide your inputs based on my comment to @Chrylis.
comment on: http://stackoverflow.com/a/24428320
type: AnswerComment

http://stackoverflow.com/a/24580712
has body: The ITelephony interface is internal, so you cannot get a standard reference to it. You could use reflection all the way, i.e. TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); Method m1 = tm.getClass().getDeclaredMethod("getITelephony"); m1.setAccessible(true); Object iTelephony = m1.invoke(tm); Method m2 = iTelephony.getClass().getDeclaredMethod("silenceRinger"); Method m3 = iTelephony.getClass().getDeclaredMethod("endCall"); m2.invoke(iTelephony); m3.invoke(iTelephony); But either way those methods need the MODIFY_PHONE_STATE permission, which can only be granted to system apps. So I'm afraid it won't work anyway.
type: Answer
has comment: http://stackoverflow.com/comment/43719993
has comment: http://stackoverflow.com/comment/38078607
upvote count: 21
has comment: http://stackoverflow.com/comment/87510437
has comment: http://stackoverflow.com/comment/74736808
score: 21
accepted answer of: http://stackoverflow.com/q/24580508
has comment: http://stackoverflow.com/comment/90964576
answers question: http://stackoverflow.com/q/24580508
has comment: http://stackoverflow.com/comment/64435168
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38078625
has comment: http://stackoverflow.com/comment/47054561

http://stackoverflow.com/a/24557792
type: AcceptedAnswer
downvote count: 0
has body: The setMinimumFractionDigits will set the minimum number of digits in the fraction portion of the number. NumberFormat formatter = NumberFormat.getNumberInstance(Locale.GERMANY); formatter.setMaximumFractionDigits(2); formatter.setMinimumIntegerDigits(2); formatter.setMinimumFractionDigits(2); System.out.println((formatter.format(new BigDecimal(100)))); // prints "100,00"
type: Answer
has comment: http://stackoverflow.com/comment/38035381
accepted answer of: http://stackoverflow.com/q/24557708
upvote count: 5
answers question: http://stackoverflow.com/q/24557708
has comment: http://stackoverflow.com/comment/38036859
score: 5

http://stackoverflow.com/comment/61732018
type: QuestionComment
comment on: http://stackoverflow.com/q/24565020
has text: @KBR- here is a paper for your amusement...it is entitled "processing XML with java - a performance benchmark" http://sdiwc.us/digitlib/journal_paper.php?paper=00000582.pdf
score: 0
type: Comment

swiperefreshlayout
type: Tag
tags question: http://stackoverflow.com/q/24587925
tag name: swiperefreshlayout

http://stackoverflow.com/a/24522994
upvote count: 1
has body: Tryt to replace your adapter code with this. public class CompetitionResultListAdapter extends BaseAdapter { private Activity activity; private ArrayList&lt;Result&gt; result; DataManager datamanager; @Override public int getCount() { return result!=null ? result.size() : 0; } @Override public Object getItem(int position) { return result.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView==null){ holder = new ViewHolder(); convertView = LayoutInflater.from(activity).inflate(R.layout.list_item_competition_result, null, false); holder.listItemDate = (EditText) convertView.findViewById(R.id.date); holder.listItemPlace = (EditText) convertView.findViewById(R.id.place); holder.listItemComment = (EditText) convertView.findViewById(R.id.comment); convertView.setTag(holder); }else{ holder = (ViewHolder)convertView.getTag(); } holder.listItemDate = (EditText) convertView.findViewById(R.id.date); holder.listItemPlace = (EditText) convertView.findViewById(R.id.place); holder.listItemComment = (EditText) convertView.findViewById(R.id.comment); result.get(position).setDate(listItemDate.getText().toString()); result.get(position).setPlace(listItemPlace.getText().toString()); result.get(position).setComment(listItemComment.getText().toString()); return convertView; } class ViewHolder { EditText listItemDate; EditText listItemPlace; EditText listItemComment; } public void refreshResultList(ArrayList&lt;Result&gt; result){ this.result = result; notifyDataSetChanged(); } }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37972136
score: 1
answers question: http://stackoverflow.com/q/24522703

http://stackoverflow.com/comment/37905957
type: Comment
has text: also when inside "//sync code for obj instance" i call to other methods?
type: AnswerComment
comment on: http://stackoverflow.com/a/24487818
score: 0

http://stackoverflow.com/comment/38078774
comment on: http://stackoverflow.com/q/24580873
type: Comment
type: QuestionComment
has text: Unless you use escape sequences to move the cursor ^^
score: 0

http://stackoverflow.com/q/24525727
has answer: http://stackoverflow.com/a/24525787
score: -1
has answer: http://stackoverflow.com/a/24525785
possible better answer: http://stackoverflow.com/a/24525783
has comment: http://stackoverflow.com/comment/37975159
has answer: http://stackoverflow.com/a/24525959
has comment: http://stackoverflow.com/comment/37975579
has title: Returning an object from a method
favorite count: 0
has comment: http://stackoverflow.com/comment/37975161
has body: I have defined a method called "findRegion()" with a return type "Screen". Eventhough at the end of the my method I return a "Screen" object, my eclipse IDE still shows an error regarding return type mismatch. The method is as follows: public Screen findRegion(){ try{ Screen screen = new Screen(); int x = screen.find("C:\\Users\\skhan\\Desktop\\Images\\VVX500\\Capture2.PNG").getX() - 10; int y = screen.find("C:\\Users\\skhan\\Desktop\\Images\\VVX500\\Capture2.PNG").getY() - 10; int w = x + 370; int h = y + 300; screen.setRect(x,y,w,h); return screen; } catch(FindFailed e){ e.printStackTrace(); } } The objective of this code is to create a region with the respective dimensions. Kindly suggest the errors in my code. Thank You
answer count: 5
has comment: http://stackoverflow.com/comment/37975139
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37975132
has answer: http://stackoverflow.com/a/24525783
tagged with: java
has answer: http://stackoverflow.com/a/24525788
accepted answer: http://stackoverflow.com/a/24525788
type: Question
has comment: http://stackoverflow.com/comment/37975138
upvote count: 0

http://stackoverflow.com/q/24437564
has answer: http://stackoverflow.com/a/24480207
has comment: http://stackoverflow.com/comment/37835884
has comment: http://stackoverflow.com/comment/44389104
has answer: http://stackoverflow.com/a/24828896
tagged with: eclipse
has answer: http://stackoverflow.com/a/24450781
has answer: http://stackoverflow.com/a/24437803
has answer: http://stackoverflow.com/a/26237056
has comment: http://stackoverflow.com/comment/37831383
has answer: http://stackoverflow.com/a/24448503
has answer: http://stackoverflow.com/a/24500955
has comment: http://stackoverflow.com/comment/38001316
has comment: http://stackoverflow.com/comment/38709823
has answer: http://stackoverflow.com/a/24777848
has answer: http://stackoverflow.com/a/24752656
has answer: http://stackoverflow.com/a/25212793
has answer: http://stackoverflow.com/a/24448771
has comment: http://stackoverflow.com/comment/37817652
has comment: http://stackoverflow.com/comment/38596836
accepted answer: http://stackoverflow.com/a/24455640
has comment: http://stackoverflow.com/comment/37826738
has answer: http://stackoverflow.com/a/25357091
has comment: http://stackoverflow.com/comment/37814797
has comment: http://stackoverflow.com/comment/37814820
has answer: http://stackoverflow.com/a/24453171
has answer: http://stackoverflow.com/a/24439028
has comment: http://stackoverflow.com/comment/37825861
has comment: http://stackoverflow.com/comment/37835148
has comment: http://stackoverflow.com/comment/37812945
favorite count: 0
has answer: http://stackoverflow.com/a/24762403
has answer: http://stackoverflow.com/a/27496105
score: 620
has answer: http://stackoverflow.com/a/24549723
has comment: http://stackoverflow.com/comment/37873215
has comment: http://stackoverflow.com/comment/37830093
has answer: http://stackoverflow.com/a/24454988
has answer: http://stackoverflow.com/a/24549211
has comment: http://stackoverflow.com/comment/41072032
upvote count: 622
tagged with: android
has answer: http://stackoverflow.com/a/24990730
has comment: http://stackoverflow.com/comment/37878968
linked to: http://stackoverflow.com/q/24438748
has answer: http://stackoverflow.com/a/24450223
has answer: http://stackoverflow.com/a/24503051
has answer: http://stackoverflow.com/a/24442754
has body: I updated Eclipse with the new SDK tools (rev. 23), but now when Eclipse starts I receive the error: This Android SDK requires Android Developer Toolkit version 23.0.0 or above. Current version is 22.6.3.v201404151837-1123206. Please update ADT to the latest version. No updates were found with "Check for updates". If I try "Install new software", I can see version 23, but I can't upgrade due to the following error: Cannot complete the install because of a conflicting dependency. Software being installed: Android Development Tools 23.0.0.1245622 (com.android.ide.eclipse.adt.feature.feature.group 23.0.0.1245622) Software currently installed: Android Developer Tools 22.2.1.v201309180102-833290 (com.android.ide.eclipse.adt.package.product 22.2.1.v201309180102-833290) Only one of the following can be installed at once: ADT Package 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt.package 22.6.3.v201404151837-1123206) ADT Package 23.0.0.1245622 (com.android.ide.eclipse.adt.package 23.0.0.1245622) Cannot satisfy dependency: From: Android Development Tools 23.0.0.1245622 (com.android.ide.eclipse.adt.feature.feature.group 23.0.0.1245622) To: com.android.ide.eclipse.adt.package [23.0.0.1245622] Cannot satisfy dependency: From: Android Development Tools 22.6.3.v201404151837-1123206 (com.android.ide.eclipse.adt.feature.group 22.6.3.v201404151837-1123206) To: com.android.ide.eclipse.adt.package [22.6.3.v201404151837-1123206] Cannot satisfy dependency: From: ADT Package 22.2.1.v201309180102-833290 (com.android.ide.eclipse.adt.package.feature.group 22.2.1.v201309180102-833290) To: com.android.ide.eclipse.adt.feature.group 22.2.0 Cannot satisfy dependency: From: Android Developer Tools 22.2.1.v201309180102-833290 (com.android.ide.eclipse.adt.package.product 22.2.1.v201309180102-833290) To: com.android.ide.eclipse.adt.package.feature.group [22.2.1.v201309180102-833290] After download of the last ADT from the web site, it seems there's another problem. With SDK Tools rev. 23 …
has answer: http://stackoverflow.com/a/24438136
has comment: http://stackoverflow.com/comment/37813877
has answer: http://stackoverflow.com/a/25216079
has answer: http://stackoverflow.com/a/24438977
has title: Update Eclipse with Android development tools v. 23
has comment: http://stackoverflow.com/comment/38083239
has answer: http://stackoverflow.com/a/24447821
answer count: 43
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37838408
has comment: http://stackoverflow.com/comment/37813837
has comment: http://stackoverflow.com/comment/37980582
has answer: http://stackoverflow.com/a/24448709
has comment: http://stackoverflow.com/comment/37836143
linked to: http://stackoverflow.com/q/9097163
has answer: http://stackoverflow.com/a/25049891
downvote count: 2
has answer: http://stackoverflow.com/a/24439206
has answer: http://stackoverflow.com/a/24749910
has answer: http://stackoverflow.com/a/24526658
has answer: http://stackoverflow.com/a/24726143
has comment: http://stackoverflow.com/comment/37815117
has comment: http://stackoverflow.com/comment/37824278
has answer: http://stackoverflow.com/a/24455640
has comment: http://stackoverflow.com/comment/37815073
has comment: http://stackoverflow.com/comment/41097310
has answer: http://stackoverflow.com/a/24556377
possible better answer: http://stackoverflow.com/a/24437737
has answer: http://stackoverflow.com/a/24456942
type: Question
has answer: http://stackoverflow.com/a/25423839
has comment: http://stackoverflow.com/comment/38168185

http://stackoverflow.com/q/24579456
has title: final vairable initialization relative to super class constructor
tagged with: initialization
favorite count: 0
linked to: http://stackoverflow.com/q/15682457
tagged with: final
upvote count: 1
has answer: http://stackoverflow.com/a/24579498
tagged with: superclass
type: AnsweredQuestion
score: 1
tagged with: java
has body: As this (Initialize field before super constructor runs?) post states, all non static variables get initialized after the super class constructor runs, but in the following example, while debugging I see that the variable isn't initialized before the parent constructor runs, the print function prints the result "B=5" as if it was initialized. When I use a non final variable the result is "B=0" as expected. What's going on? here is the code: public class A { int a=77; public A(int i){ printMe(); } public void printMe(){ System.out.println("A "+a); } } public class B extends A{ //static int a=5; //test will print 5 final int a=5; //test will print 5 //int a=5; ////test will print 0 public B() { super(0); } public void printMe(){ System.out.println("B="+a); } public static void main(String[] args) { new B(); } }
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/24579498
answer count: 1

http://stackoverflow.com/comment/38064824
has text: no it does not it checks for key not pKey. Object o = pResult.get(key); which is from the maps keyset
type: AnswerComment
comment on: http://stackoverflow.com/a/24573693
score: 2
type: Comment

http://stackoverflow.com/a/24640028
has comment: http://stackoverflow.com/comment/38292128
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24575163
has body: I have this exact same issue. It appears to be something with the libraries not getting copied over or not found in the correct lib path on the device. Fwiw I'm running this from an emulator (if that matters), but I'm really stuck/frustrated

http://stackoverflow.com/a/24429932
has comment: http://stackoverflow.com/comment/37798810
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37800192
has comment: http://stackoverflow.com/comment/37798944
has body: The statement "from backward" is ambiguous i am assuming you want to read db in a particular order if you want to read in descending order of a field say 'foo' then String ORDER = "foo DESC";/*use ASC for ascending order*/ and Change the cod as follows public Cursor getAllRows() { String where = null; String Order = "foo DESC"; Cursor c = db.query(true, DATABASE_TABLE, ALL_KEYS, where, null, null, null,Order,null); if (c != null) { c.moveToFirst(); } return c; Here is the syntax of query public Cursor query (String table, String[] columns, String selection,String[] selectionArgs, String groupBy, String having, String orderBy, String limit) Refer to the below link for further explanantion SQLiteDatabase Android
downvote count: 0
has comment: http://stackoverflow.com/comment/37800204
has comment: http://stackoverflow.com/comment/37797939
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24429553
type: Answer
has comment: http://stackoverflow.com/comment/37799665
accepted answer of: http://stackoverflow.com/q/24429553

http://stackoverflow.com/comment/38068392
has text: Are you allowed to use frameworks for this? Is this a work related task or an assignment?
type: AnswerComment
comment on: http://stackoverflow.com/a/24575554
type: Comment
score: 0

http://stackoverflow.com/comment/37911903
type: Comment
type: QuestionComment
has text: The following statement is executed printf("PlayAudio: Failed To Get Class Reference\n")
comment on: http://stackoverflow.com/q/24490020
score: 0

http://stackoverflow.com/q/24546140
score: -1
tagged with: jsf-2
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24547001
type: AnsweredQuestion
has title: Importing class to JSF2 view to get the qualified name
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24547001
tagged with: java
tagged with: http://stackoverflow.com/tag/xhtml
has body: I did this in a JSP: &lt;%@ page import="org.example.applet.MyApplet"%&gt; &lt;% &lt;div class="panel-body"&gt; &lt;object type="application/x-java-applet" classid="java:&lt;%=MyApplet.class.getName()%&gt;.class" height="600" width="900"&gt; ... Applet failed to run. No Java plug-in was found. &lt;/object&gt; &lt;/div&gt; How can I "print the class name into the html/jsf2 view (in a xhtml)? Thanks!

http://stackoverflow.com/comment/37878378
score: 0
type: AnswerComment
has text: Ok, kolossus, Thank you for your help, i have your suggested solution very clear, what i don't have clear at all is the mentioned webservice style change to WRAPPED, what is supposed i should do to change my webservice style? Anyway, your answer help me a lot to clarify my doubts about this issue. Thank you again.
comment on: http://stackoverflow.com/a/24459669
type: Comment

hudson
type: Tag
tags question: http://stackoverflow.com/q/24509146
tag name: hudson

http://stackoverflow.com/comment/38047350
comment on: http://stackoverflow.com/q/24563998
score: 0
has text: The fun comes when you need to convert to a base *bigger* than 10... but I don't know if you need that
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24459077
possible better answer: http://stackoverflow.com/a/24459244
has answer: http://stackoverflow.com/a/24459244
answer count: 2
has title: maven plugin to create intellij files?
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24459094
has body: Is there a maven plugin to create intellij files? I have a maven project for which I would like to generate intellij files so that I can import it into my IDE. I know there is an eclipse plugin: http://maven.apache.org/plugins/maven-eclipse-plugin/ and I found a plugin for intellij as well however it says its retired, so I wasn't sure whether I should be using something else: http://maven.apache.org/plugins/maven-idea-plugin/ I'm following a tutorial that wants me to use eclipse but I would like to use intellij. The pom.xml of the tutorial uses eclipse plugin with these configurations: org.eclipse.m2e lifecycle-mapping 1.0.0 <lifecycleMappingMetadata> org.apache.felix maven-scr-plugin [1.0.0,) scr <ignore/> </lifecycleMappingMetadata> If I try to open the project in intellij then none of the imports work..
type: AnsweredQuestion
score: 1
tagged with: maven
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24459094
tagged with: java

http://stackoverflow.com/q/24538821
type: UnansweredQuestion
has title: How to change Image being displayed by JLabel?
tagged with: java
tagged with: swing
has body: I'm currently programming a video game. I'm using Util.Timer to keep track of multiple features of the game, but one of my issues is trying to change between background images. I'm trying to have the JPanel update to a new image every second, but so far no luck. I've used a JLabel to display the image inside the JPanel. I also make a call to displayFrame() after a second has passed. So now my question is how would I be able to update my JPanel every second with a new image? Here's my code: public static void displayFrame(){ panel_1.setBounds(10, 11, 519, 614); ImageIcon image = changeFrame(); JLabel label = new JLabel("", image, JLabel.CENTER); panel_1.add(label, BorderLayout.CENTER); frame.getContentPane().add(panel_1); } public static ImageIcon changeFrame(){ if(frameCounter == 9){ frameCounter = 1; } if(frameCounter == 1){ frameCounter = 2; return new ImageIcon("Capture.PNG"); } if(frameCounter == 2){ frameCounter = 3; return new ImageIcon("Capture2.PNG"); } if(frameCounter == 3){ frameCounter = 4; return new ImageIcon("Capture3.PNG"); } if(frameCounter == 4){ frameCounter = 5; return new ImageIcon("Capture4.PNG"); } if(frameCounter == 5){ frameCounter = 6; return new ImageIcon("Capture5.PNG"); } if(frameCounter == 6){ frameCounter = 7; return new ImageIcon("Capture6.PNG"); } if(frameCounter == 7){ frameCounter = 8; return new ImageIcon("Capture7.PNG"); } if(frameCounter == 8){ frameCounter = 9; return new ImageIcon("Capture8.PNG"); } if(frameCounter == 9){ frameCounter = 1; return new ImageIcon("Capture9.PNG"); } return new ImageIcon("Capture.PNG"); }
type: Question
tagged with: jpanel
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24538901
tagged with: jlabel
tagged with: timer

http://stackoverflow.com/comment/38245330
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24449595
score: 0
has text: Sorry, I am not familiar with maven / Ant.All i know is that i have to run build.xml.

http://stackoverflow.com/q/24493816
upvote count: 9
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37922134
possible better answer: http://stackoverflow.com/a/24494169
has comment: http://stackoverflow.com/comment/37917478
linked to: http://stackoverflow.com/q/15795637
has comment: http://stackoverflow.com/comment/37917137
has comment: http://stackoverflow.com/comment/37917144
has comment: http://stackoverflow.com/comment/37917107
has comment: http://stackoverflow.com/comment/37917189
type: AnsweredQuestion
has title: Are java.lang.Class methods thread safe?
tagged with: java
has body: Under IBM JVM we have faced an issue when multiple threads are trying to call Class.getAnnotation at the same time on different objects (but with the same annotation). Threads are starting to deadlock waiting on a monitor inside a Hashtable, which is used as a cache for annotations in IBM JVM. The weirdest thing is that the thread that is holding this monitor is put into 'waiting on condition' state right inside Hashtable.get, making all other threads to wait indefinitely. The support from IBM stated, that implementation of Class.getAnnotation is not thread safe. Comparing to other JVM implementations (for example, OpenJDK) we see that they implement Class methods in thread safe manner. IBM JVM is a closed source JVM, they do publish some source code together with their JVM, but it's not enough to make a clear judgment whenever their implementation of Class is thread safe or not. The Class documentation doesn't clearly state whenever its methods are thread safe or not. So is it a safe assumption to treat Class methods (getAnnotation in particular) as a thread safe or we must use sync blocks in multi threaded environment? How do popular frameworks (ex. Hibernate) are mitigating this problem? We haven't found any usage of synchronization in Hibernate code that was using getAnnotation method.
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/24506898
score: 9
type: Question
has comment: http://stackoverflow.com/comment/37918362
downvote count: 0
has answer: http://stackoverflow.com/a/24506898
has answer: http://stackoverflow.com/a/24494169
has comment: http://stackoverflow.com/comment/37919611
answer count: 2
has comment: http://stackoverflow.com/comment/37917453
has comment: http://stackoverflow.com/comment/37917110
has comment: http://stackoverflow.com/comment/37917427
has comment: http://stackoverflow.com/comment/37926851
tagged with: jvm
has comment: http://stackoverflow.com/comment/37917259
favorite count: 0

floating-point
tags question: http://stackoverflow.com/q/24482807
tags question: http://stackoverflow.com/q/24483985
type: Tag
tags question: http://stackoverflow.com/q/24480083
tag name: floating-point

http://stackoverflow.com/comment/38014714
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24532596
has text: From the logs: `02:29:56.349 [localhost-startStop-1] DEBUG o.s.b.f.xml.XmlBeanDefinitionReader - Loaded 0 bean definitions from location pattern [/WEB-INF/spring/root-context.xml]` The `root-context.xml` which you are specifying as `contextConfigLocation` in `web.xml` has no bean definitions
type: AnswerComment

http://stackoverflow.com/comment/38066181
score: 0
type: AnswerComment
has text: Thanks for your response, but this seems to be quite confusing. Is there an `openssl` command on the terminal that can be used to get the password?
type: Comment
comment on: http://stackoverflow.com/a/24559782

http://stackoverflow.com/comment/37914303
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24492218
type: Comment

http://stackoverflow.com/a/24456787
accepted answer of: http://stackoverflow.com/q/24456057
type: Answer
downvote count: 2
upvote count: 10
has body: I would say you don't need to access it. If something is private, then it's used as an implementation detail and should be invisible to the test. You should test the requirements of the class, not the implementation details. Why you ask? Because, over time, the implantation is likely to change (or evolve) while the requirements should be consistent.
answers question: http://stackoverflow.com/q/24456057
type: AcceptedAnswer
score: 8

http://stackoverflow.com/comment/37940097
type: AnswerComment
has text: A constructor call is not just another method call. It is however a special case of method call. During object construction the JVM will invoke a method that it has synthersized during compilation called <init>. In that method will be the code that you have added to the constructor. The life cycle around this code is special to the JVM, hence it is not just another method call. But for the purposes of the StackOverFlow that you saw, then yes that is the cause.
type: Comment
comment on: http://stackoverflow.com/a/24506138
score: 1

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/24573460
type: Tag

http://stackoverflow.com/comment/37853539
comment on: http://stackoverflow.com/q/24434421
has text: Also you can try the latest git, it may be fixed already.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24439843
has title: possible to Java override functions at an instance level?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24439901
has answer: http://stackoverflow.com/a/24439898
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/24439875
upvote count: 2
has comment: http://stackoverflow.com/comment/37816453
downvote count: 2
has answer: http://stackoverflow.com/a/24439875
answer count: 3
has body: I'm reviewing some Java code written long ago and not being a Java developer, I have a question. I found the following lines in the body of a class. Someone is creating an instance of SearchQueryParameter however there are curly braces following "new SearchQueryParameter" and it appears that someone overrode some functions here. My questions are the following. 1) Are these functions overwritten at an instance level? 2) Does this language feature have a name? public static final SearchQueryParameter X_POSTDOC_WORKFLOW_STEP = new SearchQueryParameter(128,"XPOSTDOCWorkflowStep",AdvancedFields.X_EVENT_POSTDOC_WFSTEP,SearchTypes.XEVENT_DOCUMENTS) { @Override protected int getFilterType() { return SEARCH_FILTER; } &lt;&lt;snip&gt;&gt; }; Thanks, mj
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/24439901

http://stackoverflow.com/q/24539573
answer count: 1
has comment: http://stackoverflow.com/comment/38017837
tagged with: objectoutputstream
score: 4
tagged with: java
has comment: http://stackoverflow.com/comment/38002804
tagged with: executable
upvote count: 4
type: AnsweredQuestion
has title: My executable .jar file won't write a save file
has comment: http://stackoverflow.com/comment/38001793
downvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/24548451
favorite count: 0
has body: I'm making a game for a school assignment, one of the features is that the game can be saved and loaded. While in eclipse everything worked but after making it an executable jar it won't create the file at the specified location. I am using this code to get it to save in the folder I want: see below for full code Note that the folders, quarto &amp; savefiles, are created but the save file itself isn't. I'm writing object to a .sav file using this code: see below for full code Does this have to do with permissions? Edit: Ran it in cmd, no exceptions when i tried to save. Added a java.policy file to the folder the jar was in, no difference. I got a previously saved file and put it in the quarto/savefiles map because I wanted to see if it did load correctly (this also uses the user.home to get to the right folder). It loaded correctly. I also searched for the savename.sav to see if it saved it somewhere else, didn't find anything. Full class: package quarto; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; public class TaskSpelOpslaan extends SpelGegevens{ public static void runSpelOpslaan() { String savename = SpelOpslaanScherm.getSaveName(); String userHome = System.getProperty("user.home") + File.separator + "quarto" + File.separator + "savefiles"; String locatie = userHome; File folder = new File(locatie); if (!folder.exists()) { folder.mkdirs(); } try{ if(!savename.contains(".sav")) { savename = (savename+".sav"); } else { return; } FileOutputStream saveFile=new FileOutputStream(folder+File.separator + savename); ObjectOutputStream save = new ObjectOutputStream(saveFile); save.writeObject(bordInfo); save.writeObject(stukGeplaatst); save.writeObject(stukGeselecteerd); save.writeObject(spelerBeurt); save.writeObject(gekozenStuk); save.writeObject(bordImage); save.writeObject(stukImage); save.writeObject(naamSpeler1); save.writeObject(naamSpeler2); save.close(); } catch(Exception exc){ exc.printStackTrace(); } } } EDIT2: I'm th…
type: Question
accepted answer: http://stackoverflow.com/a/24548451
has comment: http://stackoverflow.com/comment/38017996

http://stackoverflow.com/q/24469381
has comment: http://stackoverflow.com/comment/37874461
tagged with: opengl
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37891674
tagged with: gwt
tagged with: libgdx
has title: Pixmap circle border doesn't appear in libGDX html project
has comment: http://stackoverflow.com/comment/37875378
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37910635
has answer: http://stackoverflow.com/a/43015978
has body: I'm programming my first project with libGDX and I'm currently trying to draw a transparent circle with an opaque border on top of the background. It's working as desired in the android an the desktop project. The html project, however, doesn't render the border of the circle. The circle is a texture which is created with a pixmap. As there is no possibility to set the strokewidth for the drawCircle method (why isn't there any?; see http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html#drawCircle-int-int-int-), I'm drawing the border as a filledCircle with another circle on top of it: creating the texture Pixmap pixmap = new Pixmap(radius * 2 + 1, radius * 2 + 1, Format.RGBA8888); Pixmap.setBlending(Blending.None); pixmap.setColor(new Color(1,1,1,1)); pixmap.fillCircle(radius, radius, radius); pixmap.setColor(new Color(0, 0, 0, 0.6f); pixmap.fillCircle(radius, radius, radius - borderWidth); texture = new Texture(pixmap); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); pixmap.dispose(); drawing Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT (Gdx.graphics.getBufferFormat().coverageSampling ? GL20.GL_COVERAGE_BUFFER_BIT_NV : 0)); // tell the camera to update its matrices. camera.update(); game.spriteBatch.setProjectionMatrix(camera.combined); // begin the drawing process game.spriteBatch.begin(); drawBackground(); //circle gets drawn here game.spriteBatch.draw(texture, 50, 50); //end drawing process game.spriteBatch.end(); Any ideas? Edit: Tested on Chrome (35.0.1916.153) and Firefox (30.0) on Ubuntu 14.04. Can anybody reproduce this problem?

http://stackoverflow.com/a/24445380
type: Answer
upvote count: 1
has body: Take another example similar to your problem, class Animal { void set() { System.out.println("i am in animal"); } } class Dog extends Animal { void set() { System.out.println("i am in dog"); } void bark(){ System.out.println("woof woof"); } public static void main(String args[]) { Animal instance=new Dog(); //line instance.set(); //this would call set() in B. Dog in=new Animal(); //But this line gives error } } Inheritance follows a is-a relationship, now we can say Dog extends Animal and Dog is-a Animal. that makes sense. But Animal is-a Dog does not make sense. When you write Animal instance=new Dog(); , You are assigning a Dog object to a Animal reference , which sounds intuitive, also the LHS (Animal instance) is the reference variable , and the job of the reference variable is to decide what functions to call on the object(Those present in Animal like set()) , You cannot call the bark() method using instance , because it is of type Animal reference, yes but you can call set() since it is present in Animal class. Now there are two version of set() one present in class Animal and class Dog, now which one to call depends on RHS (new Dog();) , since RHS is an instance and is of type Dog(), the version of set() in Dog will be called. To summarize, see the following code and output in comments:- Animal a1=new Animal(); a.set();// output- i am in animal Dog d1=new Dog(); d.set(); //output- i am in dog d.bark; //valid and output- woof woof Animal a2=new Dog(); a2.set();//output- i am in dog a2.bark();// compilation error, you cannot refer to this method since it is not present in Animal class. Dog d2=new Animal(); // compilation error
answers question: http://stackoverflow.com/q/24432620
downvote count: 0
score: 1

http://stackoverflow.com/q/24442961
has body: I'd like to ask is there anyway to detect all beans have been instantiated in Spring framework ? I'm using FileSystemXmlApplicationContext class of Spring library to load in my Spring configuration XML. I do understand that I can get all beans after they are been instantiated in bean factory. My dumb solution is by using getBean(String name) method in Spring API and check against with all desired beans in the Spring configuration XML. If all desired beans can be found, I can infer that all beans have been instantiated. The reason I don't prefer the dumb solution is anytime I update my configuration XML, I need to update my source code of checking against again. If this solution has more vulnerabilities, please feel free to point out. Thanks your time and kindly suggestions
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/37822318
has answer: http://stackoverflow.com/a/24443164
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37822417
has comment: http://stackoverflow.com/comment/37822515
has comment: http://stackoverflow.com/comment/37822247
has title: Detect all beans have been instantiated in Spring framework
has answer: http://stackoverflow.com/a/24444772
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/38035567
type: Comment
has text: I added catalina.out log. I also create a test web app and it seems to set the session variable fine. Is there some setting or something I might have set in eclipse that would stop sessions on this app?
type: QuestionComment
comment on: http://stackoverflow.com/q/24554423
score: 0

http://stackoverflow.com/comment/38088725
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24586394
has text: @user3792604 tnx. Enjoy coding. :)
type: AnswerComment

http://stackoverflow.com/a/24556283
has comment: http://stackoverflow.com/comment/38033140
has comment: http://stackoverflow.com/comment/38033594
has comment: http://stackoverflow.com/comment/38039672
type: Answer
answers question: http://stackoverflow.com/q/24556063
score: 0
has body: You can Use this. var user = $('#login_username').val(); alert(user); if you have to use pure javascript then you can do it by this way var user = document.getElementById('login_username').value; alert(user);
has comment: http://stackoverflow.com/comment/38035467
has comment: http://stackoverflow.com/comment/38033446

http://stackoverflow.com/comment/38088661
score: 0
comment on: http://stackoverflow.com/q/24586549
type: Comment
type: QuestionComment
has text: Are you injecting your `mockService` into `ServiceAObj`?

http://stackoverflow.com/a/24571297
score: 0
has body: Reason is you are creating workbook in method every time you call so old data gets cleaned and new data will be added. Remove this from method and move to some other place to execute once. File file = new File(inputFile);//From File WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings); workbook.createSheet("Serial Numbers", 0);/To configuration I suggest you to move your initializations to constructor. Move all initialization to constructor OR Initialize elements in writeExcel BUT Declare those variables at class level means where you have declared your variables.So that you can initialize those in wordExcel.
type: Answer
has comment: http://stackoverflow.com/comment/38061620
answers question: http://stackoverflow.com/q/24571132
accepted answer of: http://stackoverflow.com/q/24571132
has comment: http://stackoverflow.com/comment/38063477
type: AcceptedAnswer

http://stackoverflow.com/q/24518607
has body: I've set up a simple jersey server like this: ResourceConfig rc = new ResourceConfig().packages("com.example.jersey_test/services"); HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(API_URI), rc); And I have a bean that simply throws an exception: @Path("persons") public class PersonService { @GET @Produces(MediaType.APPLICATION_JSON) public String getPersons() { java.util.logging.Logger.getGlobal().log(Level.INFO, "test"); throw new RuntimeException("test"); } } The log output is the following (so logging works, but the exception is not logged): Jul 01, 2014 10:19:33 PM com.example.jersey_test.services.PersonService getPersons INFO: test The response is a 500 with looks like the following (so the stacktrace is not included): As this answer states, grizzly should be using the default logging API. What am I doing wrong?
accepted answer: http://stackoverflow.com/a/26834397
favorite count: 0
score: 4
possible better answer: http://stackoverflow.com/a/24668834
answer count: 2
has answer: http://stackoverflow.com/a/24668834
tagged with: jakarta-ee
tagged with: grizzly
tagged with: java
has answer: http://stackoverflow.com/a/26834397
upvote count: 4
has title: grizzly does not log Exceptions in requests
tagged with: error-logging
downvote count: 0
linked to: http://stackoverflow.com/q/21329733
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/37831067
has text: Sort the characters in the string, and count the occurrences of each.
score: 0
comment on: http://stackoverflow.com/q/24448018
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38019866
score: 0
type: Comment
type: QuestionComment
has text: I suppose I could try that. Comparing two images pixel by pixel doesn't sound very quick, though. Are there any good ways to do the comparison based on the files' xml content? In which case it would be xml comparison.
comment on: http://stackoverflow.com/q/24532535

http://stackoverflow.com/q/24476858
has answer: http://stackoverflow.com/a/24477030
has answer: http://stackoverflow.com/a/24477173
type: UnansweredQuestion
has body: Imagine we have the following simple mutable class: public class Point { private int x; private int y; ... public void addToX(int delta) { x += delta; } public void addToY(int delta) { y += delta; } } Overriding the hashCode method using the only class field x and y will not work, because the values can change during runtime when the addToX/addToY method is called. So I was wondering what an appropriate implementation of hashCode would be for mutable classes?
linked to: http://stackoverflow.com/q/6013631
has comment: http://stackoverflow.com/comment/37885159
type: Question
has comment: http://stackoverflow.com/comment/37885047
score: 0
answer count: 2
has title: How to keep the hash code of an object consistent during the applications runtime?
has comment: http://stackoverflow.com/comment/37885103
tagged with: hashcode
tagged with: java
has comment: http://stackoverflow.com/comment/37884940
linked to: http://stackoverflow.com/q/5174233

http://stackoverflow.com/a/24473760
has comment: http://stackoverflow.com/comment/37879149
upvote count: 3
has comment: http://stackoverflow.com/comment/37879137
has comment: http://stackoverflow.com/comment/37879110
has comment: http://stackoverflow.com/comment/37879113
type: AcceptedAnswer
downvote count: 0
has body: You are having this Scanner fileIn = new Scanner("cars.txt"); so your first line will be "cars.txt" Scanner fileIn = new Scanner(new File(srcFile));//Or probably path of file Here create file and pass the commandline argument,means file path,to File constructor and pass that file to Scanner. You are passing file name as String to Scanner. Constructors Scanner(File source)&lt;---Takes File you want to read Scanner(String source)&lt;----Takes String you want to read etc.
type: Answer
accepted answer of: http://stackoverflow.com/q/24473750
score: 3
answers question: http://stackoverflow.com/q/24473750

http://stackoverflow.com/comment/37962242
comment on: http://stackoverflow.com/a/24517465
score: 0
type: AnswerComment
type: Comment
has text: The password printed correctly. It is a string of numbers and letters with no special characters.

http://stackoverflow.com/comment/37974137
has text: i don't understand, can you please give some more details ?
score: 0
comment on: http://stackoverflow.com/a/24520713
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24575971
has comment: http://stackoverflow.com/comment/38088583
score: 0
has answer: http://stackoverflow.com/a/24576091
has comment: http://stackoverflow.com/comment/38069695
answer count: 1
has title: Send file using socket
has comment: http://stackoverflow.com/comment/38069225
has comment: http://stackoverflow.com/comment/38069120
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38069787
tagged with: sockets
has comment: http://stackoverflow.com/comment/38069545
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38069466
has body: I have a server application and I want to send a file from this server to some client that is connected to me. On the client side I don't have any running application, the only thing that I have is a telnet connection between client and server. Getting the conection: Socket cliente = null; client = server.accept(); Receiving and sending information: inClient = client.getInputStream(); outClient = client.getOutputStream(); bfClient = new BufferedReader(new InputStreamReader(inClient)); pwClient = new PrintWriter(outClient, true); The file that I want to send: File flMacro = new File("macro.txt"); I have the file path where I want to save it on the client side. My problem is: how can I send macro.txt that is in my server to the client, specifying the file path where I want to save it, without any client interaction.
has comment: http://stackoverflow.com/comment/38069070

http://stackoverflow.com/comment/37977600
score: 0
comment on: http://stackoverflow.com/q/24527032
type: Comment
type: QuestionComment
has text: I think it would be of some help

http://stackoverflow.com/a/27088880
type: Answer
score: 2
downvote count: 0
has body: If you have installed any other API before, you can set your project to compile using that API. for this you need to right click on you project and go to Properties section. In Properties section go to application tab, and set "Compile using Android version" to the version that you have installed it before. Note that this option is set to API 8 by default, and you need to change it based on your installed APIs If these things are normal, then you may need to check this address to see if your API exists there too : C:\Users\[Your User]\AppData\Local\Android\android-sdk\platforms\ If the required api is not exists here then you may need to copy it from address below: C:\Program Files (x86)\Android\android-sdk\platforms\ I hope these will solve your problem
upvote count: 2
answers question: http://stackoverflow.com/q/24537059

http://stackoverflow.com/q/24470815
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24470898
type: UnansweredQuestion
has body: i'm pretty new to Java and i'm wondering how to count a specific word from a console Example, I want to have a +1 to the counting whenever a line contains "Runes"
tagged with: java
has comment: http://stackoverflow.com/comment/37873602
upvote count: 1
downvote count: 7
type: Question
score: -6
has title: Counting a specific word in a console

http://stackoverflow.com/comment/37990413
score: 0
type: AnswerComment
has text: Thanks for reply Assylias but here i am talking about volatile boolean added sample code. Can you look once and suggest how volatile will help in this case.
type: Comment
comment on: http://stackoverflow.com/a/24531930

http://stackoverflow.com/comment/37836971
score: 3
comment on: http://stackoverflow.com/q/24451296
type: Comment
type: QuestionComment
has text: why does [-2, 0, -5] represent -502? what about [-2, 0, 5] and [2, 0, -5]?

http://stackoverflow.com/a/29104999
answers question: http://stackoverflow.com/q/24520325
downvote count: 0
has body: Error "Problems creating SAAJ object model" usually occurs when soap-request cannot be parsed on the server side. In the log-file on the server you can see something like Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '&gt;' (code 62) (expected a name start character) at [row,col {unknown-source}]: [18,6] You pass html tags to the soap envelope, so problems can be with escaping html-tags. It's a good practice to pass BASE64 string within soap-request for such kind of data
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/98853957
score: 8

http://stackoverflow.com/q/24533484
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2201925
has body: I have a string "2014-07-02T17:12:36.488-01:00" which shows the Mountain time zone. I parsed this into java.util.date format. Now I need to convert this to GMT format. Can anyone help me?? SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Object dd = null; try { dd=sdf.parseObject("2014-07-02T17:12:36.488-01:00"); System.out.println(dd); } catch (ParseException e) { e.printStackTrace();`enter code here` } SimpleDateFormat gmtDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); gmtDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); System.out.println("Current Date and Time in GMT time zone:+ gmtDateFormat.format(dd));
tagged with: java
downvote count: 1
type: Question
upvote count: 4
score: 3
answer count: 1
has title: How to convert java.util.Date to GMT format
has comment: http://stackoverflow.com/comment/37989818
favorite count: 0
has answer: http://stackoverflow.com/a/24533630

http://stackoverflow.com/q/24545372
accepted answer: http://stackoverflow.com/a/24545417
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24545417
tagged with: generics
has title: Proper type signature for a list of a generic types?
type: AnsweredQuestion
tagged with: java
type: Question
has body: Am I forced to use rawtypes in my situation, or is there some kind of signature I can apply to my type declarations that will eliminate them entirely? I have a generic interface that is implemented by one or more classes. Here is a reduced form of the relevant code. public class Event { ... } public interface Processor&lt;E extends Event&gt; { void process(List&lt;E&gt; events); } public class ProcessorImpl&lt;E extends Event&gt; implements Processor&lt;E&gt; { @Override public void process(List&lt;E&gt; events) { ... } } So the above are the relevant classes, now I will illustrate my confusion. public class SomeApp { public List&lt;Processor&gt; processors; // rawtype of Processor&lt;E extends Event&gt; public List&lt;Event&gt; events; public SomeApp(...) { ... } // Fills the lists up public void run() { for (int i = 0; i &lt; processors.size(); ++i) { processors.get(i).process(events); // takes a list of &lt;E extends Event&gt; } } } All of this code compiles and runs properly in my particular case, however I want to avoid using raw types if I can. I've experimented with wildcard bounds in the lists for the Processor type i.e List&lt;Processor&lt;? extends Event&gt;&gt;, but that always leads me to needing to change the process method to take a wildcard type rather than the generic E, and that seems to defeat the purpose of having the generics in that class.

http://stackoverflow.com/comment/38061950
has text: BTW - you offer the source as an *archive that comes to **186KB***?!? Who exactly do you expect to go wading through that mammoth code base looking for an error?
comment on: http://stackoverflow.com/q/24571860
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24502888
score: 0
answer count: 3
has body: I'm a little stumped and probably because I don't know how to search for this properly (I've tried many different keywords). Anyway, I'm attempting a variation of TCP hole punching(with a rendezvous server). I have created a TCP socket to the server and closed it without throwing any exceptions. But when I attempt to create a ServerSocket on the localport of the original socket it fails with IOException. private static int LOCALPORT = 0; private static String TARGETIP = "88.888.88.888"; private static int TARGETPORT = 8888; try{ InetAddress serverAddr = InetAddress.getByName(TARGETIP); socket = new Socket(serverAddr, TARGETPORT); LOCALPORT = socket.getLocalPort(); socket.close(); ServerSocket sSocket = new ServerSocket(LOCALPORT); Socket skt = sSocket.accept(); } catch (IOException e){ } I just cannot wrap my head around why I cannot close the socket and open a serversocket on the same port. UPDATE: from logcat java.net.BindException: bind failed: EADDRINUSE (Address already in use) Caused by: libcore.io.ErrnoException: bind failed: EADDRINUSE (Address already in use)
has answer: http://stackoverflow.com/a/24507849
possible better answer: http://stackoverflow.com/a/24503096
has comment: http://stackoverflow.com/comment/37941289
tagged with: sockets
tagged with: android
has answer: http://stackoverflow.com/a/24503096
has comment: http://stackoverflow.com/comment/37936680
has title: Java(Android): create ServerSocket on LocalPort used for another Socket
tagged with: hole-punching
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24518726
tagged with: tcp
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37933722
accepted answer: http://stackoverflow.com/a/24518726

http://stackoverflow.com/a/24506151
accepted answer of: http://stackoverflow.com/q/24506074
type: Answer
answers question: http://stackoverflow.com/q/24506074
has comment: http://stackoverflow.com/comment/37940712
has body: package com.mkyong.android; import android.app.Activity; import android.os.Bundle; import android.widget.Button; public class App2Activity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); button = (Button) findViewById(R.id.button2); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(App2Activity.this, App3Activity.class); startActivity(intent); } }); } } Make sure you have registered the App3Activity in AndroidManifest. EDIT Here is the complete solution, just copy paste into respective classes main.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I'm screen 1 (main.xml)" android:textAppearance="?android:attr/textAppearanceLarge" /> main2.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I'm screen 2 (main2.xml)" android:textAppearance="?android:attr/textAppearanceLarge" /> main3.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I'm screen 3 (main3.xml)" android:textAppearance="?android:attr/textAppearanceLarge" /> AppActivity import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class AppActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void o…
has comment: http://stackoverflow.com/comment/37940031
has comment: http://stackoverflow.com/comment/37940837
has comment: http://stackoverflow.com/comment/37940046
upvote count: 1
has comment: http://stackoverflow.com/comment/37940729
has comment: http://stackoverflow.com/comment/37939525
score: 1
has comment: http://stackoverflow.com/comment/37941053
has comment: http://stackoverflow.com/comment/37940937
has comment: http://stackoverflow.com/comment/37940342
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37939723

http://stackoverflow.com/a/24576979
has comment: http://stackoverflow.com/comment/38071452
has comment: http://stackoverflow.com/comment/38071428
accepted answer of: http://stackoverflow.com/q/24576945
type: Answer
has comment: http://stackoverflow.com/comment/38071470
upvote count: 6
has body: That's in my component, will I be able to identify who created an instance of me? Not in general, no. You could try obtaining a stack trace in the constructor, but that's not necessarily reliable or helpful. If you want some sort of identifier, I suggest you have that as a constructor parameter (or factory method parameter). In other words, get the caller to identify themselves.
has comment: http://stackoverflow.com/comment/38853425
has comment: http://stackoverflow.com/comment/38071374
has comment: http://stackoverflow.com/comment/38071402
has comment: http://stackoverflow.com/comment/38070938
has comment: http://stackoverflow.com/comment/38071248
downvote count: 1
has comment: http://stackoverflow.com/comment/38071216
score: 5
has comment: http://stackoverflow.com/comment/38071038
has comment: http://stackoverflow.com/comment/38071128
has comment: http://stackoverflow.com/comment/38071646
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24576945

http://stackoverflow.com/comment/37982163
has text: It can be other way also, but prefer regex.
comment on: http://stackoverflow.com/q/24527437
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37923605
score: 0
type: AnswerComment
has text: It seems like you were not 100% right - I have a custom Listener that implements SelectionListener and ModifyListener. Now I add the one listener like this: `public void setAutoCompleteListener(ComboAutoCompleteListener listener) { this.addSelectionListener(listener); this.addModifyListener(listener); }`, however the Modify Listener gets called first (which I certainly don't want). Any help?
type: Comment
comment on: http://stackoverflow.com/a/24493156

image-manipulation
tags question: http://stackoverflow.com/q/24496967
tag name: image-manipulation
type: Tag

http://stackoverflow.com/a/24749784
downvote count: 3
upvote count: 4
has body: The link codeMan refers to has some advice that looks quite specific to Apache POI &amp; Excel. You'll see that there is no great documentation for a reason here (it's not supported): http://poi.apache.org/spreadsheet/limitations.html To quote Solitudes answer in codeMans link verbatim: It is possible. In the PivotCacheDefinition, there is an attribute refreshOnLoad that can be set to true. The cache is then refreshed when the workbook is opened. More information here. > In POI this can be done by calling the method setRefreshOnLoad(boolean bool), that takes a boolean as parameter, on a CTPivotCacheDefinition If you need to refresh the pivot table before the file is opened, (for example to then use the pivottable calculated data in further calculations and have POI write this) then I'm not sure that this would be possible at all with POI, and potentially hooking up to excel using a COM solution might be the way to go.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24554046

apache-httpclient-4.x
tags question: http://stackoverflow.com/q/24455484
tags question: http://stackoverflow.com/q/24495188
tags question: http://stackoverflow.com/q/24498964
tags question: http://stackoverflow.com/q/24480042
tags question: http://stackoverflow.com/q/24585901
tag name: apache-httpclient-4.x
type: Tag
tags question: http://stackoverflow.com/q/24552579

http://stackoverflow.com/comment/37946229
has text: 1. no, really bad solution 2. read documentation about [`FieldSetMapper`](http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/mapping/FieldSetMapper.html) and download SB start guide example; all will be more clear!
type: QuestionComment
comment on: http://stackoverflow.com/q/24509211
score: 0
type: Comment

http://stackoverflow.com/a/24521262
upvote count: 15
downvote count: 0
has body: The command is: gradle[w] dependencies --configuration &lt;configuration_name&gt; In my case, I want to see just compile configuration so I would type: gradlew dependencies --configuration compile
score: 15
has comment: http://stackoverflow.com/comment/86353697
answers question: http://stackoverflow.com/q/24521235
type: Answer

http://stackoverflow.com/q/24524619
has comment: http://stackoverflow.com/comment/37973411
has comment: http://stackoverflow.com/comment/37973093
has comment: http://stackoverflow.com/comment/37973149
has answer: http://stackoverflow.com/a/24524795
answer count: 3
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24524687
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/37973382
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/24524687
has title: Getting NullPointerException when adding listitem dynamically- android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24524693
accepted answer: http://stackoverflow.com/a/24524693
has body: I'm creating list view using BaseAdapter and I want when pressing add button dynamically add list items. but now I'm getting this null pointer exception. 07-02 06:40:41.650: E/AndroidRuntime(1940): FATAL EXCEPTION: main 07-02 06:40:41.650: E/AndroidRuntime(1940): java.lang.NullPointerException 07-02 06:40:41.650: E/AndroidRuntime(1940): at com.ui.activities.AddHorseCompetitionResult$1.onClick(AddHorseCompetitionResult.java:61) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.view.View.performClick(View.java:4204) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.view.View$PerformClick.run(View.java:17355) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.os.Handler.handleCallback(Handler.java:725) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.os.Handler.dispatchMessage(Handler.java:92) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.os.Looper.loop(Looper.java:137) 07-02 06:40:41.650: E/AndroidRuntime(1940): at android.app.ActivityThread.main(ActivityThread.java:5041) 07-02 06:40:41.650: E/AndroidRuntime(1940): at java.lang.reflect.Method.invokeNative(Native Method) 07-02 06:40:41.650: E/AndroidRuntime(1940): at java.lang.reflect.Method.invoke(Method.java:511) 07-02 06:40:41.650: E/AndroidRuntime(1940): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 07-02 06:40:41.650: E/AndroidRuntime(1940): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-02 06:40:41.650: E/AndroidRuntime(1940): at dalvik.system.NativeStart.main(Native Method) this is my java class public class AddCompetitionResult extends Fragment { private CompetitionResultListAdapter competitionResultListAdapter; private DataManager datamanager; ArrayList&lt;Result&gt; result; ListView listView; private Horse horse; private Button addResults; int clickCounter=0; int resultId = 1; public AddHorseCompetitionResult(Horse horse) { this.horse = horse; } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa…
tagged with: java
has comment: http://stackoverflow.com/comment/37973130
score: -1

http://stackoverflow.com/a/24571872
answers question: http://stackoverflow.com/q/24565362
type: Answer
accepted answer of: http://stackoverflow.com/q/24565362
has body: To get the unique identifier for a user, use User#getUserId(). Returns an opaque string that uniquely identifies the user represented by this User object. In case of open ID account, you can also use User#getFederatedIdentity(), however, I would say that it does not have to return always the unique identifier. There are two flavors of provider types: direct providers like Google and Yahoo! require only a generic federated identity that has no username associated with it. In contrast, Flickr, WordPress, Blogger, and LiveJournal are known as username providers because all require you to provide a URL which does. See more details here. Anyway there is also a possibility to store the user object as a whole. This is supported out of the box by App Engine and Datastore.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/24572724
answer count: 1
tagged with: osgi
type: UnansweredQuestion
tagged with: deployment
tagged with: geronimo
has title: Deploy osgi bundles to Geronimo remotly
has comment: http://stackoverflow.com/comment/38065214
has answer: http://stackoverflow.com/a/24573943
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/38063464
score: 0
has body: We have some custom repository which contains different builds (set of osgi bundles). There are any Geronimo 3 remote servers. I should by a command get some build from repository and make hot deploy to a set of stands. It maybe existing tool or java api. As I know Cargo don't work with remote Geronimo. I will be grateful for any suggestion.

http://stackoverflow.com/a/24529877
has comment: http://stackoverflow.com/comment/37982732
type: AcceptedAnswer
has body: You could always create a custom constructor for your enum.. public enum Status { OPEN("1"), CLOSED("2"), DELETED("3"); private String code; public Status(String code) { this.code = code; } public String getCode() { return code; } } Then you can access with Status.OPEN.getCode(). This functions as an effective mapping between an enum type and a code value.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24529739
answers question: http://stackoverflow.com/q/24529739
type: Answer
has comment: http://stackoverflow.com/comment/37983250
upvote count: 10
has comment: http://stackoverflow.com/comment/37983827
score: 10
has comment: http://stackoverflow.com/comment/37988477

http://stackoverflow.com/comment/37921211
type: Comment
has text: @Thrbjorn: I am trying to understand as to how to do without some container, i.e. using standalone (with main() ) application to learn the concept.
type: AnswerComment
comment on: http://stackoverflow.com/a/24485881
score: 0

http://stackoverflow.com/q/24505579
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/37938336
has comment: http://stackoverflow.com/comment/37953838
linked to: http://stackoverflow.com/q/5853879
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37938456
has comment: http://stackoverflow.com/comment/37938305
has comment: http://stackoverflow.com/comment/37938287
favorite count: 0
has title: How to take a screenshot of a JPanel with robot?
has body: This is how I can make a screenshot of a whole JFrame Rectangle screenRect = cap.getBounds(); File docfile = new File("image"); BufferedImage capture = new Robot().createScreenCapture(screenRect); ImageIO.write(capture, "png", file); with cap being a JFrame. But when I use a JPanel for cap, I get a partly screenshot of my desktop, not only of the JPanel, what I actually want.
upvote count: 2
tagged with: screenshot
has comment: http://stackoverflow.com/comment/37938234
linked to: http://stackoverflow.com/q/3742731
type: UnansweredQuestion
tagged with: jcomponent
tagged with: swing
has answer: http://stackoverflow.com/a/63511836
has comment: http://stackoverflow.com/comment/37938406
score: 2
tagged with: java

http://stackoverflow.com/comment/38081379
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24582468
has text: That information should be part of your question as it is key to understanding your problem.
score: 0

http://stackoverflow.com/q/24548102
tagged with: apache-poi
has title: Exception while reading excel files using apache poi
upvote count: 1
tagged with: excel
has comment: http://stackoverflow.com/comment/38018159
has comment: http://stackoverflow.com/comment/38019491
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24548217
tagged with: java
has comment: http://stackoverflow.com/comment/38020530
type: Question
has body: I am reading two excel sheets which have 97000 rows combined. I get this exception when I run the program on eclipse. It gets stuck at 92865 rows. Is there some problem in the code or is it a memory configuration problem. iteratormaster is the iterator for the second workbook. stringSet is a hash set. It's running fine when I increase the heap size. It's doesn't work when I create a jar and distribute it on other machines. Any permanent solution? while (iteratormaster.hasNext()){ //jLabel5.setText("Processing record "+qw+" out of"+ total+ " "+ "(" + (qw/total)*100+"%"); Row rowmaster = iteratormaster.next(); int qw1= rowmaster.getRowNum(); if (qw1%1500==0){ //jProgressBar1.setValue(((qw+n)/total)*100); // Thread.sleep(500); jLabel11.setText("Processing record "+(qw1+n)+" out of "+ total); jLabel11.paintImmediately(jLabel11.getVisibleRect()); } Cell media1 = rowmaster.getCell(5,Row.CREATE_NULL_AS_BLANK); String gandu=media1.toString(); b.add(gandu); //sorted.add(gandu); Cell cellmaster0 = rowmaster.getCell(4,Row.CREATE_NULL_AS_BLANK); if (stringSet.contains((cellmaster0).toString())) { rowindexa++; cellindexa=-1; Row rowa=sheeta.createRow(rowindexa); //Iterator&lt;Cell&gt; cellmaster = rowmaster.iterator(); for (int cn=0;cn&lt;rowmaster.getLastCellNum();cn++){ cellindexa++; Cell cellmaster1= rowmaster.getCell(cn, Row.CREATE_NULL_AS_BLANK); String aap = cellmaster1.toString(); Cell cella =rowa.createCell(cellindexa); cella.setCellValue(aap); if (aap.indexOf("\t")!=-1){ System.out.println(aap);} } } else { rowindextemp++; cellindextemp=-1; Row rowb=sheettemp.createRow(rowindextemp); //Iterator&lt;Cell&gt; celltemp1 = rowmaster.cellIterator(); for (int cn1=0;cn1&lt;rowmaster.getLastCellNum();cn1++){ cellindextemp++; Cell celltemp2 = rowmaster.getCell(cn1,Row.CREATE_NULL_AS_BLANK); String congress=celltemp2.toString(); Cell cellb = rowb.createCell(cellindextemp); cellb.setCellValue(congress); } } } Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: GC ove…
downvote count: 0
accepted answer: http://stackoverflow.com/a/24548217
answer count: 1
has comment: http://stackoverflow.com/comment/38023070
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38021427

http://stackoverflow.com/q/24575511
answer count: 1
has answer: http://stackoverflow.com/a/24579015
type: AnsweredQuestion
tagged with: openjpa
has title: Is it possible to get rid of that extra @Resource annotation for Websphere-managed DataSource?
type: Question
tagged with: ejb
tagged with: java
accepted answer: http://stackoverflow.com/a/24579015
has body: I have EJB application that is using OpenJPA persistence unit from WebSphere 8.5. The DataSource is configured on the WebSphere with the following settings: Scope: cells:pxxxxNodexxCell Name: MYAPP_001 JNDI name: jdbc/MYAPP/DS001 Component-managed authentication alias: MYAPP_001 Mapping-configuration alias: (none) Container-managed authentication alias: (none) The persistence unit is configured so: <?xml version="1.0" encoding="UTF-8" ?> java:comp/env/jdbc/MYAPP/DS001 ... ... Now I'm importing it into EJB: @PersistenceContext(name = "myapp") private EntityManager em; The problem is, that with the following configuration the data source can not be resolved: Caused by: org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database Connectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "WsJpaJDBCConfigurationImpl@83f2eb8d: PDQ disabled: AccessIntent Task=disable". at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:72) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:849) at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602) at org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518) at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:531) at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:456) at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:121) at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68) at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83) at org.apache.open…
score: 0
tagged with: websphere

http://stackoverflow.com/comment/37905837
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24487805
has text: "looks like" is not an argument here, I think.
type: Comment

http://stackoverflow.com/q/24568972
has comment: http://stackoverflow.com/comment/38056355
tagged with: web-services
tagged with: spring
has title: Mock an object with a constructor mockito
has body: i have class Class A { ServiceClass serviceClass; public A(ServiceClass obj){ serviceClass = obj; } public String methodA(String i){ String j = serviceClass.someMethod(i); return j; } } here i have some method in that i m calling service class method for that i have created mock object for service class. ServiceClass serviceClassMock = Mockito.mock(ServiceClass.class); A objA = new A(serviceClassMock); @Test public void test(){ when(serviceClassMock.someMethod("1")).thenReturn("1"); String j = objA.methodA("1");// here gives me wanted be invoked but not. there where 0 interaction verify(serviceClassMock).someMethod("1"); }
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24569182
has comment: http://stackoverflow.com/comment/38058923
tagged with: mockito
tagged with: junit
answer count: 1
has comment: http://stackoverflow.com/comment/38057699
score: 0
has comment: http://stackoverflow.com/comment/38058747
type: UnansweredQuestion

http://stackoverflow.com/q/24444564
tagged with: java
type: Question
has title: How to Change the installation path of an android application?
has body: I am developing an android application. By default it is getting stored in /data/data/&lt;package-name&gt; path As my device is in warranty period, I don't have privilege to access this(root) path. So for this application I want to change the installation path e.g. to /storage/emulated/0/&lt;package-name&gt; I found that in manifest.xml file using android:installLocation we can change installation path. But it is giving only 3 choices: ->auto ->internal ->external But how do I change the path in internal storage ?
has answer: http://stackoverflow.com/a/24444671
score: 0
has comment: http://stackoverflow.com/comment/138967817
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/24507104
type: Question
has answer: http://stackoverflow.com/a/24507354
tagged with: java
has title: java servlet not found error 404 in eclipse
tagged with: eclipse
tagged with: servlets
linked to: http://stackoverflow.com/q/11731377
answer count: 2
has body: I am using Eclipse 4.3 kepler on Ubuntu 14.04 and using Apache tomcat 7 , I have successfully created .jsp and .html files in my project but I cannot Run a servlet, I have all jar files added in library . I have read every article on this error 404 ,which I am getting when I launch the following servlet package servlet; 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("/taxProcessor") public class taxProcessor extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public taxProcessor() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String s=request.getParameter("t1"); int i=Integer.parseInt(s); String s1=request.getParameter("t2"); int a=Integer.parseInt(s1); int t=0; if(i&gt;=500000) { t=i*(30/100); }else if(i&gt;=300000) { t=i*(20/100); }else if(i&gt;=200000) { t=i*(10/100); } if(a&gt;=60) { t=t-(i*(10/100)); } PrintWriter out=response.getWriter(); out.println("Thank you for Visiting"); out.println("Your Tax Laibality is"+t+"\n"); out.close(); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } } my web.xml file is and all what I get is this
duplicate of: http://stackoverflow.com/q/11731377
favorite count: 0
accepted answer: http://stackoverflow.com/a/24507354
possible better answer: http://stackoverflow.com/a/24507233
has answer: http://stackoverflow.com/a/24507233
score: -1
type: AnsweredQuestion
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/38077885
has text: If `this.out` is a PrintStream, it doesn't matter whether `msg` is null. It is more likely that `this.out` itself is null.
score: 0
comment on: http://stackoverflow.com/q/24579231
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37972409
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24485605
type: Comment
has text: I created a new URL Connection and then tried sending the string but the servlet still reads NULL.

http://stackoverflow.com/comment/38008774
comment on: http://stackoverflow.com/q/24543376
has text: Show us what you tried. This depends on the implementation of the `List` and the elements it contains.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38940790
type: AnswerComment
comment on: http://stackoverflow.com/a/25026199
type: Comment
score: 1
has text: I am running Java 7 and Java 8 standard issue from Oracle, not from an open source or other alternative Java. the rt. jar is: Java 1.7_051

http://stackoverflow.com/q/24570108
has answer: http://stackoverflow.com/a/24574812
type: AnsweredQuestion
has body: Can I chain multiple instances of AuthenticationEntryPoint in Spring Security 3.2.4? I attempting to create the following scenario: A certain URL is secured with Spring Security The AuthenticationEntryPoint used is LoginUrlAuthenticationEntryPoint An admin interface can spawn services under this URL The admin can choose to secure these services with CLIENT-CERT When a user attempts to access the secure URL: If the path has been secured with CLIENT-CERT then authentication fails unless they have provided a valid certificate the corresponds to a user in the UserService. Standard Spring Security x509 authentication. Once the user has been authentication as per the first point, or if the URL is not secured with CLIENT-CERT, they are directed to a FORM based authentication page. Once they successfully authenticate with a username and password, they are directed to a landing page. I am running on Tomcat 7.0.54 with clientAuth="want". This works perfectly in a "simple" Spring Security set up - i.e. with one WebSecurityConfigurerAdapter set to x509() and another set to formLogin() as per this example So, I want a process flow something like the following: I have had some success with dynamically changing the used authentication method by using a DelegatingAuthenticationEntryPoint but: When using an AntPathRequestMatcher to map, say, /form/** to a LoginUrlAuthenticationEntryPoint the authentication servlet (/j_spring_security_check) gives a HTTP404 error. When using an AntPathRequestMatcher to map, say, /cert/** to a Http403ForbiddenEntryPoint the user's details are not extracted from the presented client certificate so this gives a HTTP403 error. I also cannot see how to force a user to authenticate twice. I am using the java-config and not XML. My code: I have a DelegatingAuthenticationEntryPoint: @Bean public AuthenticationEntryPoint delegatingEntryPoint() { final LinkedHashMap&lt;RequestMatcher, AuthenticationEntryPoint&gt; map = Maps.newLinkedHashMap(); map.put(new AntP…
score: 1
tagged with: authentication
upvote count: 1
has title: Chained authentication in Spring Security
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/24574812
linked to: http://stackoverflow.com/q/8381776
tagged with: spring-java-config
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/38083896
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24583956
has text: examples can be any url...If there is some link in text I need to find it..
score: 0

http://stackoverflow.com/a/24490796
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37945979
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24490031
has body: I'm no expert in Kettle. However, a StackOverflowError is NOT caused by running out of memory, so the fact that you have an 8Gb heap is not directly relevant. What is relevant is the size of the thread stack. That is controlled by the java command's -Xss command-line option. I also don't know what you mean by "cycles" in the context of Kettle ... and Google isn't helping me. However, I guess it is something to do with Jobs that cause other Jobs to run. And since you hit the limit at ~700 and need to get to ~1500, you probably need to triple the current thread stack size ... whatever that may be.
answers question: http://stackoverflow.com/q/24490031

oop
tags question: http://stackoverflow.com/q/24535962
tags question: http://stackoverflow.com/q/24536254
tags question: http://stackoverflow.com/q/24475740
tags question: http://stackoverflow.com/q/24546966
tags question: http://stackoverflow.com/q/24457937
tag name: oop
tags question: http://stackoverflow.com/q/24555352
tags question: http://stackoverflow.com/q/24488821
tags question: http://stackoverflow.com/q/24464621
tags question: http://stackoverflow.com/q/24568408
tags question: http://stackoverflow.com/q/24581337
tags question: http://stackoverflow.com/q/24585300
tags question: http://stackoverflow.com/q/24531238
tags question: http://stackoverflow.com/q/24582147
tags question: http://stackoverflow.com/q/24544133
tags question: http://stackoverflow.com/q/24580541
tags question: http://stackoverflow.com/q/24484772
tags question: http://stackoverflow.com/q/24563505
tags question: http://stackoverflow.com/q/24461667
tags question: http://stackoverflow.com/q/24514268
tags question: http://stackoverflow.com/q/24572715
type: Tag
tags question: http://stackoverflow.com/q/24466365

http://stackoverflow.com/q/24529251
has body: Suppose I've got application contexts hierarchy: A (parent), B (extends A), C (extends A). Suppose now I write something like @Autowired private MyBean myBean Question: WHERE Spring will look for myBean? In other words in WHICH CONTEXT it'll look? Suppose bean is present in all 3 contexts..
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24534523
has title: @Autowired & Spring context hierarchy
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24534523
tagged with: dependency-injection
possible better answer: http://stackoverflow.com/a/24529319
upvote count: 2
has answer: http://stackoverflow.com/a/24529319
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24529484
tagged with: spring
linked to: http://stackoverflow.com/q/4249978

http://stackoverflow.com/comment/38086428
comment on: http://stackoverflow.com/a/24585271
has text: i tried to create 3X3 matrix but according to you example it assign 1 in every element in a matrix so i want to assign my like in array matrix[0][0]=1 matrix[0][1]=3 matrix[2][2] =2 etc...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38079543
has text: Have you tried `Tree<Solution.Node>` and `Solution.Node root;`? Without seeing your imports (which you haven't included), I can't verify you're not importing another `Node` class.
comment on: http://stackoverflow.com/q/24581449
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37880591
comment on: http://stackoverflow.com/q/24474547
has text: You need to differentiate variable from object.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/53195457
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24447821
has text: After I reinstall ADT I got new errors but I updated the Android thingy using the Android iCon in Eclipse, and now it works!! WOW thank you so much. THIS ANSWER IS THE ONLY WORKING ANSWER IN THIS QUESTION!!! TRY THIS
score: 0

jscrollpane
tags question: http://stackoverflow.com/q/24479904
tag name: jscrollpane
type: Tag
tags question: http://stackoverflow.com/q/24564052
tags question: http://stackoverflow.com/q/24441423
tags question: http://stackoverflow.com/q/24459068

http://stackoverflow.com/q/24463277
has answer: http://stackoverflow.com/a/24463331
has answer: http://stackoverflow.com/a/24463316
has comment: http://stackoverflow.com/comment/37859458
downvote count: 1
score: -1
type: Question
has comment: http://stackoverflow.com/comment/37859601
upvote count: 0
tagged with: arrays
has body: This is a program which is saving String as a key and number of counts in String array. But as shown in condition clause (//CONDITION) , i am unable to check weather an element of array contains any value or not? I know that it throws an exception "java.lang.ArrayIndexOutOfBoundsException" because it cant allocate memory to unspecified element. I was trying to do "nextString.equals(arrays[i+1])" , it doesn't work. Please specify any condition i can use. public void mapExample() { String text = "text good text good text"; String[] arrays = text.split(" "); Arrays.sort(arrays); for(String array :arrays ){ System.out.println(array); } int Count=0; String thisSring = ""; String nextString=""; TreeMap&lt;String,Integer&gt; mapper = new TreeMap&lt;String , Integer&gt;(); for(int i=0;i&lt;arrays.length;++i){ thisSring = arrays[i]; Count++; nextString = arrays[i+1]; if(!thisSring.equals(nextString)){ mapper.put(thisSring, Count); } if(//CONDITION){ mapper.put(thisSring, Count); } } Set s = mapper.entrySet(); Iterator iter = s.iterator(); if(iter.hasNext()){ System.out.println(iter.next()); Map.Entry map = (Map.Entry) iter.next(); System.out.println( "Key" + " " + map.getKey()); System.out.println("Value" + " " + map.getValue()); } } }
favorite count: 0
has answer: http://stackoverflow.com/a/24463324
has answer: http://stackoverflow.com/a/24466535
answer count: 4
has title: How to check if element of array contains any value or not
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24434672
tagged with: cqrs
tagged with: architecture
tagged with: domain-driven-design
has title: Best practice to inform client about the itemId newly created
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24435435
upvote count: 3
linked to: http://stackoverflow.com/q/105034
accepted answer: http://stackoverflow.com/a/24435435
type: Question
score: 3
tagged with: java
downvote count: 0
answer count: 1
has body: I own a DDD/CQRS application. My question concerns the handling of an item creation through POST (Rest). CQRS (based on CQS principle) promotes that commands should never return a value. Queries are there for that. So I wonder how to handle the use case of Item creation. Here's my current command handler pattern (light for the sample (no interfaces etc.)): @Service @Transactional public CreateItem { public void handle(CreateItemCommand command) { Customer customer = customerRepository.findById(command.customerId); ItemId generatedItemId = itemRepository.nextIdentity(); //generating the GUID customer.createItem(generatedItemId, .....); } } By reading this article, an easy method would be to declare an output property in the command, populated at the end of the handle method like this: public void handle(CreateItemCommand command) { Customer customer = customerRepository.findById(command.customerId); ItemId generatedItemId = itemRepository.nextIdentity(); //generating the GUID customer.createItem(generatedItemId, .....); command.itemId = generatedItemId; //populating the output property } However, I see one drawback with this approach: - A command, in theory, is meant to be immutable. This itemId would then be sent thanks to the calling controller (webapp) through Location Header with the status 201 or 202 (depending if I expect async or not). An other solution would be to let the controller initialize the GUID by accessing the repository itself, thus letting the command immutable: //in my controller: ItemId generatedItemId = itemRepository.nextIdentity(); //controller generating the GUID createItem.handle(command); // setting here the location header (201-202) containing the URL to the newly created item with the using the previous itemId. Drawback: Controller (adapter layer) accessing directly the repository ..., that is too low-level IMO. My extreme client being a Javascript application, I might have another solution to let the Javascript itself generate a GUID, an…
favorite count: 0

http://stackoverflow.com/q/24518033
type: Question
answer count: 2
downvote count: 0
score: 1
favorite count: 0
tagged with: soap
has title: Spring-WS based SOAP service returns a 405 when deployed in Glassfish
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24534776
upvote count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/25664733
has body: This one seems a little odd to me - I have a very basic SOAP service built in Spring-WS that deploys & runs just fine inside a Tomcat 7 container. I have been experimenting with Glassfish 4 lately & trying to get this SOAP service working but get a "405 Method Not Allowed" every time I try to test a call via SoapUI. Does anyone have any advice on what might cause this? It's the exact same WAR deployed into both containers - the only change I made was a tweak to my datasource JNDI lookup in my service layer, everything else is identical. The really strange thing is that, when deployed in Glassfish, it'll serve up the WSDL (i.e. localhost:8080/user-soap-service/user.wsdl), so I know the application is deployed/listening on that URL - it just refuses to let any POSTs through it seems. This is my web.xml: user-soap-service org.springframework.ws.transport.http.MessageDispatcherServlet 1 user-soap-service /* And this is my application context: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: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-2.5.xsd"> <context:annotation-config/> <import resource="classpath:user-service.xml"/> </beans> Everything deploys fine (no errors/warnings) and if I compare the WSDL served up when it's deployed in Tomcat vs what it looks like when it's deployed in Glassfish, they are identical. Does anyone have any thoughts on what could be happening? UPDATE This is really unexpected, but it works fine with good old fashioned curl (I had previously been testing with SoapUI). I'm now going to focus my research on how SoapUI is constructing its call vs what I'm doing with curl.
tagged with: spring-ws
tagged with: java
tagged with: glassfish

http://stackoverflow.com/comment/37998307
comment on: http://stackoverflow.com/q/24538007
has text: What do you mean _if the url is in `/sub_dir/*`_?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38033623
type: AnswerComment
has text: `compareTo` on strings doesn't just return 1, 0 or -1.
type: Comment
comment on: http://stackoverflow.com/a/24556832
score: 0

http://stackoverflow.com/a/24472885
has comment: http://stackoverflow.com/comment/37877669
answers question: http://stackoverflow.com/q/24472848
score: 0
has body: You could check to see if a common hostname (such as google) is resolvable through dns to an ip address. Once that address has been resolved, you can check to see if it is reachable.
type: Answer
has comment: http://stackoverflow.com/comment/37883671

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/24525846
tag name: csv
tags question: http://stackoverflow.com/q/24576813
tags question: http://stackoverflow.com/q/24569318
tags question: http://stackoverflow.com/q/24562824
tags question: http://stackoverflow.com/q/24571914
tags question: http://stackoverflow.com/q/24435727
tags question: http://stackoverflow.com/q/24558260

http://stackoverflow.com/comment/38024664
type: QuestionComment
has text: (Don't answer, that was a rhetorical question. I understand it's purely for cosmetic reasons. I'm also not saying it would be impossible.)
comment on: http://stackoverflow.com/q/24551962
score: 0
type: Comment

http://stackoverflow.com/q/24498620
has comment: http://stackoverflow.com/comment/37927395
tagged with: http://stackoverflow.com/tag/html
has title: compute colors along gradient
tagged with: css
answer count: 4
has comment: http://stackoverflow.com/comment/37926137
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: Is there a way to compute a color along a gradient? For example, I have a label that I'm using as a sort of status bar with gradient background that has green (#6bba70) at one end and red (#a90329) at the other. What I'd like to do is to figure out what color is at a certain point along the gradient. For example, if the process is 27% complete, I'd like to get the color that is "27% along the gradient". Like this: I thought maybe that I could find the numerical shift and it would give me the correct color. The code I wrote (that doesn't work): public static String getHTML(Date d, int shift) throws SQLException, ClassNotFoundException { String returnValue = ""; returnValue += " &lt;style type=\"text/css\"&gt;\n" + " \n" + " .status{\n" + " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6bba70', endColorstr='" + getColor(77) + "',GradientType=1 );\n" + " width: " + 500 * .77 + "px;\n" + " height: 5px;\n" + " border: thin black solid;\n" + " }\n" + " .status2{\n" + " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6bba70', endColorstr='" + getColor(100) + "',GradientType=1 );\n" + " width: " + 500 + "px;\n" + " height: 5px;\n" + " border: thin black solid;\n" + " }\n" + " .status3{\n" + " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6bba70', endColorstr='" + getColor(33) + "',GradientType=1 );\n" + " width: " + 500 * .33 + "px;\n" + " height: 5px;\n" + " border: thin black solid;\n" + " }\n" + " .status4{\n" + " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6bba70', endColorstr='" + getColor(69) + "',GradientType=1 );\n" + " width: " + 500 * .69 + "px;\n" + " height: 5px;\n" + " border: thin black solid;\n" + " }\n" + " &lt;/style&gt;" + " &lt;body&gt;\n" + " 77%&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;label class=\"status\"&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt;\n" + " 100%&amp;nbsp;&amp;nbsp;&lt;label class=\"status2\"&gt;&lt;/label&gt;&lt;br&gt;&lt;br&gt;\n" + " 33%&amp;nbsp;&amp…
has comment: http://stackoverflow.com/comment/37926813
has answer: http://stackoverflow.com/a/24498946
type: Question
has comment: http://stackoverflow.com/comment/37946844
linked to: http://stackoverflow.com/q/5294955
has answer: http://stackoverflow.com/a/24499449
has answer: http://stackoverflow.com/a/24498806
downvote count: 0
has answer: http://stackoverflow.com/a/24498824
favorite count: 0

http://stackoverflow.com/comment/37966441
type: QuestionComment
type: Comment
has text: In that case it means that `input` is null.
score: 0
comment on: http://stackoverflow.com/q/24520620

http://stackoverflow.com/comment/37821782
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24442463
has text: Also, I was looking for a little more Java and a little less import... I don't know why but I really like creating things myself. I know that it sounds particularly stupid - especially from a programmer - but I really like making things myself. Perhaps that is why I am so fond of assembly...Thank you for the site, though.

http://stackoverflow.com/a/24570155
has comment: http://stackoverflow.com/comment/38147581
has body: The image/file your trying to share is on the google cloud rather than on your device due to which its failing. Kindly verify the same it seems to be a repeat. See App not registering in the "Share" menu as ACTION_SEND intent handler
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24569518
has comment: http://stackoverflow.com/comment/38061105

http://stackoverflow.com/comment/38268886
comment on: http://stackoverflow.com/a/24593793
type: AnswerComment
score: 0
type: Comment
has text: Yeah, it's a subtle one. I've used Coherence pretty heavily and this is one of the big performance gains you get from using a distributed cache - you push the processing to the data rather than pulling the data to the processing. However in anything but the most simple use-cases you often need to access related data and if you're doing process or network hops to do so, then you loose the performance. After some playing about, I've worked out a way to get only the data in the current partition (and have shamelessly answered my own question)

http://stackoverflow.com/a/24531563
has body: This will create simply a random long number - System.out.println((long)((Math.random())*1000000000000000000L));
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24531366

http://stackoverflow.com/comment/37968543
comment on: http://stackoverflow.com/q/24522051
type: Comment
type: QuestionComment
has text: In this case it actually *doesn't* change the hash value, because `hashCode` returns the name's length and "arthur" is the same length as "clover". But this is still a strange and error-prone thing to do, and it's not clear what you're trying to accomplish.
score: 0

http://stackoverflow.com/comment/38023045
type: QuestionComment
has text: One other thing I am using struts2-core-2.2.1.jar library
comment on: http://stackoverflow.com/q/24548266
score: 0
type: Comment

psexec
tags question: http://stackoverflow.com/q/24533128
type: Tag
tag name: psexec

http://stackoverflow.com/comment/38112378
comment on: http://stackoverflow.com/a/24518114
type: AnswerComment
score: 0
type: Comment
has text: What specifically did you try? Either there's a bug with Selenium or your implementation is incorrect. So, edit your question and show the code that's not working for you.

http://stackoverflow.com/a/24453592
accepted answer of: http://stackoverflow.com/q/24452497
answers question: http://stackoverflow.com/q/24452497
has comment: http://stackoverflow.com/comment/37845237
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/37842963
has body: You would introduce the smallest absolute rounding error - while keeping the total sum intact - if you sort the inputs by decreasing third decimal and round everything down, except for just enough numbers to reach the target. As a simple example: input 0.132, 0.226, 0.257, 0.385 // sums up to 1.00 sort by 3rd decimal (descending) 0.257, 0.226, 0.385, 0.132 round everything down 0.25, 0.22, 0.38, 0.13 // sums up to 0.98 round up just enough to reach a whole number 0.26, 0.23, 0.38, 0.13 // sums up to 1.00 In code (untested): public void printRounded(double[] ds) { // create wrapper objects int n = ds.length; Wrapper[] ws = new Wrapper[n]; for (int i = 0; i &lt; n; i++) ws[i] = new Wrapper(i, (int)(ds[i] * 1000) % 10, (int)(ds[i] * 100)); // sort by third decimal, descending Arrays.sort(ws, new Comparator&lt;Wrapper&gt;() { public int compare(Wrapper o1, Wrapper o2) { return o2.thirdDecimal.compareTo(o1.thirdDecimal); } }); // find number of elements that must be rounded up and increment int sum = 0; for (int i = 0; i &lt; n; i++) sum += ws[i].prefix; int numberToIncrement = 100 - (sum % 100); for (int i = 0; i &lt; numberToIncrement ; i++) ws[i].prefix++; // sort back to input order Arrays.sort(ws, new Comparator&lt;Wrapper&gt;() { public int compare(Wrapper o1, Wrapper o2) { return o1.index.compareTo(o2.index); } }); // print values for (int i = 0; i &lt; n; i++) { System.out.println(ws[i].prefix / 100 + "." ws[i].prefix % 100); } } private class Wrapper { public Wrapper(int index, int thirdDecimal, int prefix) { this.index = index; this.thirdDecimal = thirdDecimal; this.prefix = prefix; } public int index; public int thirdDecimal; public int prefix; } Instead of using the custom formatting you could of course convert the ints back to double and use standard formatting.
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/a/24501869
answers question: http://stackoverflow.com/q/24501845
has comment: http://stackoverflow.com/comment/37931764
has comment: http://stackoverflow.com/comment/37931897
has body: Have you tried dividing your timestamp by 1000? by default the correct timestamp is only 10 digits I guess.
score: 0
type: Answer

http://stackoverflow.com/comment/38274630
has text: Can you possibly share a project?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24582747
type: QuestionComment

http://stackoverflow.com/comment/38009458
comment on: http://stackoverflow.com/q/24527419
has text: @SuleaCosmin If there is nothing in the queue, calling remove() is *wrong,* and calling clear() is merely pointless.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24540666
has body: In my android app, I build a horizontal scroll view and add contents and add it to the DOM. How can I (using java) move the scroll bar to the half way point of it? Thanks. This code doesn't work Context context = carousel_container.getContext(); HorizontalScrollView hsv = new HorizontalScrollView(context); LinearLayout carousel = new LinearLayout(context); setGallery(carousel); addFishes(); hsv.addView(carousel, new HorizontalScrollView.LayoutParams(HorizontalScrollView.LayoutParams.WRAP_CONTENT, HorizontalScrollView.LayoutParams.WRAP_CONTENT)); carousel_container.addView(hsv, new HorizontalScrollView.LayoutParams(HorizontalScrollView.LayoutParams.MATCH_PARENT, HorizontalScrollView.LayoutParams.WRAP_CONTENT)); hsv.postDelayed(new Runnable(){ @Override public void run() { int offsetX = hsv.getWidth()/2; //int offsetX = hsv.getMaxScrollAmount()/2; hsv.scrollTo(offsetX, 0); } }, 10000);
tagged with: android
tagged with: horizontalscrollview
has comment: http://stackoverflow.com/comment/38004943
has title: How to programatically move a horizontal scroll view half way in android?
has answer: http://stackoverflow.com/a/24610981
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/38003750
tagged with: horizontal-scrolling
type: Question
has comment: http://stackoverflow.com/comment/38005077
has comment: http://stackoverflow.com/comment/38003751
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24540865
answer count: 2
has comment: http://stackoverflow.com/comment/38003709
downvote count: 0
has comment: http://stackoverflow.com/comment/38004296
favorite count: 0
has comment: http://stackoverflow.com/comment/38004177

http://stackoverflow.com/comment/38073839
has text: then what is the way out?
comment on: http://stackoverflow.com/a/24578483
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38000383
type: QuestionComment
score: 0
has text: What's the error you're seeing? Can you post a stacktrace?
comment on: http://stackoverflow.com/q/24538995
type: Comment

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/24561596
type: Tag

http://stackoverflow.com/comment/38032336
has text: any solution is welcome...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24529067
type: QuestionComment

http://stackoverflow.com/comment/38010501
comment on: http://stackoverflow.com/q/24544152
has text: @ant2009 Thanks for your intention, but it doesn't matter; also, the question has been marked as duplicate, so no new answers are allowed
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37905424
has text: i already use Thread in server, but i need a method to verify the socket on the client in case i decide to maintain open the connection. Maybe i was inaccurate on my description, sorry.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24487285
type: Comment

http://stackoverflow.com/comment/37827305
type: AnswerComment
has text: I modified your code, please check it and draw conclusions.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24445556

http://stackoverflow.com/q/24500397
tagged with: access-modifiers
score: 0
has comment: http://stackoverflow.com/comment/37929113
has answer: http://stackoverflow.com/a/24500435
answer count: 3
has comment: http://stackoverflow.com/comment/37929133
has title: How to limit my method visibility
has answer: http://stackoverflow.com/a/24501638
type: UnansweredQuestion
has body: I'm learning about method/class access controlling in Java right now, and I'm having a bit of trouble setting this method to anything besides public. Idealy, I'd like TestLib to be invisible to JavaApplication8, as in programs can utilize methods in TestLib without seeing the source. Here is what I have right now: TestLib: package testlib; import java.awt.Robot; public class TestLib { private static void moveMouse(int x, int y){ try{ Robot robot = new Robot(); robot.mouseMove(x, y); }catch(Exception e){ System.out.println("Error"); } } } JavaApplication8: package javaapplication8; import testlib.TestLib; public class JavaApplication8 { public static void main(String[] args) { TestLib.moveMouse(10, 20); } } I am not allowed to access TestLib.moveMouse(x, y) unless I set method to public, which I'm pretty sure is bad practice. How can I get around this? Thanks!
has answer: http://stackoverflow.com/a/24500471
has comment: http://stackoverflow.com/comment/37929163
tagged with: java
has comment: http://stackoverflow.com/comment/37929097
tagged with: methods
has comment: http://stackoverflow.com/comment/37929115
type: Question
has comment: http://stackoverflow.com/comment/37929105
has comment: http://stackoverflow.com/comment/37929212

http://stackoverflow.com/q/24446562
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/37829912
type: Question
has answer: http://stackoverflow.com/a/24446617
has body: Here is my code class GameOfLife { public static void main(String[] args) { int height = 0; int width = 0; int [][][] universe = new int [2][20][20]; for (height=0; height &lt;= 5; height ++){ for (width=0; width &lt;= 5; width++){ universe [2][height][width]= 0; } } System.out.print(universe[2][2][3]); } } Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at test.GameOfLife.main(gameOfLife.java:10)
has comment: http://stackoverflow.com/comment/37832073
has answer: http://stackoverflow.com/a/24446620
score: -2
tagged with: arrays
has answer: http://stackoverflow.com/a/24446615
favorite count: 0
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at test.GameOfLife.main(gameOfLife.java:10)
has answer: http://stackoverflow.com/a/24446608
type: UnansweredQuestion
answer count: 4
tagged with: java

http://stackoverflow.com/q/24464267
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24469308
score: 0
tagged with: input-split
type: Question
has title: Custom Input format for input split in hadoop
tagged with: java
tagged with: mapreduce
tagged with: hadoop
has body: Am I able to get entire input split into mapper rather than each line of inputsplit into mapper. For this I need to implement my own Custom Input format. but if I am writing WholeFileInputFormat Whether it means the mapper get the entire line or entire input split? Does NLineInputFormat solves my problem?

http://stackoverflow.com/comment/37978559
type: Comment
type: QuestionComment
score: 1
has text: please post a [mcve](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/24527471

http://stackoverflow.com/q/24503970
answer count: 3
has answer: http://stackoverflow.com/a/24504067
type: UnansweredQuestion
has body: I have read about Servlet's in many tutorials. The Servlet parameters has getParameter() method. As the parameter has return type as only String. Why the ServletRequest do not have setParameter() method ? I have read about that only attributes in Servlet's can be changed, and the parameters can not. Can anyone explain the basic concept why there is no provision for updating the parameter in request with method like setParameter()?
tagged with: parameters
has title: Why setParameter() is not available for ServletRequest?
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/24504431
has answer: http://stackoverflow.com/a/25473877
score: 0

http://stackoverflow.com/a/24465452
answers question: http://stackoverflow.com/q/24465421
score: 3
has body: Try to call thread.start() instead of thread.run()
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37999253
type: AnswerComment
comment on: http://stackoverflow.com/a/24537424
score: 0
has text: Thank you. I`ve posted a bug and a question in their site.
type: Comment

http://stackoverflow.com/q/24465134
has answer: http://stackoverflow.com/a/24465144
tagged with: java
type: Question
type: AnsweredQuestion
has title: java.util.regex.PatternSyntaxException: Unclosed character class near index 0
has body: I am trying to replace all square brackets i my string . This is my program package com; import java.util.ArrayList; import org.apache.commons.lang3.StringUtils; import org.json.JSONException; public class Teste { /** * @param args * @throws JSONException */ public static void main(String[] args) throws JSONException { String str = "[Fountain#Apple#Big(7)]"; str.replaceAll("[", "").replace("]", ""); System.out.println(str); } } But i am getting Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 0 [ ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.clazz(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.&lt;init&gt;(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.lang.String.replaceAll(Unknown Source) at com.Teste.main(Teste.java:19) Could anybody please tell me how to replace all square brackets ??
score: 18
upvote count: 19
accepted answer: http://stackoverflow.com/a/24465144
answer count: 1
downvote count: 1
favorite count: 0

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/24466464

http://stackoverflow.com/q/24527841
favorite count: 0
tagged with: ms-access-2007
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I have table in Access where i store id my task and attachment (docx file) to it. Attachment has datatype "Attachment". I need to save this attachment to diskspace using java(each file in own directory). When i export this table to XML i see some like this 265 FgAAAAEAAAAFAAAAZABvAGMAeAAAAFBLAwQUAAYACAAAACEACSSHgoEBAACOBQAA EwAIAltDb250ZW50X1R5cGVzXS54bWwgogQCKKAAAgAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA [binary] ZWxzLy5yZWxzIKIEAiigAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA [binary] AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA…
score: 1
tagged with: save
has answer: http://stackoverflow.com/a/24528425
upvote count: 1
type: Question
tagged with: attachment
tagged with: java
has title: How to save attachments from MS Access 2007 using Java?
accepted answer: http://stackoverflow.com/a/24528425
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24573918
linked to: http://stackoverflow.com/q/997482
score: 6
type: Question
has body: I have to write a constructor for a class Stamp. The constructor is supposed to take up to five arguments of types String, int, and double. So, the constructor would look like this: public Stamp(String code, int year, String country, double value, int numberOfCopies){...} The problem is, as the object of the class Stamp is being created, not all the parameters may be provided, i.e., an object can be declared as Stamp stamp = new Stamp("some_code", 1991, "Burkina Faso", 50, 1000); as well as Stamp stamp = new Stamp("some_code", 1991, "Burkina Faso"); and the constructor has to work in both cases, even if the list of arguments is truncated (in the latter case, some default values are assigned to value and numberOfCopies). Of course, I can just write six constructors (for the possible number of parameters from 0 to 5, assuming that the parameters always follow the order described above, without mixing up), but there should be a smarter way. I know I can probably declare the constructor like public Stamp(Object[] params){...} and then cast the elements of params into corresponding classes. This will probably work but I will always have to check how many parameters are provided for the constructor using "if" conditions in order to decide whether to assign default values to variables if the corresponding parameters are not provided or use the provided values if those are given. This all seems pretty ugly. Thus, the question is brief: what is the way to build a constructor (or some other method) if the list of provided parameters varies in length and the types of parameters are different?
has comment: http://stackoverflow.com/comment/38065203
has answer: http://stackoverflow.com/a/24573997
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/24574082
linked to: http://stackoverflow.com/q/7428039
has answer: http://stackoverflow.com/a/24574248
has title: How to write a Java constructor for variable number of arguments of different types?
has answer: http://stackoverflow.com/a/24574491
has answer: http://stackoverflow.com/a/24574346
favorite count: 0
has comment: http://stackoverflow.com/comment/38065277
tagged with: constructor
downvote count: 0
answer count: 5
type: UnansweredQuestion

http://stackoverflow.com/comment/38083947
type: Comment
has text: Is your question *actually* about whether you need to set everything to null (you almost certainly don't) or why you're getting an exception?
type: QuestionComment
comment on: http://stackoverflow.com/q/24583985
score: 0

http://stackoverflow.com/comment/37799560
has text: @ammoQ I tried both by the way.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24429009

http://stackoverflow.com/comment/37950848
type: Comment
comment on: http://stackoverflow.com/a/24508432
has text: I use, finally, Calendar: Calendar cal = new GregorianCalendar(); cal.setTimeInMillis(duration); cal.add(cal.HOUR, -1); myObject.setDuration(new Time(cal.getTimeInMillis()));
score: 0
type: AnswerComment

http://stackoverflow.com/q/24474102
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: android-service
tagged with: android-service-binding
has body: Is it possible to bindService to a Service from a Thread? I try to pass a String to the Service running, and the run a method to show a notification? Any idea what's the correct way to do it? Thanks in advance.
answer count: 1
accepted answer: http://stackoverflow.com/a/24474508
score: 0
tagged with: android
has title: Bind service from a thread
has answer: http://stackoverflow.com/a/24474508

http://stackoverflow.com/comment/38080018
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24580873
has text: In the example you provided, what values do x and y have?

http://stackoverflow.com/q/24490860
has comment: http://stackoverflow.com/comment/37911843
linked to: http://stackoverflow.com/q/194698
type: AnsweredQuestion
score: 2
has title: Further analysis of Java source using Java (and reflection)
downvote count: 0
tagged with: compilation
has comment: http://stackoverflow.com/comment/37911651
has comment: http://stackoverflow.com/comment/37911542
favorite count: 0
accepted answer: http://stackoverflow.com/a/24495302
type: Question
has comment: http://stackoverflow.com/comment/37912488
has comment: http://stackoverflow.com/comment/37912049
upvote count: 2
has body: I try to analyze Java source code in Java6. ANTLR4 does great job in lexical analysis indeed but now I wonder if more advanced problems, such as listing inherited methods, can be managed. My idea (according to some googling): load source files get system compiler by ToolProvider.getSystemJavaCompiler() and compile sources via run() into .class files [maybe?] pack .class files to .jar and load them somehow use Java reflection to analyze compiled classes delete .class files write output (e.g. inherited methods/fields etc.) Bullets 1, 4, 5 and 6 are clean enough and well described. I belive nr. 2 can be solved using this tutorial. So my core problem is nr. 3 as I can't figure out how to load .class files and analyse them. Any ideas? Is this even possible? If so, how? Could you recommend me either a tutorial or examples? Is my idea even correct? I prefer not using third-party libraries as I'd like to understand in depth.
answer count: 1
has comment: http://stackoverflow.com/comment/37914385
has comment: http://stackoverflow.com/comment/37914317
has answer: http://stackoverflow.com/a/24495302
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/37914155
has comment: http://stackoverflow.com/comment/37912088

http://stackoverflow.com/q/24466206
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/37864883
upvote count: 0
has comment: http://stackoverflow.com/comment/37864807
has comment: http://stackoverflow.com/comment/37864847
score: -3
accepted answer: http://stackoverflow.com/a/31141062
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24466355
has answer: http://stackoverflow.com/a/24466355
has comment: http://stackoverflow.com/comment/37864885
favorite count: 0
has comment: http://stackoverflow.com/comment/37864842
type: Question
has title: Function of return statement and method parameters in java?
has answer: http://stackoverflow.com/a/24466271
has body: I'm a beginner in java. I don't know the function of return statement and method parameters in java. Can you please explain it to me further and when should it be used? Here's my code: public class Person{ public void display (String name){ System.out.println("hello" + name ); } public int execute (int num1, int num2){ int result = num1 + num2; return result; } public void display1(int num){ System.out.println("the number is: " + num); } }
has answer: http://stackoverflow.com/a/31141062
tagged with: java

http://stackoverflow.com/a/24572372
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24542375
type: Answer
has body: Get in the habit of creating all Writers, Readers, InputStreams and OutputStreams in try-with-resources statements. It ensures they will be properly closed: try (FileWriter edit = new FileWriter(chooser.getSelectedFile()+".txt")) { edit.write(editedFileText); } try (FileWriter srcFile = new FileWriter(chooser.getSelectedFile()+"_srcText"+".txt")) { srcFile.write(srcFileText); } try (FileWriter trans = new FileWriter(chooser.getSelectedFile()+"_translFile"+".txt")) { trans.write(translFileText); } If you're just writing a single String, you have the option of using Files.write, which allows you to forego the use of a Writer altogether: Files.write(Paths.get(chooser.getSelectedFile()+".txt"), editedFileText.getBytes()); Files.write(Paths.get(chooser.getSelectedFile()+"_srcText"+".txt"), srcFileText.getBytes()); Files.write(Paths.get(chooser.getSelectedFile()+"_translFile"+".txt"), translFileText.getBytes());

http://stackoverflow.com/q/24430121
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/59974248
upvote count: 14
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/25305996
has body: I want to use font font awesome in my project but I have no idea how to use font awesome in my project. I had found some example but they can't be use in fxml. font awesome javafx I need help how to use it in my project using fxml Thank you.
has answer: http://stackoverflow.com/a/55440740
has answer: http://stackoverflow.com/a/25305996
type: Question
has answer: http://stackoverflow.com/a/56188131
has answer: http://stackoverflow.com/a/32633081
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/24433222
has answer: http://stackoverflow.com/a/47210978
tagged with: javafx-8
favorite count: 0
tagged with: javafx-2
tagged with: fxml
has title: How to use font awesome in a fxml project (javafx)
accepted answer: http://stackoverflow.com/a/24433222
score: 14

static
tags question: http://stackoverflow.com/q/24470714
tags question: http://stackoverflow.com/q/24470566
tags question: http://stackoverflow.com/q/24536428
tags question: http://stackoverflow.com/q/24474772
tags question: http://stackoverflow.com/q/24504385
tags question: http://stackoverflow.com/q/24568749
tags question: http://stackoverflow.com/q/24576028
tags question: http://stackoverflow.com/q/24514635
tags question: http://stackoverflow.com/q/24521576
tags question: http://stackoverflow.com/q/24584597
tag name: static
tags question: http://stackoverflow.com/q/24506102
tags question: http://stackoverflow.com/q/24519882
tags question: http://stackoverflow.com/q/24531238
type: Tag

http://stackoverflow.com/a/37751103
has body: You can also move the stream generation into separate method/function that returns this stream and call it twice.
upvote count: 6
downvote count: 1
score: 5
answers question: http://stackoverflow.com/q/24474838
type: Answer

http://stackoverflow.com/comment/37889984
type: QuestionComment
comment on: http://stackoverflow.com/q/24478827
has text: Just couple of things as comment, your stack trace says there is error in your `RelativeLayoutListAdapter` class line no 52. It would be good if you could highlight in question which line it is. And I also noticed you are creating your listview in some weird way. You actually need to inflate the relative layout with ids of its components. I don't see that happening in your adapter class.
score: 0
type: Comment

content-length
type: Tag
tag name: content-length
tags question: http://stackoverflow.com/q/24516444

http://stackoverflow.com/comment/38045160
type: AnswerComment
type: Comment
has text: Why not? Can't you set a reference to the JPanel in the constructor then create a getter to access it? this.getMyPanel() or something?
comment on: http://stackoverflow.com/a/24562936
score: 0

http://stackoverflow.com/comment/38079097
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24578909
has text: Yes, I can replicate the problem in Chrome. I have replaced: response.setContentType("application/octet-stream"); instead of response.setContentType("application/vnd.ms-excel"); Apparently, this fixes the problem, but I am making more testing. It is really weird
score: 0

http://stackoverflow.com/q/24467330
has comment: http://stackoverflow.com/comment/37867040
has comment: http://stackoverflow.com/comment/37867085
has body: Is there a way to identify whether the following method executed completely or returned halfway through(i.e at line no 3) static int a=0; static void test(){ if(a&gt;10){ return; } a++; } The method was invoked by another method.(a might have been changed by it) I cannot change the method declaration. I am dealing with an object I created from a java file created by someone else. I am not allowed to change the original file
has answer: http://stackoverflow.com/a/24467401
favorite count: 0
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/37867202
tagged with: return
has comment: http://stackoverflow.com/comment/37867122
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/24467538
tagged with: java
has answer: http://stackoverflow.com/a/24467563
score: -1
has title: Java - How to identify whether a method executed completely or Returned
tagged with: execution
has answer: http://stackoverflow.com/a/24467435
downvote count: 2
has comment: http://stackoverflow.com/comment/37867063
upvote count: 1

http://stackoverflow.com/comment/37885247
type: Comment
comment on: http://stackoverflow.com/a/24472730
type: AnswerComment
has text: Seems to not like the argument given to the mapbinding u gave Caused by: java.lang.reflect.InvocationTargetException Syntax error on token ")", delete this token Title cannot be resolved to a variable Syntax error on tokens, delete these tokens at treetableview.StackedBarChartExample.<init>(StackedBarChartExample.java:36) ... 15 more
score: 0

http://stackoverflow.com/comment/118636553
has text: Slight correction: the result of `Math.abs(r.nextInt())` can actually be negative if the RNG happens to produce `Integer.MIN_VALUE`.
comment on: http://stackoverflow.com/a/24535551
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24578406
type: Answer
answers question: http://stackoverflow.com/q/24578191
upvote count: 1
has body: Your question mixes Maven (a java-centric dependency resolution tool) and Java compile-time and run-time class-resolution. Both are quite different. A Java .jar is, in simplified terms, a .zip file of Java .class files. During compilation, each Java source file, say MyClass.java, results in a Java bytecode file with the same name (MyClass.class). For compilation to be successful, all classes mentioned in a Java file must be available in the class-path at compile-time (but note that use of reflection and run-time class-name resolution, ala Class.forName("MyOtherClass") can avoid this entirely; also, you can use several class-loaders, which may be scoped independently of each other...). However, after compilation, you do not need to place all your .class files together into the same Jar. Developers can split up their .class files between jars however they see fit. As long as a program that uses those jars only compile-time refers to and run-time loads classes that have all their dependencies compile-time and run-time available, you will not see any runtime errors. Classes in a .jar file are not recompiled when you compile a program that uses them; but, if any of their dependencies fails at run-time, you will get a run-time exception. When using Maven, each maven artifact (typically a jar file) declares (in its pom.xml manifest file) the artifacts that it depends on. If it makes any sense to use my-company:my-library-core without needing my-company:my-library-random-extension, it is best practice to not make -core depend on -random-extension, although typically -random-extension will depend on -core. Any dependencies of an artifact that you depend on will be resolved and "brought in" when maven runs. Also, from your question, a word of warning -- it is highly probable that jackrabit-jcr2dav version 2.6.0 expects to run alongside jackrabbit-jcr-commons version 2.6.0, and not 2.8.0.
score: 1
downvote count: 0

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/24528708
tags question: http://stackoverflow.com/q/24468994
tags question: http://stackoverflow.com/q/24488211
tags question: http://stackoverflow.com/q/24510626
tags question: http://stackoverflow.com/q/24549479
tags question: http://stackoverflow.com/q/24539194
tags question: http://stackoverflow.com/q/24528068
tags question: http://stackoverflow.com/q/24543185
tags question: http://stackoverflow.com/q/24505159
tags question: http://stackoverflow.com/q/24511825
tags question: http://stackoverflow.com/q/24513981
tags question: http://stackoverflow.com/q/24539948
tags question: http://stackoverflow.com/q/24498620
tags question: http://stackoverflow.com/q/24523571
tags question: http://stackoverflow.com/q/24577092
tags question: http://stackoverflow.com/q/24483573
tags question: http://stackoverflow.com/q/24490037
type: Tag
tags question: http://stackoverflow.com/q/24521446
tags question: http://stackoverflow.com/q/24450829
tags question: http://stackoverflow.com/q/24523010
tags question: http://stackoverflow.com/q/24520609
tags question: http://stackoverflow.com/q/24514144
tags question: http://stackoverflow.com/q/24547145
tags question: http://stackoverflow.com/q/24570558
tags question: http://stackoverflow.com/q/24458504
tags question: http://stackoverflow.com/q/24475118
tags question: http://stackoverflow.com/q/24540983
tags question: http://stackoverflow.com/q/24518807
tags question: http://stackoverflow.com/q/24446137
tags question: http://stackoverflow.com/q/24482016
tags question: http://stackoverflow.com/q/24565144
tags question: http://stackoverflow.com/q/24466932
tags question: http://stackoverflow.com/q/24453125
tags question: http://stackoverflow.com/q/24451657
tags question: http://stackoverflow.com/q/24523828
tags question: http://stackoverflow.com/q/24538302
tags question: http://stackoverflow.com/q/24454782
tags question: http://stackoverflow.com/q/24534916
tags question: http://stackoverflow.com/q/24450483
tags question: http://stackoverflow.com/q/24548282
tags question: http://stackoverflow.com/q/24466451
tags question: http://stackoverflow.com/q/24566786
tags question: http://stackoverflow.com/q/24491917
tags question: http://stackoverflow.com/q/24529471
tag name: html
tags question: http://stackoverflow.com/q/24428703
tags question: http://stackoverflow.com/q/24530852
tags question: http://stackoverflow.com/q/24438799
tags question: http://stackoverflow.com/q/24477890
tags question: http://stackoverflow.com/q/24475816
tags question: http://stackoverflow.com/q/24530999
tags question: http://stackoverflow.com/q/24497907
tags question: http://stackoverflow.com/q/24465644
tags question: http://stackoverflow.com/q/24561984
tags question: http://stackoverflow.com/q/24428750
tags question: http://stackoverflow.com/q/24549544
tags question: http://stackoverflow.com/q/24496114

http://stackoverflow.com/a/24450223
has comment: http://stackoverflow.com/comment/38031571
type: Answer
has comment: http://stackoverflow.com/comment/38014687
score: 0
upvote count: 1
downvote count: 1
has body: After hours of struggling with this issue I finally decided to get rid of the update. I'm posting this just in case you want to go back to version 22.6.2: Open the SDK Manager Leave everything unchecked but the first option (the one with ADT version 23) Delete that package Restart Eclipse Hope this helps
answers question: http://stackoverflow.com/q/24437564

http://stackoverflow.com/a/25227745
score: 0
answers question: http://stackoverflow.com/q/24496671
type: Answer
has body: You might have a problem if you are using other AsyncTasks or the SerialExecutor in another task elsewhere in your program (and you may not even know it if you are using third party SDK's). See the post here: https://code.google.com/p/android/issues/detail?id=20941 I'm suggesting this because your sound "tick" isn't working either. So it isn't a matter of AudioPlayer executing with an incorrect setting necessarily, but rather some other task appears to be blocking it until that task stops, and it probably is a task that runs concurrently with when you expect to hear sound.

http://stackoverflow.com/q/24486965
score: 1
tagged with: java
type: Question
has body: I have the following field in a class under test: class ClassUnderTest { @Context public javax.ws.rs.core.SecurityContext securityContext; public void someMethod() { securityContext.getUserPrinciple(); // securityContext is always null here - never mocked } } But I cannot get JMockit to mock it using expectations or the MockUp approach, in both cases in the class under test securityContext is always null? @Test public void usingExpectations() { new Expectations() { @Mocked SecurityContext mockSecurityContext; @Mocked Principal mockPrinciple; { mockSecurityContext.getUserPrincipal(); result = mockPrinciple; mockPrinciple.getName(); result = username; } }; new ClassUnderTest().someMethod(); } @Test public using usingMockUp() { new MockUp&lt;SecurityContext&gt;() { @Mock Principle getUserPrincipal() { // return something }; } new ClassUnderTest().someMethod(); }
has title: Possible to mock fields annotated with @Context in JMockit?
tagged with: jmockit
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24493915
has answer: http://stackoverflow.com/a/24493915
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/24528481
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37981013
has comment: http://stackoverflow.com/comment/37980625
score: 0
tagged with: android
has body: I am having a strange(to me) issue with ftp upload. I am trying to upload zip files to ftp server. Its working fine except when internet connection is very slow (we tested with 56kbps). When ever I upload a file through FTP after 100% transfer it is taking some time to complete (~2mins to ~20mins depending on file size). If you see the last two logs items, it took 2mins to trigger a callback though 100% of upload is done. I am not sure why callback is triggered. Could you please shed some light on this? 07-02 10:34:38.112: D/FTP(1646): transferred26661time 2014-07-02 10:34:38 07-02 10:42:15.462: D/FTP(1646): completed 2014-07-02 10:36:27 Thanks in advance. Have a look at my code package com.androidexample.ftpdemo; import it.sauronsoftware.ftp4j.FTPClient; import it.sauronsoftware.ftp4j.FTPDataTransferListener; import java.io.File; import java.util.Date; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.os.StrictMode; import android.os.StrictMode.ThreadPolicy; import android.text.format.DateFormat; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; import com.kpbird.ftpdemo.R; public class FtpUpload extends Activity implements OnClickListener { /********* work only for Dedicated IP ***********/ static final String FTP_HOST = ""; /********* FTP USERNAME ***********/ static final String FTP_USER = ""; /********* FTP PASSWORD ***********/ static final String FTP_PASS = ""; Button btn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(this); } public void onClick(View v) { // Upload sdcard file File f = new File("/sdcard/test.zip"); uploadFile(f); } public void uploadFile(File fileName) { if (Build.VERSION.SDK_INT &gt;= 10) { ThreadPolicy tp = ThreadPolicy.LAX; StrictMode.setThreadPolicy…
tagged with: ftp
answer count: 0
has title: Delay in FTP Upload

http://stackoverflow.com/q/24575110
has title: Using docx4j in XPages applications
has body: I'm trying to install the docx4j open source java library in an XPages application but so far without success. I have downloaded the docx4j-3.1.0.jar and added it to the \jvm\lib\ext folder on both the domino server and my local machine. I have also added the docx4j-3.1.0.jar to the WebContent\WEB-INF\lib folder using the Package Explorer view, after which I right clicked the .jar and choose "Build Path" -> "Add to build path" so that the .jar now appears under "Referenced Libraries". In a Java class I'm using to test, I see the message "This element has no attached source and the Javadoc could not be found in the attached Javadoc." My code is as follows: package TESTPackage; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; public class JavaDoc { public void createJavaDoc() { try { WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); wordMLPackage.getMainDocumentPart().addParagraphOfText("Hello Word!"); wordMLPackage.save(new java.io.File("C:\\Temp\\HelloWord1.docx")); } catch (Exception e) { e.printStackTrace(); } } } Any suggestions on what else I must do?
has comment: http://stackoverflow.com/comment/38136421
tagged with: java
has answer: http://stackoverflow.com/a/24575689
type: Question
tagged with: docx4j
accepted answer: http://stackoverflow.com/a/24613583
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24613583
possible better answer: http://stackoverflow.com/a/24575689
tagged with: xpages
tagged with: ms-word
has comment: http://stackoverflow.com/comment/38073318
has comment: http://stackoverflow.com/comment/38136505
type: AnsweredQuestion

http://stackoverflow.com/a/24573549
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38070615
upvote count: 13
answers question: http://stackoverflow.com/q/24573084
type: Answer
has comment: http://stackoverflow.com/comment/38070601
has comment: http://stackoverflow.com/comment/38068798
downvote count: 0
score: 13
has body: Resource leak is generally an erroneous pattern of resource consumption where a program does not release the resource it has acquired. This can lead to poor services. Garbage collection can only manage memory, not other system resources. If your Java program has plenty of free memory, garbage collection will not be triggered automatically. All OSes have limits on the number of sockets, file handles, etc., that can be open. Thus, the unintentional maintenence of references to non-memory resources can lead to a resource leak. So it is extremely important to manage non-memory resources. Classes which utilize non-memory resources should provide ways to explicitly allocate/deallocate those resources. We need to explictly call close() methods for deallocation of file descriptors in finally{}, as it will execute whether or not an exception is thrown.
accepted answer of: http://stackoverflow.com/q/24573084

http://stackoverflow.com/comment/37900079
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24484443
has text: sir i did what u said but i am getting null pointer exception

http://stackoverflow.com/comment/37819126
has text: .aar files are some zip files. You can rename them, uncompress them and then move the sources in a new project. I know it's not a clear way... but it's still a way :)
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24440071
type: AnswerComment

http://stackoverflow.com/q/24490309
tagged with: java
accepted answer: http://stackoverflow.com/a/24490394
type: Question
has answer: http://stackoverflow.com/a/24490394
answer count: 1
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37910186
tagged with: android-intent
has title: android.intent.action.BOOT_COMPLETED on Jellybean
type: AnsweredQuestion
has body: I am stuggling to get my intent started on boot, basically the service is not appearing in my running or cached processes. I know since 3.1 you must have an activity that has run for the service to work, so this is what I have MainActivity import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Toast; public class StartActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Context context = getApplicationContext(); CharSequence text = "Updater Started"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); startService(new Intent(this,UpdaterService.class)); finish(); } } My intent import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.widget.Toast; public class StartIntent extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent myIntent = new Intent(context, UpdaterService.class); context.startService(myIntent); CharSequence text = "Updater Started"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } and finally my appmanifest <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <receiver android:enabled="true" android…
has comment: http://stackoverflow.com/comment/37910218

http://stackoverflow.com/a/24567769
accepted answer of: http://stackoverflow.com/q/24567430
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24567430
has body: The most likely application of this kind of thing is that these are objects that get inserted into a database, and selected from the database. Generally, an ID would get assigned by the database at the time of insert. This means that if you have objects with IDs, they're in the database. If two objects have the same ID, then they both represent the same row in the database. But if objects don't have IDs, then you've created them, but you haven't inserted them in the database yet. If you have two such objects, both without IDs, then these will eventually end up as two different rows in the database. But for now, they just exist within your application. Nonetheless, if they are two different objects, then they really do represent two different items of data - and therefore equals should return false for these two objects.

http://stackoverflow.com/comment/37936058
has text: Thank you, that was exactly what I needed for my implementation.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24497658

http://stackoverflow.com/comment/39076773
type: AnswerComment
comment on: http://stackoverflow.com/a/24470546
score: 0
type: Comment
has text: Can you give an example 'cos in this example, -sourcepath doesn't seem to do that. http://pastebin.com/raw.php?i=prtRjYL7

http://stackoverflow.com/a/24560561
answers question: http://stackoverflow.com/q/24559911
has body: You need to call the next method each time you pass through the for loop so that the cursor moves to the next line of the ResultSet, and so you will get the new lines. Now you are creating all the Jlabels with the first result of the Resultset.
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24559911
downvote count: 0
score: 1

http://stackoverflow.com/comment/38056132
type: Comment
type: QuestionComment
has text: See also http://stackoverflow.com/questions/18194139/make-immutable-java-object
score: 0
comment on: http://stackoverflow.com/q/24545239

http://stackoverflow.com/q/24428474
upvote count: 2
has comment: http://stackoverflow.com/comment/37796465
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37801901
accepted answer: http://stackoverflow.com/a/24431861
has comment: http://stackoverflow.com/comment/37794910
tagged with: java
has comment: http://stackoverflow.com/comment/37795131
has comment: http://stackoverflow.com/comment/37795282
tagged with: struts2
type: Question
has body: I need to show a series of check boxes and if a condition is succeeded, I need to check them. Below is my code. I have regions which is a hashmap and SelectedRegions which is an array list. I am iterating over my regions map, and displaying checkboxes with text next to it as the value from my regions map. Now, while iterating, if the value of regions map is available in the array list, I need to make the check box checked. else Un checked. I tried like the one shown below. But its not working. &lt;s:iterator value="regions"&gt; &lt;li&gt; &lt;div class="listClass"&gt; &lt;s:if test="#regions.value==selectedRegions.value"&gt; &lt;input type="checkbox" id='myTheater' checked="checked" name="theaterCheckBox" class="theaterCheckBox" /&gt; &lt;s:property value="value" /&gt; &lt;/s:if&gt; &lt;s:else&gt; &lt;input type="checkbox" id='myTheater' name="theaterCheckBox" class="theaterCheckBox" /&gt; &lt;s:property value="value" /&gt; &lt;/s:else&gt; &lt;/div&gt; &lt;div class="checkboxDiv"&gt; &lt;input type="checkbox" id="allFeatured" class="featuredCheckBox" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;/s:iterator&gt; Some how, the if condition that I am using is not working. Could you please let me know how to attain this?
tagged with: ognl
has comment: http://stackoverflow.com/comment/37795007
answer count: 1
has comment: http://stackoverflow.com/comment/37795626
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/37795424
favorite count: 0
has title: How to check list.contains in jsp using struts 2 tags
has answer: http://stackoverflow.com/a/24431861
has comment: http://stackoverflow.com/comment/37795689
score: 2

http://stackoverflow.com/comment/37912162
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24490898
has text: And you are certain that it is running previously - and accessible? Have you looked at Tomcat's STDOUT - usually catalina.out.

http://stackoverflow.com/a/24544960
has comment: http://stackoverflow.com/comment/38098806
answers question: http://stackoverflow.com/q/24493337
has comment: http://stackoverflow.com/comment/43037603
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24493337
has comment: http://stackoverflow.com/comment/38151623
score: 20
has comment: http://stackoverflow.com/comment/38068509
has body: The Java SE 8 specification has been changed to support static linking, and static linking is implemented in the JDK. This is mentioned briefly in the spec for System.loadLibrary. The sections of the JNI Specification to which it refers are here and here. Native method signatures and data types are the same for statically and dynamically linked methods. You might have to hack on the JDK makefiles to get it to link your library statically, though. One significant difference is the way static libraries are initialized. Dynamic libraries are initialized by calling the JNI_OnLoad function and are deinitialized by calling JNI_OnUnload. Each dynamic library can have its own version of these functions. If there are multiple statically linked libraries, clearly they can't all have functions with these same names. For a static library named libname the load/unload functions are JNI_OnLoad_libname and JNI_OnUnload_libname. The JNI_OnLoad_libname function must return a value of JNI_VERSION_1_8 or higher. If it doesn't, the JVM will ignore the static library. Basically, if you call System.loadLibrary("foo"), the system looks for the function JNI_OnLoad_foo in the running executable image, and if it's found, it assumes that the library is statically linked, and its native methods are searched for within the running image. If JNI_OnLoad_foo is not found, then the usual searching and loading of dynamic libraries takes place, and native methods are linked from the dynamic library so found.
has comment: http://stackoverflow.com/comment/63882120
has comment: http://stackoverflow.com/comment/38096921
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43042487
upvote count: 20
type: Answer

http://stackoverflow.com/comment/37968471
has text: put it in `onCreate()`. Or if you're using ` startActivityForResult()` then try putting it in `onActivityResult`. More info on `startActivityForResult`: http://developer.android.com/training/basics/intents/result.html
type: Comment
comment on: http://stackoverflow.com/a/24521893
score: 0
type: AnswerComment

http://stackoverflow.com/comment/47046155
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24543787
has text: So I just opened an [issue](https://github.com/elastic/elasticsearch/issues/10421) regarding the this problem at the elasticsearch github repository. Hope the answer will come from there...
score: 1

http://stackoverflow.com/comment/37946012
score: 0
type: Comment
has text: Safe from using `Object`s in every collection or map, I doubt you'll find a solution. Generics was introduced for this reason. By the way, `instanceof` is an operator, not a method.
type: QuestionComment
comment on: http://stackoverflow.com/q/24510035

http://stackoverflow.com/comment/37982029
comment on: http://stackoverflow.com/q/24524308
has text: Try with 3.9.3, it should be solved: http://jira.codehaus.org/browse/JBEHAVE-1018
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24531170
score: 0
tagged with: java
type: Question
answer count: 1
has title: RejectedExecutionException when loading bitmaps for ListView with asyncTask
tagged with: android-listview
tagged with: android
tagged with: android-asynctask
has body: I'm trying to create a ListView with bitmaps that are generated on demand. I'm using https://github.com/chrisbanes/Android-BitmapCache to cache the bitmaps I'm using a SimpleAdapter, with this : setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object object,String string) { if( string.startsWith("ClassName:") ){ final ImageView yourImageView=(ImageView) view; AsyncTask&lt;String, Void, Bitmap&gt; imageLoadAsyncTask = new AsyncTask&lt;String, Void, Bitmap&gt;() { String cname; @Override protected Bitmap doInBackground(String... classnames) { cname=classnames[0]; return db.getCharIcon(classnames[0]); } @Override protected void onPostExecute(Bitmap bitmap) { yourImageView.setImageBitmap(bitmap); } }; imageLoadAsyncTask.execute(string.substring(TextUtils.getTrimmedLength("ClassName:"))); return true; } return false; } } the getCharIcon function is here : Bitmap getCharIcon(String classname){ Bitmap modBmp; CacheableBitmapDrawable cacheBmp=mCache.get(classname); if(cacheBmp==null) { modBmp=createCharIcon(classname); mCache.put(classname,modBmp); } else { modBmp=cacheBmp.getBitmap(); } return modBmp; } where createCharIcon generates the bitmap this way (I have yet to implement the final version that selects the good portion of the image): Bitmap createCharIcon(String classname) { Bitmap modBmp = Bitmap.createBitmap(srcBmp,0,0,60,60); return modBmp; } Sadly I am getting this error : 07-02 14:13:04.248 11592-11592/com.lectem.gecharacters E/AndroidRuntime﹕ FATAL EXCEPTION: main java.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1876) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:774) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1295) at android.os.AsyncTask.execute(AsyncTask.java:394) at com.lectem.gecharacters.CharFragment$1.setViewValue(CharFragment.java:110) at android.widget.…
type: UnansweredQuestion
tagged with: android-bitmap
has answer: http://stackoverflow.com/a/24531297

http://stackoverflow.com/comment/38006817
type: QuestionComment
has text: adding that doesnt really do anything for me. I have 2 calls here in order to trigger the exception, as it works for the first time but not the second
type: Comment
comment on: http://stackoverflow.com/q/24520499
score: 0

http://stackoverflow.com/comment/37816215
type: Comment
has text: @shmosel the arraylist isn't updated on actionperformed so the data isn't displyed in JTable
score: 0
comment on: http://stackoverflow.com/q/24439536
type: QuestionComment

http://stackoverflow.com/q/24504728
has answer: http://stackoverflow.com/a/24507311
score: 0
has comment: http://stackoverflow.com/comment/37951936
has comment: http://stackoverflow.com/comment/37940225
answer count: 1
has title: Maintain separate rule files in drools
accepted answer: http://stackoverflow.com/a/24507311
has comment: http://stackoverflow.com/comment/37940966
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37946000
tagged with: java
has comment: http://stackoverflow.com/comment/37946162
type: Question
tagged with: drools
has body: I have a use-case where I need to maintain separate drl file for separate entities. For example, entity 1 has a set of facts which should be driven by drl1 entity 2 has a set of facts which should be driven by drl2 How should I implement this? Load the drl's and corresponding facts in separate Knowledge base and sessions Load all drl's and facts in single session. I do not know how to achieve 2

http://stackoverflow.com/comment/38058849
type: QuestionComment
type: Comment
score: 0
has text: Have you tried to flush and close the DataOutputStream in the client?
comment on: http://stackoverflow.com/q/24569804

http://stackoverflow.com/a/24580476
answers question: http://stackoverflow.com/q/24579550
has body: OK, got it. The issue is this: my Config class is really in a package, i.e. vis.globe.Config.java, so getResource("Config.Xxml") really looks for a file called vis.globe.Config.xml. Therefore, with a classpath such as "../config:../jar/appl.jar", it will look for file Config.xml, not in ../config, but in ../config/vis/globe. So the solution was to create a sub-directory structure in ../config that reflects the fully qualified name of class Config.java, i.e. ../config/vis/globe/Config.xml
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/38049280
comment on: http://stackoverflow.com/q/24565167
has text: Based on your `JSON` request, how do you know what type the value is? Have you verified `val.getClass()` matches your expectations? It would appear that that `args.keys()` doesn't gurenetee the order of the parameters
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38030026
has text: Represent the monster type as an enum an choose one of its values randomly. I will not give code.
comment on: http://stackoverflow.com/q/24555086
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/24517175
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24537396
has comment: http://stackoverflow.com/comment/37965138
has comment: http://stackoverflow.com/comment/37963752
tagged with: arraylist
answer count: 2
has comment: http://stackoverflow.com/comment/37960420
favorite count: 0
has comment: http://stackoverflow.com/comment/37960043
accepted answer: http://stackoverflow.com/a/24537396
has title: How to add threads to an ArrayList
has answer: http://stackoverflow.com/a/24517207
score: 2
upvote count: 3
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24517207
has body: I have a class, SmartQueue which extends Thread and looks like this public class SmartQueue extends Thread { public int idQ; public LinkedList&lt;Client&gt; sQueue = new LinkedList&lt;Client&gt;(); ...... //pops an element from sQueue after a random time in a specified interval //and then waits to be notified again From another class, QManager I want to create a few threads of SmartQueue inside a for loop and keep track of them by adding them to an ArrayList. Then add one element at a time in SmartQueue.sQueue at some random time in another specified interval. Also the removal of an element in SmartQueue would also be triggered in class QManager by..."extracting" the thread from the ArrayList and notifying it. Basically I am trying to create a queue simulator where generated "clients" arrive and are served at/in some random time, with each queue having it's own processor and running as a thread at the same time with the other queues Is the ArrayList way of keeping track of the threads viable or it's...just stupid? How should I do it? Also any ideas on how to implement this simulator are welcomed
downvote count: 1
type: Question

http://stackoverflow.com/a/24531930
has comment: http://stackoverflow.com/comment/37991763
has comment: http://stackoverflow.com/comment/37990413
has body: Using a Boolean as a lock is a very bad idea: you are effectively using a global variable Boolean.TRUE/FALSE which any other parts of your code can access and potentially deadlock your code. And using a non final variable as a lock is an even worse idea: everytime you reallocate the instance (isCondition = true) you change your lock, meaning that two threads may execute your synchronized block concurrently, which kind of defeats the whole idea. So I would recommend a standard idiom: private static final Object lock = new Object(); private static boolean isCondition; synchronised(lock) { isCondition = true; // ... }
answers question: http://stackoverflow.com/q/24531686
has comment: http://stackoverflow.com/comment/37996823
downvote count: 0
has comment: http://stackoverflow.com/comment/37996312
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/a/24567361
has body: What you can do is to count the number of spaces before you add the reflection of the numbers to form a butterfly effect in the console, using the String.format sample: public static void main(String[] args) { int j; for (int i = 0; i &lt;= 8; i++) { for ( j = 1; j &lt;= i + 1; j++) { System.out.print(j); } System.out.print(String.format("%"+((10 - j)*2 != 0 ? (10 - j)*2 : "")+"s", "")); for ( j = i + 1; j &gt;= 1; j--) { System.out.print(j); } System.out.println(); } for (int i = 8; i &gt;= 1; i--) { for ( j = 1; j &lt;= i ; j++) { System.out.print(j); } System.out.print(String.format("%"+((10 - j)*2 != 0 ? (10 - j)*2 : "")+"s", "")); for ( j = i; j &gt;= 1; j--) { System.out.print(j); } System.out.println(); } } results: 1 1 12 21 123 321 1234 4321 12345 54321 123456 654321 1234567 7654321 12345678 87654321 123456789987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24567036
type: Answer
downvote count: 0

http://stackoverflow.com/q/24549765
type: Question
upvote count: 6
has comment: http://stackoverflow.com/comment/38022466
tagged with: cordova
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24549844
has body: I'm trying to make my first app using Phonegap and I got this while running in command C:\USERS\KTR\DESKTOP\PHONEGAP\LIB\ANDROID\BIN&gt;create C:\Users\KTR\Desktop\Demoap p com.example.Demoapp Demoapp The JAVA_HOME environment variable is not set. Set JAVA_HOME to an existing JRE directory. Remember to also add JAVA_HOME to the PATH variable. After updating system variables, open a new command window and retry. Any help would be greatly appreciated Thank you
has title: The JAVA_HOME environment variable is not set
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38020634
linked to: http://stackoverflow.com/q/2619584
score: 1
has answer: http://stackoverflow.com/a/24931917
favorite count: 0

http://stackoverflow.com/a/24547664
score: 1
has comment: http://stackoverflow.com/comment/38018352
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38016723
has comment: http://stackoverflow.com/comment/38016648
has comment: http://stackoverflow.com/comment/38018917
type: Answer
has comment: http://stackoverflow.com/comment/38018477
accepted answer of: http://stackoverflow.com/q/24547538
has comment: http://stackoverflow.com/comment/38018843
has body: You mean this regex, \+CUSD:\s*(\d+)(?:,\s*\"([^\"]*)\"(?:,(\d+))?)? In java it would be, "\\+CUSD:\\s*(\\d+)(?:,\\s*\\\"([^\\\"]*)\\\"(?:,(\\d+))?)?" DEMO First capturing group(\d+) captures the &lt;m&gt; part and the second one([^,]*) captures the &lt;str&gt; part and the third one (\d+) captures the &lt;dcs&gt; part.
has comment: http://stackoverflow.com/comment/38018000
answers question: http://stackoverflow.com/q/24547538
has comment: http://stackoverflow.com/comment/38019138
downvote count: 0
has comment: http://stackoverflow.com/comment/38018109

http://stackoverflow.com/comment/37901427
has text: What kind of list is returned by strategy.process? Is it a plain ArrayList ore some specialized Collection?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24485348

http://stackoverflow.com/q/24482138
tagged with: osgi
has body: I create OSGI bundle according to this tutorial, but when I try to install bundle using: osgi&gt; install file:/&lt;path&gt;/sample01-1.0.0.jar it will show this error: Hello World...! osgi&gt; install file:/sample01-0.0.1-SNAPSHOT.jar&lt;br&gt; gogo: BundleException: An error occurred trying to read the bundle&lt;br&gt; osgi&gt; " What is the problem? This is my first OSGI bundle.
has comment: http://stackoverflow.com/comment/37915340
upvote count: 2
type: UnansweredQuestion
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/25475922
tagged with: osgi-bundle
tagged with: java
has comment: http://stackoverflow.com/comment/37935697
tagged with: eclipse
answer count: 2
score: 2
has answer: http://stackoverflow.com/a/26459384
has comment: http://stackoverflow.com/comment/38121132
downvote count: 0
has title: gogo: BundleException: An error occurred trying to read the bundle in OSGi with Equinox
favorite count: 0

http://stackoverflow.com/comment/69668577
type: Comment
has text: Another reason to avoid the Gesture Detector solution is that it doesn't work with keypad navigation.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26196831

http://stackoverflow.com/comment/37898851
type: Comment
has text: Every bidirectional association [must set both sides](http://stackoverflow.com/questions/5460573/hibernate-bidirectional-manytoone-updating-the-not-owning-side-not-working).
comment on: http://stackoverflow.com/a/24453392
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41072032
has text: What i did is downloaded new ADT (https://developer.android.com/sdk/index.html) and then used the same workspace which i used for previous one and then it all works for me.... no hassles no troubles all goes pretty well ...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24437564

http://stackoverflow.com/a/24557336
downvote count: 1
type: Answer
has body: Of course they won't be unique. They'll be random. It's perfectly cromulent for the psuedo random number generator to spit back out the same number that it's already produced. If you run it long enough, like 2^32 times, you will not get 2^32 unique numbers. Many numbers will be repeated. If you want unique, random values, UUIDs are a good start (although they are not guaranteed to be unique - the are for all practical purposes.)
answers question: http://stackoverflow.com/q/24557218
score: 1
upvote count: 2

types
tags question: http://stackoverflow.com/q/24544255
type: Tag
tag name: types
tags question: http://stackoverflow.com/q/24547856
tags question: http://stackoverflow.com/q/24530393
tags question: http://stackoverflow.com/q/24512578
tags question: http://stackoverflow.com/q/24431319
tags question: http://stackoverflow.com/q/24487646
tags question: http://stackoverflow.com/q/24479959
tags question: http://stackoverflow.com/q/24460712
tags question: http://stackoverflow.com/q/24523342

http://stackoverflow.com/comment/57522010
type: AnswerComment
has text: @markthegrea you can do initialization in prepare method because execute method will run each time a new tuple comes in.
type: Comment
comment on: http://stackoverflow.com/a/32117917
score: 0

http://stackoverflow.com/a/36771820
upvote count: 1
answers question: http://stackoverflow.com/q/24509103
downvote count: 0
has body: Reinstalling the entire current version of glassfih4 folder solved my issue on OS X 10.11.3. Then I simply ran in ../glassfish4/galssfish/ sudo ./bin/asadmin start-domain and then it worked again...
type: Answer
score: 1

http://stackoverflow.com/a/26466136
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24427693
score: 1
has body: To load CSV data into MySQL database in the correct order, regardless of column order in the file, do this: LOAD DATA INFILE path/to/datafile.csv INTO TABLE tablename (colA, colB, colC) Ordinarily, the column list (colA, colB, colC) is optional. However, when (as in this question) the order of columns is different between the CSV file and the DB table, then arrange the column names in the order you want them inserted into the table, like so: LOAD DATA INFILE path/to/datafile.csv INTO TABLE tablename (colC, colB, colA) To see other options for loading CSV data into mysql, check out http://dev.mysql.com/doc/refman/5.1/en/load-data.html

http://stackoverflow.com/comment/38019966
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24549205
type: Comment
has text: The map is working fine. The output of the map looks like this: `{dateFrom=02-07-2014, dateTo=02-07-2014, season=SO03}` But do you have some suggestions for adding the operands to the parameter list with your solution?

http://stackoverflow.com/a/24473544
score: 1
has comment: http://stackoverflow.com/comment/37893732
has comment: http://stackoverflow.com/comment/37893935
has comment: http://stackoverflow.com/comment/37879264
has comment: http://stackoverflow.com/comment/37894309
upvote count: 2
has comment: http://stackoverflow.com/comment/37894487
downvote count: 1
has comment: http://stackoverflow.com/comment/37888810
has comment: http://stackoverflow.com/comment/37889582
type: Answer
has body: Old answer. The reason I am making this new answer is because I was using Boolean's compareTo method, which uses a ternary operator to convert boolean expressions to binary. Here is my new answer, which is much more unreadable. public static String positiveOrNegative(int n) { ArrayList&lt;String&gt; responses = new ArrayList&lt;String&gt;(); // first element should be "Zero", so if n is 0, the response is "Zero" responses.add("Zero"); // this populates the ArrayList with elements "Positive" for n elements // so that if n is positive, n will be an index in the ArrayList // and the return will be "Positive" // but still if n is negative, it will never be an index in the ArrayList for (int i = 0; i &lt; n; i++) { responses.add("Positive"); } String response = ""; try { // try to get a response from the ArrayList response = responses.get(n); } catch (Exception e) { // index is out of bounds, so it must have been negative response = "Negative"; } return response; } public static void main(String[] args) { System.out.println(positiveOrNegative(4)); // Positive System.out.println(positiveOrNegative(1)); // Positive System.out.println(positiveOrNegative(0)); // Zero System.out.println(positiveOrNegative(-1)); // Negative System.out.println(positiveOrNegative(-4)); // Negative }
has comment: http://stackoverflow.com/comment/37880132
answers question: http://stackoverflow.com/q/24473430

http://stackoverflow.com/a/24604076
has comment: http://stackoverflow.com/comment/38175260
answers question: http://stackoverflow.com/q/24574046
has body: It may be possible that file does have extension that you may not be able to see because Operating system settings have hide the extensions or some rules on your server may causing it to return 404. Java does not give file not found exception because of extension. Please let us know the issue, when you resolve it.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/38165705

http://stackoverflow.com/comment/38093892
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24587792
score: 0
has text: so the ground is not a bitmap?or bitmap can be polygon too ?

http://stackoverflow.com/comment/38074663
score: 0
type: AnswerComment
type: Comment
has text: @Bayant_singh: sounds good. Please comment back when you've posted your edited question.
comment on: http://stackoverflow.com/a/24578483

http://stackoverflow.com/a/24533365
score: 2
upvote count: 2
has body: Try this one, DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); Date exactDate = formatter.parse("07/02/2014");
answers question: http://stackoverflow.com/q/24533277
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38323296
type: Comment
has text: Ah, when you create the file writer variable, add a true value right after the file variable in the initialization
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24565609

http://stackoverflow.com/a/24436621
has body: You have to be able to check the result first, then check for the loop condition: String Ans; do { Ans = ans.nextLine() if (Ans.equals("Yes")) { System.out.print("Woof :-)"); } else if(Ans.equals("No")) { System.out.print("Grrrr :-("); } else { System.out.print("What? Please try again."); } } while (!(Ans.equals("Yes") || Ans.equals("No")));
has comment: http://stackoverflow.com/comment/37810112
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24436562
downvote count: 0
has comment: http://stackoverflow.com/comment/37809844
type: Answer

http://stackoverflow.com/q/24482004
upvote count: 3
tagged with: loops
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: crop() has parameters that are two Points in the Cloud. One of these two Points is a bottom corner, and the other the top corner of a rectangle, located diagonally across from the first Point. crop() will remove all points outside this rectangle from the Cloud, much like you would crop an image. The crop() method must deal with two input points on a horizontal or vertical line segment, in which case all points not on the line segment are removed, and it must deal with two equal Points p1 and p2, in which case all Points but p1 are removed from the Cloud. For example, if the two input Points are (0.0,0,0) and (1.0,1.0), all Points outside the square delimited by (0.0,0.0), (0.0,1.0), (1.0,1.0), and (0.0,1.0) are removed, but if the two input Points are (0.0,0,0) and (0.0,1.0), all Points outside the line segment delimited by (0.0,0.0), and (0.0,1.0) are removed. So if you have final cloud: [(3.0,1.0), (2.0,2.0), (1.5,1.5), (3.0,0.0)] you should get cropped cloud: [(3.0,1.0), (3.0,0.0)] At this point I really want to know a solution cause I'm so frustrated that I can't figure it out... So any help or suggestions about how you guys would solve it would be nice. I came pretty close, but I was just missing one main thing. I had this: public void crop(Point p1, Point p2) { double highX = 0; double lowX = 0; double highY = 0; double lowY = 0; double x1 = p1.getX(); if (p1.getX() &gt; p2.getX()) { highX = p1.getX(); lowX = p2.getX(); } else { highX = p2.getX(); lowX = p1.getX(); } if (p1.getY() &gt; p2.getY()) { highY = p1.getY(); lowY = p2.getY(); } else { highY = p2.getY(); lowY = p1.getY(); } for (int i = 0; i &lt; points.size(); i++) { Point P = points.get(i); if (P.getX() &lt; lowX || P.getX() &gt; highX || P.getY() &lt; lowY || P.getY() &gt; highY) { points.remove(i); } if (P.getX() == lowX &amp;&amp; P.getX() == highX &amp;&amp; P.getY() == lowY &amp;&amp; P.getY() == highY) { points.remove(i); } } // vertical if (p1.getX() == p2.getX()) { double x = p1.getX(); for (…
has comment: http://stackoverflow.com/comment/37895881
tagged with: for-loop
score: -5
tagged with: arrays
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37895872
type: Question
has answer: http://stackoverflow.com/a/24482088
downvote count: 8
has title: cropping an array list in java [rectangle]

http://stackoverflow.com/comment/37892440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24480465
score: 0
has text: I think this is the git repo: https://github.com/lemmy/skype4java it seems dead, new maintainer is requested.

http://stackoverflow.com/comment/37945529
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24509523
has text: i'm not using Java 8 right now, but this definitely helps :)

http://stackoverflow.com/q/24480083
has answer: http://stackoverflow.com/a/24480166
accepted answer: http://stackoverflow.com/a/24480104
possible better answer: http://stackoverflow.com/a/24480136
favorite count: 0
has answer: http://stackoverflow.com/a/24480136
has answer: http://stackoverflow.com/a/24480179
upvote count: 2
tagged with: double
has comment: http://stackoverflow.com/comment/37891996
has answer: http://stackoverflow.com/a/24480429
linked to: http://stackoverflow.com/q/8108642
has title: declaring floating and long types correctly in java?
score: 2
type: AnsweredQuestion
tagged with: java
has body: So I understand the point that if I am declaring a long variable I need to add a L in the end of number. long x = 123L; Same with float type also, I need to add a F at the end of variable. float x = 1.1F; but I was wondering why its done differently in these two cases? I mean If i am declaring a int or any other data-type its done simply int x = 1; why declaration of these two data-types is done in a certain (for long and float types). I know its done this way I just want to understand why this is done in this way?
tagged with: floating-point
has answer: http://stackoverflow.com/a/24480398
has answer: http://stackoverflow.com/a/24480104
type: Question
has comment: http://stackoverflow.com/comment/37891822
answer count: 6
has comment: http://stackoverflow.com/comment/37893662
downvote count: 0

http://stackoverflow.com/q/24432194
has body: I want to filter an arraylist of CmisObjects and put the objects that are correct (correct with the filter) in another arraylist. I have 6 fields that need to be checked which are 1 text input, 3 select boxes and 2 date inputs. So i want the objects that match the values in the fields in the new arraylist. I checked other questions on Stackoverflow, some of them were similar but I want to know if someone has a clearer answer with maybe some example code. Thanks in advance! EDIT Here is some code i have now, it only checks for 2 fields. String zoekterm = request.getParameter("zoekterm").toLowerCase(); String zoektermselect = request.getParameter("zoektermselect"); String startdatum = request.getParameter("startdatum"); String einddatum = request.getParameter("einddatum"); String status = request.getParameter("status"); String type = request.getParameter("type"); ArrayList<CmisObject> alleDossiers = (ArrayList<CmisObject>) request.getSession().getAttribute("alledossiers"); ArrayList<CmisObject> filterlist = new ArrayList<CmisObject>(); for (CmisObject dossier : alleDossiers) { String dossiernaam = dossier.getName().toLowerCase(); String dossierexternepartij = ((String) dossier.getPropertyValue("oc:bedrijfsnaam")).toLowerCase();; String dossierstatus = ((String) dossier.getPropertyValue("oc:contractstatus")); String dossiertype = ((String) dossier.getPropertyValue("oc:contracttype")); if (zoektermselect.equals("Alle")) { if (dossiernaam.contains(zoekterm) || dossierexternepartij.contains(zoekterm)) { filterlist.add(dossier); } } if (zoektermselect.equals("Dossiernaam")) { if (dossiernaam.contains(zoekterm)) { filterlist.add(dossier); } } if (zoektermselect.equals("Externe partij")) { if (dossierexternepartij.contains(zoekterm)) { filterlist.add(dossier); } } } PrintWriter out = response.getWriter(); out.println(" "); int counter = 1; for (CmisObject dossier : filterlist) { out.println(" " + dossier.getId() + " "); out.println(" " + dossier.getName() + " "); out.println…
type: AnsweredQuestion
tagged with: list
tagged with: java
type: Question
has title: Filtering a list in Java and put the results in a new arraylist
tagged with: arraylist
score: 0
tagged with: filter
has comment: http://stackoverflow.com/comment/37801993
answer count: 1
has comment: http://stackoverflow.com/comment/37802271
has answer: http://stackoverflow.com/a/24432475
accepted answer: http://stackoverflow.com/a/24432475

http://stackoverflow.com/comment/37819896
comment on: http://stackoverflow.com/q/24441689
type: Comment
has text: Check out this answer: http://stackoverflow.com/a/20900934/1007510
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37844796
score: 0
type: Comment
has text: Agreed with most points. In this case, I am getting results from `java.sql.ResultSet`. JDBC drivers don't use asynchronous I/O.
comment on: http://stackoverflow.com/a/24445538
type: AnswerComment

http://stackoverflow.com/q/24459586
linked to: http://stackoverflow.com/q/5298035
has title: HsqlException: Database lock acquisition failure: reason: java.io.FileNotFoundException: /data/explorecalifornia.lck (No such file or directory)
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37854869
score: 3
upvote count: 3
tagged with: java
tagged with: hibernate
has body: I'm trying to connect to HSQL using Java. I'm using a tutorial to work with JDBC and hibernate. It's the lynda tutorials. Anyway, here's the code below: package com.lynda.javatraining.db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { private static final String USERNAME = "dbuser"; private static final String PASSWORD = "dbpassword"; private static final String CONN_STRING = "jdbc:hsqldb://data/explorecalifornia"; public static void main(String[] args) throws SQLException { //Class.forName("com.mysql.jdbc.Driver"); Connection conn = null; System.out.println("A"); System.out.println(conn == null); System.out.println(CONN_STRING); try { System.out.println("B1"); conn = DriverManager.getConnection(CONN_STRING, USERNAME, PASSWORD); System.out.println("B1-2"); System.out.println("Connected!"); } catch (SQLException e) { System.out.println("B2"); System.err.println(e); } finally { System.out.println("B3"); if (conn != null) { conn.close(); } } System.out.println("C"); } } Here's the error I'm getting: A true jdbc:hsqldb://data/explorecalifornia B1 2014-06-27T15:26:27.430-0400 SEVERE could not reopen database org.hsqldb.HsqlException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@76d682a[file =/data/explorecalifornia.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: /data/explorecalifornia.lck (No such file or directory) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.error.Error.error(Unknown Source) at org.hsqldb.persist.LockFile.newLockFileLock(Unknown Source) at org.hsqldb.persist.Logger.acquireLock(Unknown Source) at org.hsqldb.persist.Logger.openPersistence(Unknown Source) at org.hsqldb.Database.reopen(Unknown Source) at org.hsqldb.Database.open(Unknown Source) at org.hsqldb.DatabaseManager.getDatabase(Unknown Source) at org.hsqldb.DatabaseManager.newSession(Unknown Source) at org.hsqldb.jdbc.JDBCConnection.<init…
has comment: http://stackoverflow.com/comment/37853680
type: Question
has comment: http://stackoverflow.com/comment/37852599
has comment: http://stackoverflow.com/comment/37854161
has comment: http://stackoverflow.com/comment/37854879
has answer: http://stackoverflow.com/a/24459643
downvote count: 0
answer count: 1
tagged with: hsqldb
favorite count: 0

http://stackoverflow.com/a/24541564
answers question: http://stackoverflow.com/q/24541500
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/38006126
accepted answer of: http://stackoverflow.com/q/24541500
has body: Use this regex: [^/.]+(?=\.[^.]+$) See demo. In Java: Pattern regex = Pattern.compile("[^/.]+(?=\\.[^.]+$)"); Matcher regexMatcher = regex.matcher(subjectString); if (regexMatcher.find()) { ResultString = regexMatcher.group(); } Explanation [^/.]+ matches any chars that are not a slash or a dot The lookahead (?=\.[^.]+) asserts that what follows is a dot followed by non-dots and the end of the string

http://stackoverflow.com/a/24437220
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: There is a constant for this starting with Java 7. In the code example you post the value is used only once, and a comment describes what it's for, so there is no point in using a constant. It could be argued it's better off without a constant because when reading you don't have to stop and look around for the constant definition. Using a constant creates an expectation in the reader that this is something that will show up multiple times, hard-coding this makes it clear that this value doesn't appear anywhere else. For these reasons not using a constant could have been a choice made to improve readability. Once the initialization logic changed to be lazy, the default capacity value had to be referenced in two places (because it had to be checked when adding a new element). Introducing a constant made sense; if a maintainer of the class wants to change the initial capacity then they only have to make the change in one place.
answers question: http://stackoverflow.com/q/24437012

http://stackoverflow.com/q/24455173
linked to: http://stackoverflow.com/q/9284106
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has body: I want my application to notify me once at 3 am in the morning then at 7 pm in the evening then 3.01 am in the morning and 7.01 pm in the evening and so on. My code for just one notification is PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(), 0); Calendar calendar = Calendar.getInstance(); calendar.set(2014, Calendar.JUNE, 27, 4, 0); long startTime = calendar.getTimeInMillis(); Notification notif = new Notification(R.drawable.icon, "Testing...", startTime); notif.setLatestEventInfo(context, from, message, contentIntent); notif.sound = Uri.parse("android.resource://" + context.getPackageName() + "/" + R.raw.glass); notif.vibrate = new long[] { 100, 250, 100, 500 }; nm.notify(1, notif); Now even when I do this Calendar calendar = Calendar.getInstance(); calendar.set(2014, Calendar.JUNE, 27, 4, 0); long startTime = calendar.getTimeInMillis(); I get notification at current time, for example, it is 4 pm now and I set notification of 7 pm, when I run the app then it notifies me very next second i.e. 4pm. I have seen these links and they are doing same but for Alarm. Android notify the user at a later time http://blog.blundell-apps.com/notification-for-a-user-chosen-time/ I am having problem in setting up notification for a later time? I want to notify user daily, twice a day. How can I achieve this? (If I cant achieve this with notification then let me know how to achieve this with alarm.) Thanks
tagged with: android
has title: Notification at later time and daily
answer count: 0

http://stackoverflow.com/comment/38019690
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24549157
has text: they are from maven dependencies : particularly : httpcore-4.3.2, httpclient-4.3.3, httpmime-4.3.3
score: 0

http://stackoverflow.com/q/24525075
type: UnansweredQuestion
tagged with: swing
type: Question
has title: Eclipse Jave Swing Unidentified Error
tagged with: eclipse-indigo
tagged with: java
has body: When am trying to move a button or any components in my java swing application, a error message is popping up. Error message
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24525163

http://stackoverflow.com/a/49273050
upvote count: 4
downvote count: 0
has body: In spring boot 2 @Configuration public class RepositoryConfiguration extends RepositoryRestConfigurerAdapter { @Override public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { config.setBasePath("/my/base/uri"); } }
answers question: http://stackoverflow.com/q/24577400
type: Answer
score: 4

http://stackoverflow.com/comment/38019197
type: AnswerComment
comment on: http://stackoverflow.com/a/24549001
has text: Really? I get output: 3 2 0 1 - then process terminates
type: Comment
score: 0

http://stackoverflow.com/comment/37822663
has text: My problem is not really the transparency! It is more how to manage the lifecycle of the activities.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24443240

http://stackoverflow.com/comment/37970382
has text: i want to add these edit text views as a list item.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24522703

http://stackoverflow.com/q/24529782
has comment: http://stackoverflow.com/comment/37986667
score: 0
has comment: http://stackoverflow.com/comment/38015971
has comment: http://stackoverflow.com/comment/37997115
answer count: 1
has body: In my application id is changing dynamically,and name is not given to all elements. Now I want to apply dynamic way of searching "x path" in different Division in HTML. Whenever I refresh page , database value can be added or removed from page. So is there any way for taking dynamic path of one element??
has comment: http://stackoverflow.com/comment/37994666
tagged with: xpath
has answer: http://stackoverflow.com/a/28342633
has comment: http://stackoverflow.com/comment/38068865
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
tagged with: selenium
accepted answer: http://stackoverflow.com/a/28342633
type: Question
has title: How can I change my xpath dynamically in Selenium WebDriver?

http://stackoverflow.com/comment/105728177
has text: @masterwok you should open a seperate thread becuase this one is for setSelection scrolling down
type: AnswerComment
comment on: http://stackoverflow.com/a/24543293
score: 0
type: Comment

http://stackoverflow.com/q/24497907
tagged with: java
tagged with: struts
type: Question
score: 0
tagged with: encoding
tagged with: jsp
tagged with: http://stackoverflow.com/tag/html
has body: I'm having problems displaying some special characters within my Struts 1 application, specifically to Textarea fields, NOT normal Text fields. I pull out a bunch of text from a database, some of which contains special HTML characters, namely ', &lt; and > Before display, I have some Java formatter classes to convert those characters to something more HTML friendly. For example ' which my formatter transcribes to &amp; #39; On display however, I basically get the raw &amp; #39; displayed. Does anyone know a way around this? Or why it only seems to happen with Textarea, as using a regular Text input displays the ' as expected. My jsp page encoding is ISO-8859-1. I've tried it with UTF-8, but no luck
has title: Textarea display of special characters. Struts 1
has comment: http://stackoverflow.com/comment/37953753
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/196097
has comment: http://stackoverflow.com/comment/37992149

http://stackoverflow.com/q/24458854
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24462617
has title: issue at downloading torrents java
has body: I'm trying to build a java torrent downloader, based on ttorrent java library (link goes to docs and basic instructions). I followed the instructions listed in the javadoc , exactly as they are. When running the code, notthing appears to happen. No exceptions either. And obviously the file is not downloaded, I can't even see a ".part" file in my downloads folder. Stays at 0%. This is my code so far (compare it with the code in the docs). Client client = new Client( InetAddress.getLocalHost(), SharedTorrent.fromFile( new File(TORRENTPATH), new File(MKPATH))); client.download(); client.waitForCompletion(); I didn't find any better documentation of ttorrent than that one. What am I doing wrong? And of course, the torrent has seeds because I downloaded it before from another torrent manager. UPDATE: Although nothing is downloaded, the download process appears to start but throws the following log message:
has comment: http://stackoverflow.com/comment/67740915
has comment: http://stackoverflow.com/comment/37851377
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37852885
has comment: http://stackoverflow.com/comment/37852094
tagged with: bittorrent
type: UnansweredQuestion

http://stackoverflow.com/q/24513667
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/24513697
type: Question
tagged with: android-layout
has title: Android, force onLayoutChange function to execute once after it was assigned?
answer count: 1
has answer: http://stackoverflow.com/a/24513697
tagged with: android
has body: Just added a onLayoutChangeListener to my Textview, and it seems to be working perfectly, but some other views that rely on it afterwards (before any layoutchange actually happens) don't, because the inner function wasn't executed yet by that time, can I fake a layout change to force the inner function to execute?
type: AnsweredQuestion

http://stackoverflow.com/comment/38062497
score: 0
type: Comment
has text: @Ordous +1 for touching an issue, disagree with setXxxSize out of BasicsTabbedPaneUI, probably platform and L&F sensitive, can has issue with Nimbus and WindowsClassicsL&F
comment on: http://stackoverflow.com/a/24559509
type: AnswerComment

http://stackoverflow.com/comment/37850836
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24458350
has text: @TMcKeown Doesn't the 403 response code indicate the request is getting to the server?
score: 0

http://stackoverflow.com/q/24571990
has body: i have the following requirement. Have to make a SOAP web service( contract first) over HTTP with POST command. However, while the endpoint operates with POST it needs to answer on empty GET command with 200. This requirment is fixed and cannot be changed( the logic is that GET will point if the server is online) Any ideas? Thanks
has comment: http://stackoverflow.com/comment/38068081
has comment: http://stackoverflow.com/comment/38062430
type: UnansweredQuestion
tagged with: soap
has title: JAX-WS service with HTTP-GET with status 200
tagged with: web-services
score: 2
answer count: 0
downvote count: 0
tagged with: java
tagged with: jax-ws
type: Question
upvote count: 2
tagged with: http-get
has comment: http://stackoverflow.com/comment/38063474
favorite count: 0

http://stackoverflow.com/q/24519368
has comment: http://stackoverflow.com/comment/58227248
has body: I am working on ejb 3.1 with weblogic 12.1.2 remote interface code: @Remote public interface WordInterface{ public String cities(); } session bean class code: @Stateless(mappedName="wordbean") public class WordSessionBean implements WordInterface { @Override public String cities() { return "This is NewYork"; } Client code : WordInterface obj = (WordInterface) ctx.lookup("wordbean#com.WordSessionBean"); The above client Jndi Lookup is mapped to a specific bean name. This is working fine. But i have multiple sessionbeans and remote interfaces with different mappedNames. How should i configure my Jndi lookup which is common to all SessionBean classes in RealTime. The client and server classes will be in different jvms I tried using following statement WordInterface obj = (WordInterface) ctx.lookup("java:comp/env/ejb/wordbean"); But giving this error javax.naming.NameNotFoundException: While trying to lookup 'java:comp.env/ejb/wordbean' didn't find subcontext 'java:comp'. Resolved '' [Root exception is javax.naming.NameNotFoundException How to solve this ?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37999888
has title: Common JNDI Lookup for multiple stateless session beans with EJB 3.1 and Weblogic 12.1
tagged with: weblogic12c
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: ejb
has comment: http://stackoverflow.com/comment/37974601
score: 0

http://stackoverflow.com/q/24515578
score: 1
favorite count: 0
type: Question
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/37957192
tagged with: java
type: UnansweredQuestion
has body: I've created my own classloader and it works for jar files without dependencies/libraries. Howerver, when i want to load a jar file that has dependencies, it fails load, because it does not load the dependencies. How can i solve this problem? Thanks.
has comment: http://stackoverflow.com/comment/37957235
has title: Java ClassLoading load libraries
answer count: 0

http://stackoverflow.com/comment/124908611
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/63431273
has text: it's -1, its part of RecyclerView https://developer.android.com/reference/android/support/v7/widget/RecyclerView#NO_POSITION

http://stackoverflow.com/comment/38012527
type: Comment
has text: So nodelist will have all the values ?? and I can iterate the list and get individual values ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24544278
score: 0

http://stackoverflow.com/comment/37878201
type: Comment
type: QuestionComment
has text: in that case check my answer.
score: 0
comment on: http://stackoverflow.com/q/24451086

http://stackoverflow.com/comment/38010362
comment on: http://stackoverflow.com/q/24541465
score: 0
type: Comment
type: QuestionComment
has text: Your key is 32 characters, which is 16 bytes after the hex decoding in Java. I believe the key is too small for the SHA256 HMAC. You might just try `key.getBytes()` in Java.

http://stackoverflow.com/a/76306424
answers question: http://stackoverflow.com/q/24495448
upvote count: 2
has body: I also face the same and solve it by adding package-info.java for that package. Under package-info.java added annotation @NonNullApi. my package-info.java looks like - @NonNullApi package org.example.auth.repositories; import org.springframework.lang.NonNullApi;
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/24580651
answers question: http://stackoverflow.com/q/24580541
has body: All the methods in an interface are implicitly public. The names and return types of the methods(the ones B inherits from A and C) are same in your case but the visibility modifiers are different. And if you change the visibility modifier of an inherited method the compiler will complain because you cannot reduce the visibility of an inherited member.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/24493233
has title: Java: method takes a string and constructs a program that puts out the same string using a for-loop
has comment: http://stackoverflow.com/comment/37916202
has answer: http://stackoverflow.com/a/24493954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37916464
has comment: http://stackoverflow.com/comment/37916371
upvote count: 1
has answer: http://stackoverflow.com/a/24493790
score: 1
has comment: http://stackoverflow.com/comment/37916829
has body: This is an experiment. My friend is trying to get a grasp on java and writes text outputs like the following example. I wanted to test myself if I could provide a program that could generate them. For a String, the program should count each character and save how often and at what index it occurred and then generate a for-clause with an if-clause for each character like the following: I want to put in e.g. "1234123412341234" and get something like public class ClauseText { public static void main(String[] args) { for(int i = 0; i &lt; 16; i++) { if (i == 0 || i == 4 || i == 8 || i == 12) { System.out.print("a"); } if (i == 1 || i == 5 || i == 9 || i == 13) { System.out.print("b"); } if (i == 2 || i == 6 || i == 10 || i == 14) { System.out.print("c"); } if (i == 3 || i == 7 || i == 11 || i == 15) { System.out.print("d"); } } } } What I've come up with is so far is the following. I convert the input String to a char array and iterate through the array. I maintain three array lists, one for the character, one for how often it occurred, and one saves an ArrayList of Integers containing the index position where the character occurred. To make it simpler, I decided to make all ArrayLists the size 128 and put each character to the index equalling its respective ASCII value. But it doesn't seem to work, it's a simple Indexoutofboundsexception, however, I don't know what is wrong. Here: The output only goes this far and then it crashes: public class ClauseText { public static void main(String[] args) { for(int i = 0; i &lt; 6; i++) { if (i == 0 || i == 3) { System.out.print("a"); } if (i == 1 || i == 4) { System.out.print("b"); } if (i == 2 || i == 5 The program is: import java.util.ArrayList; public class StringToProgram { public static void main(String[] args) { // define and create program String className = "ClauseText"; String program = makeProgram("abcabc", className); } public static String makeProgram(String myWord, String className) { String program = "public class …
tagged with: java
has comment: http://stackoverflow.com/comment/37915987
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37916407
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/37916069
has comment: http://stackoverflow.com/comment/37916443
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37916583
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37916798

truetype
tags question: http://stackoverflow.com/q/24459832
tags question: http://stackoverflow.com/q/24562031
tag name: truetype
type: Tag

http://stackoverflow.com/q/24573674
type: UnansweredQuestion
tagged with: spring
has title: Update on hibernate and spring MVC not working
tagged with: java
tagged with: hibernate
has body: I am not able to update the table after editing it as it working fine when i debug and render all values in the DAO file but after dao implementation it is not showing the updated value for the same on user list. I am hereby attaching my code: JSP File: <form:form id="editForm" modelAttribute="user" action="update"> First Name: Last Name: Gender: City Name: Cancel </form:form> Dao method: @Override public void updateUser (User user) { /*Transaction tx = session.beginTransaction();*/ sessionfactory.getCurrentSession().merge(user); } Service class @Service @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public class UserServiceImpl implements UserService { @Autowired UserDao userDao; @Override public void addUser(User user) { userDao.saveUser(user); } @Override public List<User> getUser() { return userDao.getUser(); } @Override public User getUser(int id) { return userDao.getUser(id); } @Override public void updateUser(User user) { userDao.updateUser(user); } } Controller class @RequestMapping(value = "/edit", method = RequestMethod.GET) public ModelAndView editUserData(@ModelAttribute("user") User user, BindingResult result) { Map<String, Object> model = new HashMap<String, Object>(); model.put("user", userService.getUser(user.getId())); return new ModelAndView("Edit","model",model); } @RequestMapping(value = "/update", method = RequestMethod.POST) public ModelAndView updateUserData(@ModelAttribute("user") User user, BindingResult result,SessionStatus status) { userService.updateUser(user); status.setComplete(); return new ModelAndView("redirect:/userList.html"); }
type: Question
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/24578820
score: 0
has answer: http://stackoverflow.com/a/24574243

http://stackoverflow.com/comment/37981243
score: 0
type: AnswerComment
has text: It perhaps never assigns anything, as comparing String using `==` is a no no.
type: Comment
comment on: http://stackoverflow.com/a/24528995

http://stackoverflow.com/q/24456886
upvote count: 5
score: 4
has body: When something fails on the server side because the database and the application are out of sync instead of getting an error and the application crashing spring/tomcat seems to swallow the exception and pretend nothing has happened. Call me crazy but if the program fails catastrophically I want it to actually fail catastrophically! Is there anyway to switch this behaviour off? It's really slowing development down when the server pretends that everything is fine when it's just thrown up into the logs. If this isn't the spring/tomcat default then what else might be causing it? We are using a boatload of libraries and frameworks unfortunately. Spring would be the usual suspect but it could be something else. Update It's a sql server database which we are connecting to using SqlServerDataSource. Hibernate is in use in some parts of the project but is used to query the database at login time. On the client side we are using extjs and we are also using ExtDirectSpring to annotate methods for the client side to talk to. To translate the data going across the wire there's Jackson, which then gets wrapped by the extdirect json handler. There's some AOP stuff going on thats to do with logging exceptions but deleting that code results in the same behaviour. Further update Ok its not a good idea to let your sever crash! See my answer below for my proposed middle ground.
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37914400
tagged with: exception
has comment: http://stackoverflow.com/comment/37914498
favorite count: 0
has comment: http://stackoverflow.com/comment/37848095
type: UnansweredQuestion
has title: How do you stop spring swallowing exceptions?
has comment: http://stackoverflow.com/comment/37852912
tagged with: spring
has comment: http://stackoverflow.com/comment/37902809
has answer: http://stackoverflow.com/a/24515412
has comment: http://stackoverflow.com/comment/37847661
has comment: http://stackoverflow.com/comment/37903183
has comment: http://stackoverflow.com/comment/37903116
tagged with: java
has comment: http://stackoverflow.com/comment/37925078
linked to: http://stackoverflow.com/q/2416316
has comment: http://stackoverflow.com/comment/37847889
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24488308
answer count: 2
has comment: http://stackoverflow.com/comment/37917998
has comment: http://stackoverflow.com/comment/38020931

http://stackoverflow.com/comment/74260170
has text: Why install a plugin when this can easily be done as shown by @Serhii below.
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/24573768
type: Comment

http://stackoverflow.com/q/24488211
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/38811094
answer count: 0
type: UnansweredQuestion
has body: I'm new to Android and Java. I'm creating an app to login to my ISP. This is the page: http://reliancebroadband.co.in/reliance/login.do Earlier, I was using a python script, which worked flawlessly. Its like this: #!/usr/bin/env python # encoding: utf-8 import urllib2, urllib, cookielib username = 'my-username' password = 'my-password' jar = cookielib.FileCookieJar("cookies") opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(jar)) response = opener.open("http://reliancebroadband.co.in/reliance/startportal_isg.do") login_data = urllib.urlencode({'userId' : username, 'password' : password, 'action' : 'doLoginSubmit'}) resp = opener.open('http://reliancebroadband.co.in/reliance/login.do', login_data) And now i'm trying to create an android app(source: http://www.compiletimeerror.com/2013/01/login-application-for-android.html#.U7AFBPmSz9Y) (Tried contacting the developer there, but he's not responding.) The app is compiling correctly, but while tring to login, its just returning the source code of the login page in the error dialogue, instead of logging in. Here's the code: MainActivity.java: package com.app.reliancebblogin; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @SuppressLint("NewApi") public class MainActivity extends Activity { EditText un, pw; TextView error; Button ok; private String resp; private String errorMsg; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activi…
tagged with: java
tagged with: eclipse
type: Question
tagged with: login-script
has title: Webpage login error-Android App
has comment: http://stackoverflow.com/comment/37906551

http://stackoverflow.com/q/24528719
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37992535
tagged with: classnotfoundexception
answer count: 1
tagged with: android
has title: ClassNotFoundException with XposedBridge
accepted answer: http://stackoverflow.com/a/24529981
type: AnsweredQuestion
has body: I'm writing an Xposed module (which runs), and I just added an activity to it, so I could tweak some settings in the application. I created an Activity the regular Android way, and added it to my manifest (the package name is correct). I also added the class name to my xposed_init file. I still get this in my logcat: 07-02 15:50:33.275: E/AndroidRuntime(2505): Caused by: java.lang.ClassNotFoundException: Didn't find class "tweaks.vinit.xdictionary.DictSettings" on path: DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] What could the problem be? Edit: here's a more detailed log. 07-02 18:33:25.485: W/Xposed(16780): Package name for /data/app/com.zst.xposed.xuimod-1.apk had to be retrieved via parser 07-02 18:33:25.489: W/ActivityThread(16780): Application tweaks.vinit.xdictionary can be debugged on port 8100... 07-02 18:33:25.491: D/AndroidRuntime(16780): Shutting down VM 07-02 18:33:25.491: W/dalvikvm(16780): threadid=1: thread exiting with uncaught exception (group=0x41632d40) 07-02 18:33:25.493: E/AndroidRuntime(16780): FATAL EXCEPTION: main 07-02 18:33:25.493: E/AndroidRuntime(16780): Process: tweaks.vinit.xdictionary, PID: 16780 07-02 18:33:25.493: E/AndroidRuntime(16780): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{tweaks.vinit.xdictionary/tweaks.vinit.xdictionary.TempClass}: java.lang.ClassNotFoundException: Didn't find class "tweaks.vinit.xdictionary.TempClass" on path: DexPathList[[zip file "/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2135) 07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 07-02 18:33:25.493: E/AndroidRuntime(16780): at android.app.ActivityThread.access$800(Act…
type: Question
has answer: http://stackoverflow.com/a/24529981

http://stackoverflow.com/q/24548092
answer count: 0
tagged with: java
has body: I am trying to read numeric values from excel sheet for now i have read excel sheet read it using apache poi api. My problem is that I have long number in excel sheet like 123435578774 while it display like 1.23436E+11 I set value in excel sheet as original but when I read it in java code it displays like 1.23436E+11 Here is my code sample: HSSFRow row = (HSSFRow) rows.next(); HSSFCell cell = row.getCell((short) 0); if (cell != null){ Object result = cell.getNumericCellValue(); readNumber = result.toString(); System.out.println(readNumber); }
type: Question
has comment: http://stackoverflow.com/comment/38017426
has comment: http://stackoverflow.com/comment/38021518
linked to: http://stackoverflow.com/q/5578535
has comment: http://stackoverflow.com/comment/38022972
has title: Reading numeric value from excel format error
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38017523
has comment: http://stackoverflow.com/comment/38128716
tagged with: excel
has comment: http://stackoverflow.com/comment/38020448
tagged with: numbers

http://stackoverflow.com/comment/37842021
type: Comment
type: QuestionComment
has text: What happens if you put `@Import(PersistenceJPAConfig.class)` to your `CoreConfig` class?
comment on: http://stackoverflow.com/q/24453858
score: 0

http://stackoverflow.com/comment/38050206
comment on: http://stackoverflow.com/q/24565539
score: 0
type: QuestionComment
type: Comment
has text: You've modified the code from the original answer, which technically, work, making the provided answer invalid. If you're going to change the code, add the updates as a separate block so people can see the progression

http://stackoverflow.com/a/24605521
has body: Here's a workarround that works to me: Deproxy the entities. Even having a parent proxy of the entity (jpa.inheritance.issue.Element_$$_javassist_1) if you deproxy it, you'll obtain the real entities (children). Let's say you want to loop your (children) elements collection from the entity A and do something with them. Something like: public void loopDeproxyElements(List&lt;Element&gt; yourElementsCollection){ for(Element p : yourElementsCollection){ if(p instanceof HibernateProxy){ Element child = (Element) ((HibernateProxy) p).getHibernateLazyInitializer() .getImplementation(); if (child instanceof ElementTypeOne){ //You can cast your object or do whatever you want, knowing for sure that's a child element) ElementTypeOne myRealElement = (ElementTypeOne) child; ... } else { //It should be ElementTypeTwo (if u never create parent entities) ... } } } ) It will always get the children elements as I was expecting.
has comment: http://stackoverflow.com/comment/38288432
accepted answer of: http://stackoverflow.com/q/24488455
type: Answer
has comment: http://stackoverflow.com/comment/38254861
has comment: http://stackoverflow.com/comment/38275000
has comment: http://stackoverflow.com/comment/38295051
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24488455
has comment: http://stackoverflow.com/comment/38289686
has comment: http://stackoverflow.com/comment/38273724
type: AcceptedAnswer
downvote count: 0

topic-modeling
tags question: http://stackoverflow.com/q/24563419
tag name: topic-modeling
type: Tag

http://stackoverflow.com/comment/37987088
has text: I have the latest version
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24524920
score: 0

http://stackoverflow.com/q/24494550
score: 0
answer count: 2
tagged with: mockito
tagged with: spy
has answer: http://stackoverflow.com/a/24494715
has comment: http://stackoverflow.com/comment/37920534
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24494715
type: Question
has answer: http://stackoverflow.com/a/24494706
tagged with: java
has body: I have a method I am trying to test, say methodToTest(). Inside this method is a call to what I believe is a Logger variable, like: logger.debug("this is a logger debug example"); The problem is that the logger variable is declared outside the class (it appears to be inherited), to which I do not have the source for. When I create an instance of the test class, and then call the methodToTest() method, I get a NullPointerException at the logger.debug statement. How can I mock the logger entirely? It has no use during testing istself. when(logger.debug("")).doNothing(); Gives me an error, even when I create a Logger variable within the test class. I'm thinking I should maybe use spying, but I'm not sure how, and then not sure what to do with my current when().thenReturn(); statements. Per @kamil's suggestion, the f.set( LM2DImportMultiTaskWorker.class, null ); code threw the following error: java.lang.IllegalArgumentException: Can not set org.apache.log4j.Logger field com.navteq.cf.foundation.process.OperationSkeleton.logger to java.lang.Class at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source) at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source) at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source) at java.lang.reflect.Field.set(Unknown Source) at com.navteq.rdf.base.task.LM2DImportMultiTaskWorkerTest.testGetCountFromDB(LM2DImportMultiTaskWorkerTest.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExpl…
has title: Mocking a logger.debug() call inside a test method
possible better answer: http://stackoverflow.com/a/24494706

http://stackoverflow.com/a/24444233
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/24444156
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24444156
has body: The Thread class is a proxy for the OS Thread. Before you call start() there is no actual OS thread and after the thread stops it is cleaned up even if you hold on to the Thread object. At this point it just like any other object and it will be cleaned up in the normal way.
upvote count: 1

xml-parsing
tags question: http://stackoverflow.com/q/24524901
tags question: http://stackoverflow.com/q/24451963
tag name: xml-parsing
tags question: http://stackoverflow.com/q/24506321
tags question: http://stackoverflow.com/q/24483936
type: Tag
tags question: http://stackoverflow.com/q/24437184
tags question: http://stackoverflow.com/q/24488052
tags question: http://stackoverflow.com/q/24554789

http://stackoverflow.com/comment/38079526
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24581484
has text: This makes no sense. Where are they supposed to put `T extends Node`? What is `T` going to do?
type: AnswerComment

http://stackoverflow.com/a/24452901
has comment: http://stackoverflow.com/comment/37845252
accepted answer of: http://stackoverflow.com/q/24452843
has body: assertEquals with throw an AssertionError when the condition is not met. So you should probably either catch that error explicitly, or widen your catch to include Throwable rather than Exception. See the type hierarchy diagram below to understand why catch (Exception e) won't catch an AssertionError. java.lang.Object |--- java.lang.Throwable |--- java.lang.Error | --- java.lang.AssertionError // not a descendent of Exception |--- java.lang.Exception However... tests are generally supposed to be automated so I can't imagine why you'd want to introduce a human element by showing a dialog.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24452843
upvote count: 3
has comment: http://stackoverflow.com/comment/37840480
score: 3

http://stackoverflow.com/a/24581920
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24581910
has comment: http://stackoverflow.com/comment/38080333
answers question: http://stackoverflow.com/q/24581910
type: Answer
has comment: http://stackoverflow.com/comment/38080352
has comment: http://stackoverflow.com/comment/38080323
has comment: http://stackoverflow.com/comment/38084633
has comment: http://stackoverflow.com/comment/38081298
has body: Use this String name = et1.getText().toString(); This will give the text entered by the user.
score: 0

http://stackoverflow.com/q/24477316
has title: Java Thread Pool ExecutorService: Threads execution order
tagged with: executorservice
has comment: http://stackoverflow.com/comment/37885932
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24477426
upvote count: 3
possible better answer: http://stackoverflow.com/a/24477873
has comment: http://stackoverflow.com/comment/37886027
tagged with: java
downvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/24477873
type: Question
tagged with: threadpool
linked to: http://stackoverflow.com/q/42153013
accepted answer: http://stackoverflow.com/a/24477426
answer count: 2
has body: As we create a Thread pool using Java's Executor service and submit threads to this thread pool, what is the order in which those threads get executed? I want to ensure that threads submitted first, execute first. For example, in the code below, I want first 5 threads to get executed first, followed by the next 5 threads and so on... // Create a thread pool of 5 threads. ScheduledExecutorService exService = Executors.newScheduledThreadPool(5, new ModifiedThreadFactory("ReadThreadPool")); // Create 100 threads. MyThread[] threads = createMyThreads(100); // Submit these 100 threads to thread pool for execution. for(MyThread thread : threads) { exService.submit(thread); } Does Java's Thread Pool provide any API for this purpose, or do we need to implement a FIFO queue at our end to achieve this. If Java's thread pool does not provide any such functionality, I am really interested to understand the reason behind the non-existence of this functionality as it appears like a very common use-case to me. Is it technically not possible (which I think is quite unlikely), or is it just a miss?
score: 1
favorite count: 0

http://stackoverflow.com/a/24563666
downvote count: 0
type: AcceptedAnswer
score: 8
upvote count: 8
type: Answer
has body: I figured out through another post. The apiKey is set like this - ` youtube = new YouTube.Builder(new NetHttpTransport(), JSON_FACTORY, new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { } }).**setYouTubeRequestInitializer(new YouTubeRequestInitializer(apiKey)**.setApplicationName("youtube-cmdline-search-sample").build(); `
accepted answer of: http://stackoverflow.com/q/24563579
answers question: http://stackoverflow.com/q/24563579

http://stackoverflow.com/a/25254004
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24585151
has body: Those classes are in different jars - if you have the jackson-databind.jar without the jackson-core.jar, you'll get this error. If you're using maven, add this to your pom: com.fasterxml.jackson.core jackson-core 2.4.1.1 If not, you can get the jars here: http://wiki.fasterxml.com/JacksonDownload

http://stackoverflow.com/q/24473105
has comment: http://stackoverflow.com/comment/37877919
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37877898
tagged with: java
tagged with: resize
has comment: http://stackoverflow.com/comment/37877946
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37877916
has body: below is a working Java-Code which I do not understand. I have outprinted the times where the programm invokes the getPreferredsize()- and paintComponent()-methods. I have found out that every time I resize the DialogWindow it calls once the getPreferredsize-method() and twice the paintcomponent-method(). Why? package examples; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; public class Bsp { public static void main(String[] args) { JFrame frame = new MyFrame(); } } class MyFrame extends JFrame { JPanel panel=new JPanel(new GridBagLayout()); private class MyLine extends JLabel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; g2d.setColor(Color.BLACK); g2d.setStroke(new BasicStroke(5)); System.out.println("PaintComponent: "+getWidth()+" "+getHeight()); g2d.drawLine(0, panel.getHeight()/2, panel.getWidth(), panel.getHeight()/2); g2d.dispose(); } @Override public Dimension getPreferredSize() { System.out.println("PreferredSize: "+panel.getWidth()+" "+panel.getHeight()); return new Dimension(panel.getWidth(),panel.getHeight()); } } public MyFrame() { JLabel label=new MyLine(); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridLayout(3, 1)); panel.add(label); add(new JButton("A")); add(new JButton("B")); add(panel); pack(); centeringWindow(); setVisible(true); }…
tagged with: paintcomponent
has title: How is PaintComponent() and getpreferredsize() working when I resize the DialogWindow?

http://stackoverflow.com/a/24562085
has body: Coincidence. The same thing could happen with 25, just like any other number. For example, during execution of while(x&gt;0){ someMethod(); } which is not synchronized over, after a bunch of looping, let's take x to be 1. The first thread starts iterating (enters the body), then threads switch, the second thread sees x is 1, so enters the loop body as well. Both will increment their count and their sum will be equal to one more than the original x value. This is a race condition and you just happen to see the consequences more easily with larger numbers.
upvote count: 2
has comment: http://stackoverflow.com/comment/38043631
has comment: http://stackoverflow.com/comment/38043685
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24561974

http://stackoverflow.com/comment/37878730
comment on: http://stackoverflow.com/a/24473446
score: 0
type: Comment
has text: I have 2 ideas: You could append an image of an up Arrow and a Down arrow next to the right side of the column? (that way you can be sure that the arrows appear) You could create a new JPanel within the table cell, and place the ComboBox within the new panel (making sure it has plenty of height above and below it). Do any of these options work?
type: AnswerComment

http://stackoverflow.com/comment/37893136
type: Comment
score: 0
has text: Can I not do this programmatically in Java?
type: AnswerComment
comment on: http://stackoverflow.com/a/24480407

http://stackoverflow.com/comment/37984178
comment on: http://stackoverflow.com/q/24530564
has text: Why have you shown us that code? It doesn't seem relevant (other than this is how you obtain your data). What have you tried in order to solve this specific problem?
type: Comment
type: QuestionComment
score: 1

currency
tag name: currency
tags question: http://stackoverflow.com/q/24557385
type: Tag
tags question: http://stackoverflow.com/q/24557708

http://stackoverflow.com/comment/37813595
score: 0
comment on: http://stackoverflow.com/q/24438030
type: QuestionComment
type: Comment
has text: Sorry, where should I add an activity layout?

http://stackoverflow.com/comment/37919143
type: QuestionComment
has text: not exactly. By default, depth textures are treated like GL_RED textures. But depth textures can also be configured to use the `TEXTURE_COMPARE` modes (and only depth textures can be used that way).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24470748

http://stackoverflow.com/comment/130442337
type: AnswerComment
type: Comment
has text: @oberlies As you suggested, I tried cleaning the project under Project –> Clean... –> Clean. Unfortunately, when I try to run the project, I still get the error message, "Error occurred during initialization of boot layer. java.lang.module.FindException: Module reasoner not found." (reasoner is the name of the only module in my project.) How do I resolve this error message?
comment on: http://stackoverflow.com/a/24611016
score: 0

http://stackoverflow.com/comment/37808421
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24435413
type: AnswerComment
has text: I have added your lined of code. Entering 0 and pressing enter, I am not getting any invalid input message. I get the BUILD SUCCESSFUL, but there is no output and contents of 'clients.txt' are cleared off. Kindly give me some further suggestion.

http://stackoverflow.com/comment/38020610
type: Comment
type: QuestionComment
has text: ok but what class do I have to use ? I cannot find stg clear and functional
comment on: http://stackoverflow.com/q/24549157
score: 0

http://stackoverflow.com/q/24446273
upvote count: 3
tagged with: java
type: Question
downvote count: 0
tagged with: android
favorite count: 0
tagged with: cordova
answer count: 0
type: UnansweredQuestion
has body: For now, users of our apps have to download vpn connector apps and login vpn server before utilizing resources inside our private network, so we want to lessen the steps before users begin to interact with our service. And I wonder if there's any solution to integrate vpn server connector into phonegap apps in android, especially when we want to support android platform without vpn service api? Are there any libs or framework available for usage like this? Do I have to dig into source of phonegap to implements vpn connector? Thank you~
has title: How integrate vpn connector into phonegap apps in android?
score: 3
tagged with: vpn

http://stackoverflow.com/comment/37914641
type: Comment
comment on: http://stackoverflow.com/a/24440582
score: 0
type: AnswerComment
has text: I never stated that void is a primitive type

http://stackoverflow.com/comment/38005904
score: 0
type: Comment
type: QuestionComment
has text: "Coverage information was not collected. Perhaps you forget to include debug information into compiled classes?" try to compile with debug info
comment on: http://stackoverflow.com/q/24470814

http://stackoverflow.com/comment/37984869
comment on: http://stackoverflow.com/q/24530463
type: QuestionComment
has text: @SamwiseGamgee I manually created the db
type: Comment
score: 0

http://stackoverflow.com/q/24485708
tagged with: java
tagged with: fork-join
has comment: http://stackoverflow.com/comment/37902095
type: Question
has comment: http://stackoverflow.com/comment/37902156
has comment: http://stackoverflow.com/comment/37901967
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/37901996
score: 0
has title: Summing each element of two arrays in parallel
has answer: http://stackoverflow.com/a/24486422
has comment: http://stackoverflow.com/comment/37902057
has body: I have two 2-D arrays that I want to sum element-by-element. Both arrays are the same size same number of rows and columns). It should return a final array that is the same size with the element-by-element sums. How can I use Java's Fork-Join Framework, or parallelism in general, to do such a task? Does it make sense to use parallelism for this problem? Here is my unfinished attempt below with Java's Fork-Join framework: public class SumArray extends RecursiveTask&lt;int[][]&gt; { private static final int ROW_CUTOFF = 10; private static final int COL_CUTOFF = 10; int[][] left_; int[][] right_; int rowLo_; int rowHi_; int colLo_; int colHi_; SumArray(int[][] left, int[][] right, int rowLo, int rowHi, int colLo, int colHi) { left_ = left; right_ = right; rowLo_ = rowLo; rowHi_ = rowHi; colLo_ = colLo; colHi_ = colHi; } @Override protected int[][] compute() { if (rowHi_ - rowLo_ &lt;= ROW_CUTOFF &amp;&amp; colHi_ - colLo_ &lt;= COL_CUTOFF) { for (int i = rowLo_; i &lt; rowHi_; i++) { for (int j = colLo_; j &lt; colHi_; j++) { left_[i][j] += right_[i][j]; } } return left_; } int rowMid = rowLo_ + ((rowHi_ - rowLo_) / 2); int colMid = colLo_ + ((colHi_ - colLo_) / 2); SumArray topLeft = new SumArray(left_, right_, rowLo_, rowMid, colLo_, colMid); SumArray topRight = new SumArray(left_, right_, rowMid, rowHi_, colLo_, colMid); topLeft.fork() int[][] topRightSummed = topRight.compute(); int[][] topLeftSummed = topLeft.join(); // ??? I can similarly find the bottom left, and bottom right arrays, but how do I join these arrays while maintaining the performance of parallelism? Should I be using shared memory?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24496106
tagged with: parallel-processing

http://stackoverflow.com/a/24487818
upvote count: 1
has body: 3) The method is synchronized, but only to that object instance, both threads will run it without blocking each other since they are 2 separate instances. 2) If a thread uses wait (you have to have a lock first), it goes into waiting mode and only start again when another thread with the same lock uses notify/nofityAll. If a thread with a different lock calls notify, nothing will happen to that specific thread. Side node: notify tells a single thread to continue but its chosen at random so many people prefer to use notifyAll. 1) if you want to be able to sync on a sharable variable you are looking to use this: var Object obj; //assign instance on constructor or something like that void method(){ synchronized(obj){ //sync code for obj instance } }
has comment: http://stackoverflow.com/comment/37905957
answers question: http://stackoverflow.com/q/24487633
has comment: http://stackoverflow.com/comment/37905990
downvote count: 0
has comment: http://stackoverflow.com/comment/37905922
type: Answer
score: 1

http://stackoverflow.com/comment/38065037
score: 0
type: QuestionComment
has text: look this: [link][1] [1]: http://stackoverflow.com/questions/9216283/tomcat-java-sql-server-2008-r2-cannot-create-jdbc-driver-of-class-for-con it may be usefull
type: Comment
comment on: http://stackoverflow.com/q/24570037

http://stackoverflow.com/comment/37814075
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24438521
has text: I have a panel also. With button1 at PAGE_START I get button1 at the top, button2 at the button and the chart between them. Is it possible to get both buttons at the bottom?

http://stackoverflow.com/comment/37853872
type: AnswerComment
has text: The only way to see the list is when the cell is in edit mode. What is the point of seeing the list if you can't change the value?
score: 0
comment on: http://stackoverflow.com/a/24460005
type: Comment

http://stackoverflow.com/q/24553232
accepted answer: http://stackoverflow.com/a/24553434
has body: I have a question about the behavior of the following type of code public synchronized &lt; T > List&lt; T > executeSelect(Class&lt; T > c) { } If I execute the code queryEngine.executeSelect(A.class); in one thread and queryEngine.executeSelect(B.class); in another thread do those threads treat the method as one (and one waits for another) or two different and they are executed concurrently? I want to have a DB query engine that is behind a web service and returns object of a given type from a database. I also want to use just one connection to the database and open / close it for query execution.
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/38026533
favorite count: 0
linked to: http://stackoverflow.com/q/502614
answer count: 3
possible better answer: http://stackoverflow.com/a/24553382
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24553382
has answer: http://stackoverflow.com/a/24553493
has title: How does synchronized generic method behave?
has answer: http://stackoverflow.com/a/24553434
upvote count: 2
linked to: http://stackoverflow.com/q/339699
type: Question

http://stackoverflow.com/a/24501911
has body: The '&amp;' here is the bitwise operator. And variable == something ? x : y this is the ternary operator which in the example you can read like this 'If bitwise AND of maze[i][j] with 8 is equal to 0, then print "| " else print " " '
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24501872
answers question: http://stackoverflow.com/q/24501872
type: Answer

http://stackoverflow.com/comment/38046048
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24563463
type: Comment
has text: It's worth noticing that whenever you try to insert an element inside an inner list, you must make sure to add a new `ArrayList<Integer>` to the outer one before.

http://stackoverflow.com/q/24476251
score: 0
has answer: http://stackoverflow.com/a/24476269
answer count: 1
has title: Size of String array passed as argument to main method in Eclipse
has body: Is there any default size of String Array passed as argument to main method of java Class in eclipse or is it determined at runtime by counting the number of argument passed in. public static void main(String[] args) { }
tagged with: arguments
accepted answer: http://stackoverflow.com/a/24476269
type: AnsweredQuestion
type: Question
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/37980852
comment on: http://stackoverflow.com/a/24527627
type: AnswerComment
score: 0
type: Comment
has text: Edit your Question and put it in

http://stackoverflow.com/comment/38008790
type: Comment
has text: [Here's an example that works.](https://ideone.com/AWfLiE) Remember that lists are ordered.
comment on: http://stackoverflow.com/q/24543376
score: 0
type: QuestionComment

http://stackoverflow.com/q/24550670
tagged with: http://stackoverflow.com/tag/rdf
has answer: http://stackoverflow.com/a/24553704
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38027402
has title: Mapping database with D2RQ
tagged with: java
type: Question
has body: I am trying to do the mapping between with my database. I am using Jena and the D2RQ Engine. I do not know how I can configure the file .ttl with information about the connection with the database. Here my code: public class CreateOntModel5 { public static void main(String[] args) throws OWLOntologyStorageException, OWLOntologyCreationException, IOException, SQLException { // Set up the ModelD2RQ using a mapping file Model m = new ModelD2RQ("C:/Users/Tiziano/workspace/rules/prova0-mappings.ttl"); // Find anything with an rdf:type of iswc:InProceedings StmtIterator paperIt = m.listStatements(null, RDF.type, ISWC.InProceedings); // List found papers and print their titles while (paperIt.hasNext()) { Resource paper = paperIt.nextStatement().getSubject(); System.out.println("Paper: " + paper.getProperty(DC.title).getString()); // List authors of the paper and print their names StmtIterator authorIt = paper.listProperties(DC.creator); while (authorIt.hasNext()) { Resource author = authorIt.nextStatement().getResource(); System.out.println("Author: " + author.getProperty(FOAF.name).getString()); } System.out.println(); } m.close(); } } And here you can find the mapping file code: @prefix sdb: &lt;http://jena.hpl.hp.com/2007/sdb#&gt; . @prefix rr: &lt;http://www.w3.org/ns/r2rml#&gt; . @prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; . @prefix : &lt;http://www.semanticweb.org/aalisabeth/ontologies/2014/0/untitled-ontology-352#&gt; . @base &lt;http://example.com/base/&gt; . :myModel a d2rq:D2RQModel; d2rq:mappingFile &lt;prova0-mappings.ttl&gt;; d2rq:resourceBaseURI &lt;http://localhost:3306/prova_rules&gt;; . &lt;MAPPING-ID1&gt; a rr:TriplesMap; rr:logicalTable [ rr:tableName "esame"] ; rr:subjectMap [ rr:template "http://www.semanticweb.org/aalisabeth/ontologies/2014/0/untitled-ontology-352/scrittura/campowrite1={\"campowrite1\"}"; rr:class &lt;http://www.semanticweb.org/aalisabeth/ontologies/2014/0/untitled-ontology-352/scrittura&gt; ]; rr:predicateObjectMap [ rr:pr…
answer count: 2
tagged with: jena
has comment: http://stackoverflow.com/comment/51154992
has answer: http://stackoverflow.com/a/35450813
score: 0
tagged with: d2rq

http://stackoverflow.com/comment/44842323
type: QuestionComment
comment on: http://stackoverflow.com/q/24499688
score: 0
has text: Did you find the cause for this?
type: Comment

http://stackoverflow.com/comment/37806477
type: AnswerComment
comment on: http://stackoverflow.com/a/24434150
type: Comment
has text: I created file with name **sdf.log.txt** it doesn't matched
score: 0

http://stackoverflow.com/q/24531373
tagged with: mobile
answer count: 1
has body: I am developing an application for Point of Sales. In that I want to take print from android mobile to any printer type(only receipt printer / kitchen printer) without using any SDK for particular printer. Is this possible, or is it possible only by calling cloud Services?
score: 0
tagged with: printing
tagged with: android
tagged with: android-print-framework
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24531569
has title: how to print from android to receipt printer without any external SDK?
tagged with: java
type: Question

http://stackoverflow.com/q/24430845
has comment: http://stackoverflow.com/comment/37817774
tagged with: cxf
score: 1
tagged with: java
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/37837767
has comment: http://stackoverflow.com/comment/42536048
type: Question
downvote count: 0
favorite count: 0
has body: I am new to apache camel. I am right now trying the camel-example-cxf-proxy example provided in the apache camel bundle. I am able to compile and run it. Now i want to secure this proxy service but i am not able to figure out how to proceed. Or in Simple terms i want to implement AUTHENTICATION in this proxy service project. Looking forward to your solutions. Thanks in advance.
has title: How to secure apache camel proxy service?
has comment: http://stackoverflow.com/comment/37825295
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services

http://stackoverflow.com/a/24534316
accepted answer of: http://stackoverflow.com/q/24534226
answers question: http://stackoverflow.com/q/24534226
has body: You termainate the process when closing the frame, not the panel. This this: frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); Also see JFrame Exit on close Java
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

opencv
type: Tag
tags question: http://stackoverflow.com/q/24499638
tags question: http://stackoverflow.com/q/24507629
tags question: http://stackoverflow.com/q/24557965
tags question: http://stackoverflow.com/q/24458257
tags question: http://stackoverflow.com/q/24528412
tags question: http://stackoverflow.com/q/24570041
tags question: http://stackoverflow.com/q/24569386
tag name: opencv
tags question: http://stackoverflow.com/q/24539273
tags question: http://stackoverflow.com/q/24560626
tags question: http://stackoverflow.com/q/24583563
tags question: http://stackoverflow.com/q/24487650
tags question: http://stackoverflow.com/q/24579560

http://stackoverflow.com/comment/37918065
score: 0
type: AnswerComment
type: Comment
has text: Hi Rudi, thank you. I edited my code by your recommendation. The Frgment01 on Start works fine. But the App is crashing when I press the Button (show_Fragment02)..
comment on: http://stackoverflow.com/a/24493467

http://stackoverflow.com/a/24518363
answers question: http://stackoverflow.com/q/24518218
upvote count: 7
has body: You are assigning values from an uninitialized array d to x - that's where the zeroes (default value for an int in Java) are coming from. IIUC, you're mixing two reversing strategies. If you're creating a new array, you needn't run over half of the original array, but over all of it: public static int[] reverse(int[] x) { int[] d = new int[x.length]; for (int i = 0; i &lt; x.length; i++) { d[i] = x[x.length - 1 -i]; } return d; } Alternatively, if you want to reverse the array in place, you don't need a temp array, only a single variable (at most - there are also ways to switch two ints without an additional variable, but that's a different question): public static int[] reverseInPlace(int[] x) { int tmp; for (int i = 0; i &lt; x.length / 2; i++) { tmp = x[i]; x[i] = x[x.length - 1 - i]; x[x.length - 1 - i] = tmp; } return x; // for completeness, not really necessary. }
type: AcceptedAnswer
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/37964312
type: Answer
accepted answer of: http://stackoverflow.com/q/24518218

http://stackoverflow.com/comment/37830635
has text: @wrecklez Yes I want the latest YEAR
score: 0
comment on: http://stackoverflow.com/q/24447636
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24543108
has answer: http://stackoverflow.com/a/24543181
has comment: http://stackoverflow.com/comment/38008396
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/38008454
has comment: http://stackoverflow.com/comment/38008766
has comment: http://stackoverflow.com/comment/38009155
downvote count: 0
has comment: http://stackoverflow.com/comment/38008711
favorite count: 0
accepted answer: http://stackoverflow.com/a/24546539
upvote count: 2
tagged with: gmail
score: 2
type: AnsweredQuestion
has title: JavaMail cannot send email
tagged with: java
has comment: http://stackoverflow.com/comment/38008737
has body: i am trying to write an application in java that will send emails, i found a tutorial on youtube and tried to follow it. however it does not work for me still, here is the error i get Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25, response: 421 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1949) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) at javax.mail.Service.connect(Service.java:295) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at libraryFineList.ParseRecords.main(ParseRecords.java:90) i have no idea, what's wrong, anything i found on google did not help, here is the code public static void main(String[] args) throws IOException, MessagingException { Properties props = new Properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketFactory.port", 465); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); Session session = Session.getDefaultInstance(props, new javax.mail.Authenticator(){ protected PasswordAuthentication getPasswordAuthentication(){ return new PasswordAuthentication("user@gmail.com", "pass"); } } ); try{ Message message = new MimeMessage(session); message.setFrom(new InternetAddress("user@gmail.com")); message.addRecipient(Message.RecipientType.TO, new InternetAddress("ycharnetskaya@gmail.com", "Mr. User")); message.setSubject("Your Example.com account has been activated"); message.setText("Worked"); Transport.send(message); }catch(Exception e){ e.printStackTrace(); }
type: Question
has comment: http://stackoverflow.com/comment/38008720
answer count: 2
possible better answer: http://stackoverflow.com/a/24543181
has answer: http://stackoverflow.com/a/24546539
has comment: http://stackoverflow.com/comment/38008685

http://stackoverflow.com/comment/38025364
type: AnswerComment
type: Comment
has text: @TAsk I won't mess up. Will use individual lists :)
comment on: http://stackoverflow.com/a/24552570
score: 0

http://stackoverflow.com/comment/37938003
comment on: http://stackoverflow.com/a/24505334
has text: @Marco13 if your computer is cpu bound and nothing is moving, then is some cases you may never be able to get the precision you want. Better just to print the time now.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37993423
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24535403
type: Comment
has text: i have to support duplicate value.

http://stackoverflow.com/q/24538007
has title: Can I do this complex url mapping in web container using servlet?
score: 1
tagged with: java
tagged with: servlets
type: Question
upvote count: 2
answer count: 1
has body: There are two servlets: A,B A mapping to: /* B mapping to: /sub_dir/* if the url is in /sub_dir/* then it processed by B, else by A.
tagged with: tomcat
linked to: http://stackoverflow.com/q/23698639
has answer: http://stackoverflow.com/a/24538145
accepted answer: http://stackoverflow.com/a/24538145
favorite count: 0
has comment: http://stackoverflow.com/comment/38002384
has comment: http://stackoverflow.com/comment/37998456
has comment: http://stackoverflow.com/comment/37998307
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/38000714
comment on: http://stackoverflow.com/q/24538046
type: Comment
has text: @njzk2 You want the other order as multiply by 10 last will leave a 0 at the end.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37904739
type: QuestionComment
has text: @blgt eclipse does not ship with JRE, it has its own compiler for java so for compiling/executing programs its not necessary to have JDK (in most cases till you are not developing web apps or using automated builds), but it is necessary to have JRE to run eclipse
score: 0
comment on: http://stackoverflow.com/q/24487064
type: Comment

http://stackoverflow.com/a/24585399
type: Answer
accepted answer of: http://stackoverflow.com/q/24585300
answers question: http://stackoverflow.com/q/24585300
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38086425
has body: The main problem of your code is that you obviously think that the line int[] sortcntr = cntr; creates a copy of the array cntr. However, arrays have reference semantics in Java. Thus, you simply create a second reference to the same array. If you then sort sortcntr, it applies to cntr as well since it's the same array. To create a copy of the array: int[] sortcntr = new int[ cntr.length ]; System.arraycopy(cntr, 0, sortcntr, 0, cntr.length); BTW: Wouldn't it make more sense to work with floating-point numbers (double) instead of integer numbers?

http://stackoverflow.com/q/24576092
has answer: http://stackoverflow.com/a/24576222
tagged with: java
tagged with: eclipse
has title: Displaying an imageicon in eclipse doesn't work
answer count: 2
accepted answer: http://stackoverflow.com/a/24576222
score: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/38069297
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24576204
has body: So I've just written down some simple code that just displays an image in a JButton. What I have done is write the code: import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Main extends JFrame{ public static ImageIcon bf; public static JPanel p; public static JButton b; public static void main (String args[]){ Main main = new Main(); bf = new ImageIcon("car.png"); p = new JPanel(); b = new JButton(bf); p.add(b); main.add(p); main.setVisible(true); main.setDefaultCloseOperation(main.EXIT_ON_CLOSE); main.setSize(600,700); } } And I have copied a pic named car.png in the same folder with my class, but I can't seem to get it to work in elipse. But when I run the same exact code in BlueJ it runs it without any known issues. Any help woul be greately apprecciated Thanks In advance.
has answer: http://stackoverflow.com/a/24576204
type: Question

http://stackoverflow.com/comment/37793796
type: QuestionComment
has text: And the private method should not be tested?
score: 0
comment on: http://stackoverflow.com/q/24427685
type: Comment

http://stackoverflow.com/q/24509887
tagged with: runtime-error
has answer: http://stackoverflow.com/a/24509908
type: AnsweredQuestion
favorite count: 0
type: Question
has body: I am a beginner for Core Java and I'm now studying multithreading. I have one doubt that is related to this code: import java.io.*; public class MyThread extends Thread { public void run() { for(int i=0;i&lt;10;i++) { try { Thread.sleep(500); } catch(InterruptedException e) { System.out.println(e); } System.out.println(i); } } public static void main(String args[]) { MyThread mt=new MyThread(); MyThread mt1=new MyThread(); mt.start(); mt.start(); } } The code above compiles, however I got an illegal state exception in run time. What is the reason for this?
downvote count: 2
tagged with: multithreading
score: -2
accepted answer: http://stackoverflow.com/a/24509908
answer count: 1
has title: Illegal State Exception in Mutithreading
tagged with: java
tagged with: illegalstateexception
upvote count: 0
tagged with: runtime

http://stackoverflow.com/comment/38011567
comment on: http://stackoverflow.com/q/24544839
score: 0
has text: Are you doing hibernate operations inside transaction?If not do all the operation on session within transaction,as `hibernate.transaction.auto_close_session` will close session after transaction.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24515013
score: 1
has answer: http://stackoverflow.com/a/24515078
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24515067
accepted answer: http://stackoverflow.com/a/24515067
tagged with: java
has title: timer.scheduleAtFixedRate have an exception
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24515078
favorite count: 0
tagged with: timer
tagged with: android
type: AnsweredQuestion
has body: my code is: ou=100 final Timer t=new Timer(); TimerTask tt=new TimerTask() { @Override public void run() { ou-=10; if(ou==0) btnstart.setText(btnstart.getText().toString()+"t"); }}; t.scheduleAtFixedRate(tt, 2000, 2000); but when I run this program when change btnstart.text program will be close with this error "unfortunately, has stopped" this is my log cat: 07-01 15:27:30.714: W/dalvikvm(973): threadid=11: thread exiting with uncaught exception (group=0x40a13300) 07-01 15:27:30.786: E/AndroidRuntime(973): FATAL EXCEPTION: Timer-0 07-01 15:27:30.786: E/AndroidRuntime(973): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 07-01 15:27:30.786: E/AndroidRuntime(973): at android.os.Handler.(Handler.java:121) 07-01 15:27:30.786: E/AndroidRuntime(973): at android.widget.Toast$TN.(Toast.java:322) 07-01 15:27:30.786: E/AndroidRuntime(973): at android.widget.Toast.(Toast.java:91) 07-01 15:27:30.786: E/AndroidRuntime(973): at android.widget.Toast.makeText(Toast.java:238) 07-01 15:27:30.786: E/AndroidRuntime(973): at ir.maghsoodi.reminders.MainActivity$1$1.run(MainActivity.java:45) 07-01 15:27:30.786: E/AndroidRuntime(973): at java.util.Timer$TimerImpl.run(Timer.java:284)

http://stackoverflow.com/comment/37984247
has text: I know all that stuff, thanks, but java method accepts only `Date` object. I'll need one more "layer" to create Date object with `long`. But I don't have it.
type: AnswerComment
comment on: http://stackoverflow.com/a/24514538
score: 0
type: Comment

http://stackoverflow.com/comment/37827181
type: Comment
has text: which background show, imageview's background or image's background ?
type: QuestionComment
comment on: http://stackoverflow.com/q/24445836
score: 0

http://stackoverflow.com/comment/37963652
has text: @AmalMurali good point, sorry for that. The idea is to implement it in java. I'll add the tag so
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24519259

http://stackoverflow.com/q/24569942
has title: java.rmi.UnmarshalException while deploying in weblogic
favorite count: 0
has comment: http://stackoverflow.com/comment/38087388
tagged with: web.xml
upvote count: 2
type: UnansweredQuestion
has body: I'm getting the below exception while deploying the application in weblogic server: [java] weblogic.management.jmx.RemoteRuntimeException: java.rmi.UnmarshalException: failed to unmarshal class java.lang.Object; nested exception is: [java] java.io.InvalidClassException: javax.servlet.ServletException; local class incompatible: stream classdesc serialVersionUID = 4221302886851315160, local class serialVersionUID = 205441063386195800 I have a servlet with init method as shown below. Initially it had the setPreLoginURIMapper method alone and it was working fine Now I added a new method setForgotPasswordOverlayURIMapper which does almost the same function as the setPreLoginURIMapper other than that it reads another set of init params from the web.xml The new init param added in web.xml is also given below. Any thoughts? public void init(HttpServlet servletArg) throws ServletException { super.init(servletArg); setPreLoginURIMapper(servletArg); //Added newly setForgotPasswordOverlayURIMapper(servletArg); return; } private void setForgotPasswordOverlayURIMapper(HttpServlet servletArg) throws ServletException { String propsStr = getNotEmptyParam(servletArg, ForgotPasswordOverlayURIMapperParam_); TokenizedProperties props = TokenizedProperties.getInstance(propsStr, ITEM_DELIMITERS, ASSIGNMENT_DELIMITERS); forgotPasswordOverlayURIMapper_ = getValidPreLoginURIMapper(props, servletArg.getServletName()); return; } New entry in web.xml is as shown below: the URI for password overlay ForgotPasswordOverlayURIMapper member=/security/member/inputFPUsername.ndo; provider=/security/provider/inputFPUsername.ndo; employer=/security/employer/inputFPUsername.ndo; broker=/security/broker/inputFPUsername.ndo shopping=/security/shopping/inputFPUsername.ndo
score: 2
answer count: 0
tagged with: weblogic12c
tagged with: java
tagged with: servlets
type: Question
downvote count: 0

typechecking
tags question: http://stackoverflow.com/q/24585846
type: Tag
tag name: typechecking

http://stackoverflow.com/q/24494528
has comment: http://stackoverflow.com/comment/37918263
upvote count: 1
type: Question
type: AnsweredQuestion
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
has body: For example, with the json object: { "name": "flare", "children": [ { "name": "analytics", "children": [ { "name": "cluster", "children": [ {"name": "AgglomerativeCluster", "size": 3938}, {"name": "CommunityStructure", "size": 3812}, {"name": "HierarchicalCluster", "size": 6714}, {"name": "MergeEdge", "size": 743} ] }, { "name": "graph", "children": [ {"name": "BetweennessCentrality", "size": 3534}, {"name": "LinkDistance", "size": 5731}, {"name": "MaxFlowMinCut", "size": 7840}, {"name": "ShortestPaths", "size": 5914}, {"name": "SpanningTree", "size": 3416} ] }, { "name": "optimization", "children": [ {"name": "AspectRatioBanker", "size": 7074} ] } ] } } How would I go about adding up the values (file sizes) for the child files and assigning it as a value for the parent folder? For example, in the above json object, assigning the sum of the child file sizes to "cluster" as the value, instead of 'children'.
answer count: 1
has answer: http://stackoverflow.com/a/24494581
accepted answer: http://stackoverflow.com/a/24494581
favorite count: 0
has title: how do I add json object keys together using java?

http://stackoverflow.com/comment/139450178
comment on: http://stackoverflow.com/a/41988240
type: Comment
has text: Thanks for this answer. Now understand where the indefinite wait occurs and why its happening when i changed from flatmap to concatmap.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37954224
score: 0
type: Comment
type: QuestionComment
has text: Hard to tell without actual values but [this](http://stackoverflow.com/questions/12693273/is-there-an-upper-bound-to-biginteger) might help.
comment on: http://stackoverflow.com/q/24514528

http://stackoverflow.com/comment/38011572
has text: public void onClick(View v) { if (v.getId() == R.id.air_pick) { Intent intent = new Intent(v.getContext(), Airport.class); startActivityForResult(intent, 0); ....air_pick is the button....and Airport is another class where i want to call from Main class...This Airport class only contains buttons and nothing at all....this code is from Main.java class....please anyone can solve this...?? thanks everyone who have tried to help me..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24544878
score: 0

http://stackoverflow.com/a/24568814
type: Answer
score: 6
downvote count: 0
upvote count: 6
answers question: http://stackoverflow.com/q/24568749
has body: volatile guarantees that the new value will be visible by other threads. But that doesn't mean that changes to non-volatile variables are guaranteed to be invisible. In short, this works by accident, and is not guaranteed to work always and everywhere. In this case, it certainly works because both threads print to System.out, and println is a synchronized method. And synchronized also offers visibility guarantees.

http://stackoverflow.com/a/24570991
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You can change the size of perm gen in config or .ini file packed with eclipse. You need to add one line -XX:MaxPermSize=256m at the end
answers question: http://stackoverflow.com/q/24570899
accepted answer of: http://stackoverflow.com/q/24570899

http://stackoverflow.com/a/24531017
downvote count: 0
has body: Any Exception can be handled by using try-catch blocks. try{ // code that may throw exception }catch(org.json.JSONException exception){ // how you handle the exception // e.printStackTrace(); } Update: You are iterating over a JSONArray and going over the documentation for the same, it says: A dense indexed sequence of values. Values may be any mix of JSONObjects, other JSONArrays, Strings, Booleans, Integers, Longs, Doubles, null or NULL. Which means that JSONObject.NULL values may be present in the array. That is what your error states. Try adding an if-else to check what you get. More here: http://developer.android.com/reference/org/json/JSONObject.html#NULL
score: 6
has comment: http://stackoverflow.com/comment/37986376
has comment: http://stackoverflow.com/comment/37985382
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/37988072
answers question: http://stackoverflow.com/q/24530866

http://stackoverflow.com/q/24442744
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37848723
downvote count: 0
score: 1
favorite count: 0
tagged with: fft
type: Question
tagged with: dft
has title: How to use DFT to approximate a function?
upvote count: 1
has answer: http://stackoverflow.com/a/24481242
answer count: 1
tagged with: java
has body: Im trying to implement something like discribed here and here, Specifically i want to be able to perform the following operation as in the following image : That is, given N discrete points with constant time interval, i want to create a function that converges to those points as in the image... So far what i did was : imported jtransform used it private double[] doDFT(double[] data, int start, int end) { DoubleFFT_1D doubleFFT_1D = new DoubleFFT_1D(end-start); double[] array = new double[(end-start)*2]; for (int i=0;i&lt;end-start;i++) { array[i] = data[i+start]; array[i+1] = data[i+start+1]; } doubleFFT_1D.complexForward(array); return array; } and Now im stuck, how do i use the output array to produce the function that converges to the points in the original data array? Just to clearify what i want : for example in the image the data array that is inputted to doDFT is the blue line plot, and what i want is to produce a function f that its image is the red line plot.

http://stackoverflow.com/a/28767990
type: Answer
has body: Depending on the authentication method you choose for your webservices, you might have to add this user/password to the SecurityRealm in your weblogic admin console.
score: 0
answers question: http://stackoverflow.com/q/24573950

http://stackoverflow.com/a/24580309
type: Answer
has body: You're putting your classes in completely separate packages and not importing Bug into BugTester. Put both classes in package bug.
answers question: http://stackoverflow.com/q/24580166
has comment: http://stackoverflow.com/comment/38078434
has comment: http://stackoverflow.com/comment/38077343
score: 0

http://stackoverflow.com/comment/37952432
score: 0
type: AnswerComment
type: Comment
has text: thank you very much, that did it :) unfortunatelly I don't have enough reputation to vote up your answer :/
comment on: http://stackoverflow.com/a/24498252

http://stackoverflow.com/comment/37989219
comment on: http://stackoverflow.com/q/24533233
score: 1
has text: "the application got crashed" -- https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24442237
has comment: http://stackoverflow.com/comment/37820802
has comment: http://stackoverflow.com/comment/37820937
has comment: http://stackoverflow.com/comment/37822573
tagged with: class
score: 0
has comment: http://stackoverflow.com/comment/37821120
has title: What is the FPS drop in this game loop?
has comment: http://stackoverflow.com/comment/37820856
has comment: http://stackoverflow.com/comment/37820912
has body: Can someone tell my why the FPS keeps dropping from 100 (desired) to 91 every few iterations? I made everything as concise as I could from my original application, where I used double buffering and active rendering, in this example the same thing happens but I use passive rendering. The FPS constantly drops form 100 to 91 and I can't figure out why! Code import javax.swing.JPanel; import javax.swing.JFrame; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; public class Test extends JPanel implements Runnable { Image img; int fps; @Override public void paintComponent(Graphics g) { super.paintComponent(g); if(img != null) { g.drawImage(img, 0, 0, null); } } public void gameUpdate() { } public void gameRender() { Graphics g = getGraphics(); g.setColor(Color.BLACK); for(int i = 0; i &lt; 1000; i++) g.fillRect(0, 0, 50, 50); } public void startGame() { if(thread == null) { thread = new Thread(this); thread.start(); } } private Thread thread; @Override public void run() { long beforeTime = 0; long afterTime = 0; long timeDiff = 0; int period = 10000000; long sleepTime = 0; long overSleepTime = 0; while(true) { beforeTime = System.nanoTime(); gameUpdate(); gameRender(); repaint(); afterTime = System.nanoTime(); timeDiff = afterTime - beforeTime; sleepTime = (period - timeDiff) - overSleepTime; if(sleepTime &gt; 0) { try { Thread.sleep(sleepTime/1000000L); } catch (InterruptedException e){} long threadSleepTime = System.nanoTime() - afterTime; overSleepTime = threadSleepTime - sleepTime; fps = (int)FPSCounter.getFPS(threadSleepTime, timeDiff); System.out.println(fps); } // end if } } public void addNotify() { super.addNotify(); startGame(); } public static void main(String[] args) { JFrame f = new JFrame("Title"); f.setSize(500, 500); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(new Test()); f.setVisible(true); } } Separate class /** * Return the current FPS * @param threadSleep Amount of time thread has slept * @param renderTime …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37822566
has comment: http://stackoverflow.com/comment/37820916
has comment: http://stackoverflow.com/comment/37820914
has comment: http://stackoverflow.com/comment/37820886
answer count: 0
has comment: http://stackoverflow.com/comment/37820818
has comment: http://stackoverflow.com/comment/37820780
tagged with: rendering
tagged with: java
has comment: http://stackoverflow.com/comment/37820949
has comment: http://stackoverflow.com/comment/37821047
has comment: http://stackoverflow.com/comment/37821137
has comment: http://stackoverflow.com/comment/37820894
type: Question

http://stackoverflow.com/q/24429349
possible better answer: http://stackoverflow.com/a/24429413
has answer: http://stackoverflow.com/a/24429413
type: Question
tagged with: jakarta-ee
answer count: 2
accepted answer: http://stackoverflow.com/a/24429393
tagged with: jsp
tagged with: servlets
score: 0
has body: From To In this portion of my form, I need to take input from the user for 'FromTime' and 'ToTime'. On entering these values, I dynamically create another li (using jquery) just like above to have another 'FromTime' and 'ToTime' and goes on. How can I retrieve all these 'FromTime' and 'ToTime' in my servlet? When I use request.getParameter("FromTime") and request.getParameter("ToTime"), I get only the first li values.
has answer: http://stackoverflow.com/a/24429393
has title: Getting data from the dynamically updated fields from JSP to Servlet
has comment: http://stackoverflow.com/comment/37796785
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/38225755
comment on: http://stackoverflow.com/a/24560079
score: 0
type: AnswerComment
type: Comment
has text: Unfortunately, it's not working. I think there may be a problem with the login. This page requires a login and maybe the class is not recognizing the logged in session.

http://stackoverflow.com/comment/37891619
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24480078
has text: Yes, the web reference directory contains both a .map file and a .wsdl file both containing the serverURL plus a generated .cs and .datasource file. I would like to pull out the serverURLs without toppling the generated house of cards in a way not involving writing my own generator.
score: 0

http://stackoverflow.com/q/24562031
type: Question
has title: Java: .ttf font empty, width <=0, system fonts working
has answer: http://stackoverflow.com/a/24567626
answer count: 1
tagged with: fontmetrics
tagged with: awt
has comment: http://stackoverflow.com/comment/38043391
has comment: http://stackoverflow.com/comment/38043984
has comment: http://stackoverflow.com/comment/38043937
accepted answer: http://stackoverflow.com/a/24567626
tagged with: fonts
score: 0
tagged with: truetype
linked to: http://stackoverflow.com/q/17282495
has comment: http://stackoverflow.com/comment/38044322
type: AnsweredQuestion
tagged with: java
has body: I am trying to generate a bufferedImage of the size of the given text. When using a system font, there is no problem. I tripple checked the location, so that should not be my mistake. I can upload the font somewhere if needed. font = Font.createFont(Font.TRUETYPE_FONT, ttfStream); When using a .ttf file I get errors, indicating that there is no data in there. font = Font.createFont(Font.TRUETYPE_FONT, ttfStream); The Error says: Exception in thread "main" java.lang.IllegalArgumentException: Width (0) and height (1) cannot be &lt;= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1016) at java.awt.image.BufferedImage.&lt;init&gt;(BufferedImage.java:340) at ErrorExample.stringToBufferedImage(Untitled.java:64) at ErrorExample.main(Untitled.java:35) Example code: class ErrorExample { static boolean dontwork = true; public static void main(String[] args) throws IOException, FontFormatException{ InputStream ttfStream = new BufferedInputStream(new FileInputStream("/test/monofont.ttf")); Font font; if(dontwork == true){ //here the fun seems to be. font = Font.createFont(Font.TRUETYPE_FONT, ttfStream); }else{ font = new Font( "Verdana", Font.BOLD, 20 ); } BufferedImage img = stringToBufferedImage(font, "sdf"); System.out.println("Done."); } /** * Modiefied from http://stackoverflow.com/a/17301696/3423324 * @param font */ public static BufferedImage stringToBufferedImage(Font f, String s) { //First, we have to calculate the string's width and height BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_4BYTE_ABGR); Graphics g = img.getGraphics(); //Set the font to be used when drawing the string //f = new Font("Tahoma", Font.PLAIN, 48); g.setFont(f); //Get the string visual bounds FontRenderContext frc = g.getFontMetrics().getFontRenderContext(); Rectangle2D rect = f.getStringBounds(s, frc); //Release resources g.dispose(); //Then, we have to draw the string on the final image //Create a new image where to print the character …

http://stackoverflow.com/a/45138926
type: Answer
has comment: http://stackoverflow.com/comment/91218134
has comment: http://stackoverflow.com/comment/90658891
answers question: http://stackoverflow.com/q/24564470
score: 14
has comment: http://stackoverflow.com/comment/127459353
downvote count: 0
has comment: http://stackoverflow.com/comment/105028434
has comment: http://stackoverflow.com/comment/104978372
upvote count: 14
has body: I integrated a Unity project to an Android application. I had a simple activity with a button created using Android Studio. On clicking this button the Unity scenes will start. The android project exported from unity should like this: It needed to be converted to Gradle project first. For that: Open Android Studio -> choose import project -> select the unity project (Non-Gradle project) -> save project and close. Now your unity project folder looks like this: Now open your project and do the following to import the unity project in to your project: Click File -> New -> New Module -> Select "import Gradle Project" -> choose the unity gradle project folder you just created -> rename module name if prompted by checking the “import” checkbox in Android studio -> Click Finish Verify in Settings.gradle file to see if the new module name is added in the include command: include ':app', ':yournewmodulename’ Open build.gradle file of the new unity module from navigation window and rename the below line: apply plugin: 'com.android.application' to apply plugin: 'com.android.library' Remove the line from the defaultConfig section of the new unity module: applicationId "com.xxx.xxx" Open Manifest of this new unity module and comment the application tag (Do not remove the uses-sdk tag).Integrate the new unity module's Manifest with your project’s Manifest by moving necessary tags to our project’s Manifest (e.g. :Activity, uses-feature etc.). Open build.gradle of your project and add below line in the dependencies section: dependencies { … compile project(path: ':yournewmodulename') } Now on button click you can call the Activity in the unity module from your activity as below: import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.xxx.xxx.UnityPlayerActivity; public class MainActivity extends AppCompatActivity { private Button button; @Override protected void onCr…

http://stackoverflow.com/q/24465995
type: Question
has title: After reading xml file trying to send mail
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24466386
type: UnansweredQuestion
has body: I am trying to read the xml file and trying to send the mail. here is the xml code <?xml version="1.0" encoding="UTF-8"?> <u_incident_task> messafe 1 12345 <u_task_incident_service_ci>A</u_task_incident_service_ci> </u_incident_task> <u_incident_task> messafe 3 123456 <u_task_incident_service_ci>A</u_task_incident_service_ci> </u_incident_task> so when ever Priority is 1 i need to send mail. currently my below code is working and able to send. But when ever Priority is updated from 3 to 1 mail is not able to send. may be the reason i am storing all the number in array since i dont want to send mail repeatedly. so i stored the numbers in array so that i can be sent only once. so while i am storing the numbers if any Priority is updated to 1 mail is not working. But when record is created with 1 mail i sent but if we updated the existing priority from 3 to 1 it not workin. complete working code is here. can any one help what i missed in logic pls? complete code here. Incidentreport2000.java package com.asn.model; import java.awt.Desktop; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.util.Properties; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import com.asn.model.incident200; import com.asn.model.incident1; import java.io.BufferedReader; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import javax.mail.Message; import javax.mail.MessagingException;import javax.mail.Session; import javax.mail.Transport; import ja…
has comment: http://stackoverflow.com/comment/37864400
has comment: http://stackoverflow.com/comment/37864354
tagged with: java

http://stackoverflow.com/q/24505159
has body: I have managed to setup a filter for the servlet on tomcat, but the HttpServletResponse only has functions to get the response headers, not the actual HTML response itself. Some reading told me that I have to make a wrapper class but I don't know how to go about this. After a lot of head wracking, I decided to post this on stackoverflow. How can I retrieve the HTML content from the HttpServletResponse? I need to save it as a text file.
type: Question
has answer: http://stackoverflow.com/a/24511043
has title: How to get the HTML content from HttpServletResponse?
tagged with: tomcat
tagged with: servlets
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: servlet-filters
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/a/24468446
score: 4
has comment: http://stackoverflow.com/comment/37869120
answers question: http://stackoverflow.com/q/24468356
has body: 5 -> the "time" the client receives the message 7 -> the "time" the server sent the message since the client and server are independent threads, they will not output times in order. the primary confusion comes because of this line: System.out.println(time() + bufferedReader.readLine()); It seems like the println is going "back in time". what is happening, however, is that the time() method is called way back at time "5". but, since normal java sockets are blocking, the bufferedReader.readLine() call hangs until the data is actually available from the server, which doesn't happen until after it is sent by the server (of course). then, once the readLine method returns, the println call actually completes. if you want to see a more "logical" progression, change the last client line to: String result = bufferedReader.readLine(); System.out.println(time() + result); that will delay the client's last time() call until after the response is actually received.
has comment: http://stackoverflow.com/comment/37869137
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24549743
upvote count: 7
answers question: http://stackoverflow.com/q/24549716
type: Answer
has body: It's because the method in subclass is not override-equivalent with the one in super class. The super class method can take null as argument, while the subclass method can't (There's nothing about auto-boxing here).
has comment: http://stackoverflow.com/comment/38020190
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/38020659
has comment: http://stackoverflow.com/comment/38020707
has comment: http://stackoverflow.com/comment/38659175
has comment: http://stackoverflow.com/comment/38020575

http://stackoverflow.com/a/24572966
upvote count: 38
type: Answer
has comment: http://stackoverflow.com/comment/38098131
score: 38
answers question: http://stackoverflow.com/q/24572214
downvote count: 0
has body: Probably the simplest (not necessarily the easiest) way to manage this would be with a delegate class: import net.foo.X; class C { static void doSomething() { X.doSomething(); } } and then ... class B extends A { void doX(){ C.doSomething(); } } This is somewhat verbose, but very flexible - you can get it to behave any way you want; plus it works in much the same way both with static methods and instantiated objects More about delegate objects here: http://en.wikipedia.org/wiki/Delegation_pattern

http://stackoverflow.com/a/24564755
type: Answer
has comment: http://stackoverflow.com/comment/38048927
has comment: http://stackoverflow.com/comment/38048740
answers question: http://stackoverflow.com/q/24564578
has body: Have a look at this: keyPressed() will keep firing so long as the key is held down. You could put the code into keyReleased() but then it'd probably feel weird to the player if the missile was firing when they let go of the key. Better would be to put some kind of check in place to make sure it only fires once for each event. boolean fired; @Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_SPACE:{ m = new Missilies(x,y); if(!fired) { m.fire(); fired = true; } break; } @Override public void keyRelased(KeyEvent e) { fired = false; }
has comment: http://stackoverflow.com/comment/38049100
has comment: http://stackoverflow.com/comment/38048760
score: 0

http://stackoverflow.com/a/24455454
type: AcceptedAnswer
has body: Http(s)UrlConnection may be your weapon of choice: public String sendData() throws IOException { // curl_init and url URL url = new URL("http://some.host.com/somewhere/to/"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); // CURLOPT_POST con.setRequestMethod("POST"); // CURLOPT_FOLLOWLOCATION con.setInstanceFollowRedirects(true); String postData = "my_data_for_posting"; con.setRequestProperty("Content-length", String.valueOf(postData.length())); con.setDoOutput(true); con.setDoInput(true); DataOutputStream output = new DataOutputStream(con.getOutputStream()); output.writeBytes(postData); output.close(); // "Post data send ... waiting for reply"); int code = con.getResponseCode(); // 200 = HTTP_OK System.out.println("Response (Code):" + code); System.out.println("Response (Message):" + con.getResponseMessage()); // read the response DataInputStream input = new DataInputStream(con.getInputStream()); int c; StringBuilder resultBuf = new StringBuilder(); while ( (c = input.read()) != -1) { resultBuf.append((char) c); } input.close(); return resultBuf.toString(); } I'm not quite sure about the HTTPS_VERIFYPEER-thing, but this may give you a starting point.
has comment: http://stackoverflow.com/comment/52870935
type: Answer
score: 6
upvote count: 7
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24454164
answers question: http://stackoverflow.com/q/24454164

http://stackoverflow.com/comment/37893596
comment on: http://stackoverflow.com/q/24481101
has text: It holds in mobile for counted seconds and a msg pops up "Unfortunately, Di has stopped"
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37795864
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24429009
has text: In Java, all strings are unicode, so that is not the problem per se. Maybe the font doesn't include those characters? A bit of code, showing how you try to print, would be useful.
score: 0

http://stackoverflow.com/a/24527392
type: Answer
answers question: http://stackoverflow.com/q/24527032
has comment: http://stackoverflow.com/comment/38013812
has body: This works: Runtime rt = Runtime.getRuntime(); String a = "/bin/ls"; Process proc = rt.exec(a); proc.waitFor(); InputStream is = proc.getInputStream(); InputStreamReader isr = new InputStreamReader( is ); BufferedReader br = new BufferedReader( isr ); String line; while( (line = br.readLine() ) != null ){ System.out.println( line ); } br.close(); // to see errors: System.out.println( "*** error output ***" ); InputStream isErr = proc.getErrorStream(); InputStreamReader isrErr = new InputStreamReader( isErr ); BufferedReader brErr = new BufferedReader( isrErr ); String line; while( (line = brErr.readLine() ) != null ){ System.out.println( line ); } brErr.close();
has comment: http://stackoverflow.com/comment/38013583
has comment: http://stackoverflow.com/comment/38015794
has comment: http://stackoverflow.com/comment/38013625
has comment: http://stackoverflow.com/comment/38016483
score: 0
has comment: http://stackoverflow.com/comment/38016152
has comment: http://stackoverflow.com/comment/38016907

http://stackoverflow.com/q/24475134
has comment: http://stackoverflow.com/comment/40188969
tagged with: multipartform-data
tagged with: jax-rs
has body: I'm not so familiar with Ajax and client side application (I'm mainly a server side developer). I need to add to a simple HTML page, a button that uploads a file and sens it to a Apache-CXF service. I don't succeed to make this "hand shake" between client and server. I get: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: Couldn't determine the boundary from the message! This is the definition of the service in Java: @Path("/") @Produces(MediaType.TEXT_PLAIN) @Getter @Setter @CrossOriginResourceSharing(allowAllOrigins = true) public class NLPRestService { @POST @Path("/uploadPosRulesFile") @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadFile(@Multipart(value="file", type="text/plain" ) InputStream file) { //Here will be the code that handles the file content - I'll know what do with it once I'll succeed to get here } } This is the HTML file: My-App my-app Upload new POS Rules File ... And finally the JavaScript code that does the AJAX call: function uploadFiles() { event.stopPropagation(); // Stop stuff happening event.preventDefault(); // Totally stop stuff happening // START A LOADING SPINNER HERE // Create a formdata object and add the files $.ajax({ url : '../services/nlpService/uploadPosRulesFile', type : 'POST', data: { file: $('#fileupload').val()}, cache : false, dataType : 'text/plain', processData : false, // Don't process the files contentType: 'multipart/form-data', //contentType : false, // Set content type to false as jQuery will tell the server its a query string request success : function(data, textStatus, jqXHR) { alert(data); if (typeof data.error === 'undefined') { } else { // Handle errors here console.log('ERRORS: ' + data.error); } }, error : function(jqXHR, textStatus, errorThrown) { // Handle errors here console.log('ERRORS: ', jqXHR, textStatus, errorThrown); $('#alert').css('display', 'block'); $('#alert').html(jqXHR.response); // STOP LOADING SPINNER } }); } It might be really basic issue (because I'm really not ful…
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37933096
score: 2
has comment: http://stackoverflow.com/comment/40203317
tagged with: cxf
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24502651
downvote count: 0
has answer: http://stackoverflow.com/a/36310629
favorite count: 0
has title: Upload file using Ajax and Apache CXF
tagged with: jquery-file-upload

http://stackoverflow.com/q/24564796
score: 9
type: Question
upvote count: 9
tagged with: intellij-idea
downvote count: 0
tagged with: ide
has title: Intellij Idea: One line if on two lines
has answer: http://stackoverflow.com/a/44756324
has answer: http://stackoverflow.com/a/33677705
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24568191
answer count: 4
has body: So I am new to the Intellij Idea IDE and so far I like it a lot. Just having some trouble getting the code style settings exactly how I like them for Java. I am a fan of not using braces for one line if statements but I like for them to be on two lines: if(true) dosomething(); Right now when I run code formatting in Idea, it moves up into one line: if(true) dosomething(); and I find that very hard to read, but I cannot seem to get the settings just right. Can anyone help me out and tell me what I need to set to keep it on two lines but still no braces? Feel pretty dumb not being able to find it. Thanks!
has answer: http://stackoverflow.com/a/34624017
tagged with: java

http://stackoverflow.com/comment/38183404
has text: What about the files on the classpath? Do you have the `gf-client.jar` or `jndi-properties.jar` on any of the projects? Can you post some of the source code with their relative file/project attachments?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24626593

http://stackoverflow.com/q/24569386
favorite count: 0
has title: OpenCV filtering ORB matches
accepted answer: http://stackoverflow.com/a/24570238
score: 9
type: Question
tagged with: opencv
tagged with: java
possible better answer: http://stackoverflow.com/a/26195232
tagged with: feature-detection
answer count: 3
has answer: http://stackoverflow.com/a/26195232
tagged with: orb
upvote count: 9
has answer: http://stackoverflow.com/a/50964113
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24570238
has body: I am using the ORB feature detector to find matches between two images using this code: FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB); DescriptorExtractor descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);; DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); // First photo Imgproc.cvtColor(img1, img1, Imgproc.COLOR_RGB2GRAY); Mat descriptors1 = new Mat(); MatOfKeyPoint keypoints1 = new MatOfKeyPoint(); detector.detect(img1, keypoints1); descriptor.compute(img1, keypoints1, descriptors1); // Second photo Imgproc.cvtColor(img2, img2, Imgproc.COLOR_RGB2GRAY); Mat descriptors2 = new Mat(); MatOfKeyPoint keypoints2 = new MatOfKeyPoint(); detector.detect(img2, keypoints2); descriptor.compute(img2, keypoints2, descriptors2); // Matching MatOfDMatch matches = new MatOfDMatch(); MatOfDMatch filteredMatches = new MatOfDMatch(); matcher.match(descriptors1, descriptors2, matches); // Linking Scalar RED = new Scalar(255,0,0); Scalar GREEN = new Scalar(0,255,0); List&lt;DMatch&gt; matchesList = matches.toList(); Double max_dist = 0.0; Double min_dist = 100.0; for(int i = 0;i &lt; matchesList.size(); i++){ Double dist = (double) matchesList.get(i).distance; if (dist &lt; min_dist) min_dist = dist; if ( dist &gt; max_dist) max_dist = dist; } LinkedList&lt;DMatch&gt; good_matches = new LinkedList&lt;DMatch&gt;(); for(int i = 0;i &lt; matchesList.size(); i++){ if (matchesList.get(i).distance &lt;= (1.5 * min_dist)) good_matches.addLast(matchesList.get(i)); } // Printing MatOfDMatch goodMatches = new MatOfDMatch(); goodMatches.fromList(good_matches); System.out.println(matches.size() + " " + goodMatches.size()); Mat outputImg = new Mat(); MatOfByte drawnMatches = new MatOfByte(); Features2d.drawMatches(img1, keypoints1, img2, keypoints2, goodMatches, outputImg, GREEN, RED, drawnMatches, Features2d.NOT_DRAW_SINGLE_POINTS); Highgui.imwrite("matches.png", outputImg); My problem is that I can't find a way to f…

http://stackoverflow.com/comment/62221849
score: 0
type: AnswerComment
has text: Thank you, my though was like yours
type: Comment
comment on: http://stackoverflow.com/a/37353113

http://stackoverflow.com/comment/38085986
has text: C#: "s: " + (s ?? "")
type: Comment
score: 3
comment on: http://stackoverflow.com/a/24583505
type: AnswerComment

http://stackoverflow.com/comment/37808033
comment on: http://stackoverflow.com/a/24434927
score: 0
type: AnswerComment
has text: `before` will be empty. It seems that look-behind is making `.{0,12}` reluctant. I even tried to rewrite it to make it start matching from biggest number of occurrences using string like `.{12}|.{11}| ... |.{1}|.{0}"` but this also act same way.
type: Comment

http://stackoverflow.com/a/24524200
upvote count: 2
has comment: http://stackoverflow.com/comment/37972836
has comment: http://stackoverflow.com/comment/37972981
has body: Now I understand better your problem :) Save the whole line into your domain object and not the FieldSet using a custom LineMapper. From LineMapper javadoc: Interface for mapping lines (strings) to domain objects typically used to map lines read from a file to domain objects on a per line basis. Implementations of this interface perform the actual work of parsing a line without having to deal with how the line was obtained. So with a delegate is pretty easy solve your problem: class StoreLineLineMapper implements LineMapper&lt;DomainObject&gt; { private LineMapper&lt;DomainObject&gt; delegate; public DomainObject mapLine(java.lang.String line, int lineNumber) throws java.lang.Exception { DomainObject record = delegate.mapLine(line, lineNumber); record.setLineInfo(new LineInfo(line, lineNumber)); return record; } }
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24509211
score: 2
accepted answer of: http://stackoverflow.com/q/24509211

http://stackoverflow.com/a/24494538
answers question: http://stackoverflow.com/q/24488323
has comment: http://stackoverflow.com/comment/95257462
score: 0
type: AcceptedAnswer
type: Answer
has body: Init empty keystore: KeyStore keyStore = KeyStore.getInstance("BKS"); keyStore.load(null, password); Parse you certificate obtained from web service, retrieve X509Certificate and PrivateKey Store it in keystore: keyStore.setKeyEntry(alias, privateKey, password, new X509Certificate []{certificate}); Save keyStore: OutputStream outputStream = context.openFileOutput(filename, Context.MODE_PRIVATE); keyStore.store(outputStream, password); And later, when you need your saved keystore, laod it from file: InputStream in; try { in = context.openFileInput(filename); try { keyStore.load(in, password); } finally { in.close(); }
has comment: http://stackoverflow.com/comment/95182589
accepted answer of: http://stackoverflow.com/q/24488323

http://stackoverflow.com/q/24532585
upvote count: 0
has answer: http://stackoverflow.com/a/24532682
favorite count: 0
tagged with: class
answer count: 3
accepted answer: http://stackoverflow.com/a/24532697
score: -6
linked to: http://stackoverflow.com/q/4207593
has title: java string to class and call mathod
has body: I have 2 class Test.java whith code public class Test { public void main (String [] args) { System.out.println ("Call test"); } } And second class: MakeCall.Java In this class I have String variable: String MakeCall = "Test"; Please help: how can I convert String to ClassName and call method main, like: MakeCall.main (args). Thanks!
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37987909
tagged with: java
has answer: http://stackoverflow.com/a/24532851
has answer: http://stackoverflow.com/a/24532697
type: Question
possible better answer: http://stackoverflow.com/a/24532682

http://stackoverflow.com/comment/38035512
type: QuestionComment
type: Comment
has text: Character encoding perhaps? ->getBytes("UTF-8") Or match to whatever PHP worked with. As is your code would be platform specific.
comment on: http://stackoverflow.com/q/24557854
score: 0

http://stackoverflow.com/a/26141516
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24575428
has body: To elaborate on Brett's answer: Configure your web.xml: ...... 1 com.acme.MyContextListener MyContextListener looks something like: public class MyContextListener implements ServletContextListener { // where the work happens final Runnable myRunnable = new Runnable() { public void run() { System.out.println("hello world"); } }; // Brett's code here //.... }
downvote count: 0

http://stackoverflow.com/a/24504431
score: 0
answers question: http://stackoverflow.com/q/24503970
type: Answer
has body: ServletRequest Object is an client request to a Servlet, and ServletResponse object is the response sent to the client so always you get the required information from the request and you set the information in the response............!

http://stackoverflow.com/q/24546496
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38017966
has title: Transform Map using Guava
has comment: http://stackoverflow.com/comment/38017992
tagged with: guava
tagged with: java
type: Question
has body: I have a Group object which has list of elements like below. class Group { List&lt;E&gt; elements; public List&lt;E&gt; getElements() { return elements; } } I have Map object represented as below. Map&lt;Group, Double&gt; groups = with some values.... I have a another Map as below. Map&lt;Element, Double&gt; elementVal = with some values.... My Final map should be a Map&lt;Element, Double&gt; = with some values where value is multiplication of element's group value (groups map) * element's value (elementVal map). I am looking for Map transformation preferably using Guava or any other cleaner way to this rather than exploding the maps. thanks.
has answer: http://stackoverflow.com/a/24549299
accepted answer: http://stackoverflow.com/a/24549299
has comment: http://stackoverflow.com/comment/38014645
score: 0
has comment: http://stackoverflow.com/comment/38014699
answer count: 1
has comment: http://stackoverflow.com/comment/38017945
has comment: http://stackoverflow.com/comment/38016698

http://stackoverflow.com/a/24516735
answers question: http://stackoverflow.com/q/24516641
accepted answer of: http://stackoverflow.com/q/24516641
has body: In this case userInput.hasNext() always returns true. So you need a finite loop. Use for loop import java.util.Scanner; import java.util.Vector; public class TenWords { public static void main(String[] args) { Vector&lt;String&gt; words = new Vector&lt;String&gt;(); Scanner userInput = new Scanner(System.in); System.out.println("Please enter ten words"); String a; for (int i = 0; i &lt; 10; i++) { a = userInput.next(); words.add(a); System.out.println(a); } int s = words.size(); System.out.println(s); } }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

header
type: Tag
tags question: http://stackoverflow.com/q/24538508
tag name: header

http://stackoverflow.com/a/24478750
score: 2
has body: Regarding obfuscation in general: 1) Against what do you want to protect? 1.1) A Java beginner understanding your code: Your approach may be ok 1.2) A Java expert understanding your code: Your approach won't really work and may not even slow the expert down by more than factor 2 1.3) A competitor understanding your code: Your approach won't really work, the competitor may put considerable resources on the task 2) Do you have to maintain the code later on? 2.1) Yes: You need something which translates your original sources to the obfuscated variants (see below) 2.2) No: You may be ok with it, however, if you need to fix a bug later on, you might not understand what you have created some time ago (it happens to experts regularly even with documented code...) Obfuscation tools: Having said that, you may want to look at ProGuard ( http://proguard.sourceforge.net ). It is a Java obfuscator and it even improves performance on low resources platforms (mostly by shortening class and package names and reducing the size of the class files to push around). There are encrypting class loaders. It raises the difficulty for your opponent, but you won't be safe - see this article. Regarding performance: You have to run performance tests with and without your change. And you need to do that on the platform on which the software shall run eventually. Some code is certainly slower and some certainly faster - however, eventually you need to test it.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24477319
answers question: http://stackoverflow.com/q/24477319
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24518277
type: Question
tagged with: android
tagged with: fragment
has title: Initializing a view without findViewById()
tagged with: view
has answer: http://stackoverflow.com/a/24518772
score: 0
tagged with: java
answer count: 1
type: UnansweredQuestion
has body: I have an activity and a fragment. Now in the onCreate() of the fragment I want to add rows to my table layout defined in the xml of the fragment. For that I want to initialize a table layout to that defined in the xml. In the view of my application I only have the layout of the main activity set. I don't have the view of the fragment and I can't set it right now. So when I wrote this TableLayout tableLayout = findViewById(R.id.record); there is an error in the log cat. View can't be found. I understand the problem but I am not able to find its solution anywhere. record is the id of the table layout in fragment's layout xml file &lt;TableLayout android:id="@+id/record" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/TableLayout&gt; Thanks in advance.
tagged with: layout

http://stackoverflow.com/q/24516881
tagged with: java
has title: Hiding Query String to show in URL: URL Rewriting
has body: I am calling one JS function to open a new window by clicking a button function showReport(){ window.open("reports.action?repType=RPDRep&amp;selectedProjects=${projectSelect}"); } projectSelect values I am getting from Action class of the calling page. It calls another action with these values and generate expected result. It works fine but the only problem is My values are getting exposed in URL like this http://localhost:9080/xyz/reports.action?repType=RPDRep&amp;selectedProjects=DE-06-00273 Kindly let me if there is any method to convert URL into something meaningful without showing input details to users. Thanks!
tagged with: struts2
type: Question
answer count: 2
tagged with: javascript
tagged with: query-string
score: 0
accepted answer: http://stackoverflow.com/a/24523673
tagged with: url-rewriting
possible better answer: http://stackoverflow.com/a/24517044
has answer: http://stackoverflow.com/a/24517044
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24523673

hibernate
tags question: http://stackoverflow.com/q/24460934
tags question: http://stackoverflow.com/q/24548464
tags question: http://stackoverflow.com/q/24559723
tags question: http://stackoverflow.com/q/24467384
tags question: http://stackoverflow.com/q/24560417
tags question: http://stackoverflow.com/q/24485147
tags question: http://stackoverflow.com/q/24427827
tags question: http://stackoverflow.com/q/24447481
tags question: http://stackoverflow.com/q/24532734
tags question: http://stackoverflow.com/q/24517120
tags question: http://stackoverflow.com/q/24575250
tags question: http://stackoverflow.com/q/24497804
tags question: http://stackoverflow.com/q/24580527
tags question: http://stackoverflow.com/q/24470884
tags question: http://stackoverflow.com/q/24465706
tags question: http://stackoverflow.com/q/24570070
tags question: http://stackoverflow.com/q/24484579
tags question: http://stackoverflow.com/q/24560134
tags question: http://stackoverflow.com/q/24485365
tags question: http://stackoverflow.com/q/24565641
tags question: http://stackoverflow.com/q/24533493
tags question: http://stackoverflow.com/q/24435362
tags question: http://stackoverflow.com/q/24528193
tags question: http://stackoverflow.com/q/24446262
tags question: http://stackoverflow.com/q/24572780
tags question: http://stackoverflow.com/q/24549607
tags question: http://stackoverflow.com/q/24498345
tags question: http://stackoverflow.com/q/24535240
tags question: http://stackoverflow.com/q/24446280
tags question: http://stackoverflow.com/q/24576157
tags question: http://stackoverflow.com/q/24508575
tags question: http://stackoverflow.com/q/24491029
tags question: http://stackoverflow.com/q/24487661
tags question: http://stackoverflow.com/q/24548613
tags question: http://stackoverflow.com/q/24573674
tags question: http://stackoverflow.com/q/24453275
tags question: http://stackoverflow.com/q/24506638
tags question: http://stackoverflow.com/q/24526216
tags question: http://stackoverflow.com/q/24435989
tags question: http://stackoverflow.com/q/24484840
tags question: http://stackoverflow.com/q/24441172
tags question: http://stackoverflow.com/q/24536278
tags question: http://stackoverflow.com/q/24477900
tags question: http://stackoverflow.com/q/24458223
tags question: http://stackoverflow.com/q/24579374
tags question: http://stackoverflow.com/q/24545166
tags question: http://stackoverflow.com/q/24574610
tags question: http://stackoverflow.com/q/24434738
tags question: http://stackoverflow.com/q/24498483
tag name: hibernate
tags question: http://stackoverflow.com/q/24490502
tags question: http://stackoverflow.com/q/24541559
tags question: http://stackoverflow.com/q/24494964
tags question: http://stackoverflow.com/q/24443601
tags question: http://stackoverflow.com/q/24527534
tags question: http://stackoverflow.com/q/24431693
tags question: http://stackoverflow.com/q/24528263
tags question: http://stackoverflow.com/q/24472916
tags question: http://stackoverflow.com/q/24562975
tags question: http://stackoverflow.com/q/24579749
tags question: http://stackoverflow.com/q/24465078
tags question: http://stackoverflow.com/q/24548945
tags question: http://stackoverflow.com/q/24552319
tags question: http://stackoverflow.com/q/24484669
tags question: http://stackoverflow.com/q/24524916
tags question: http://stackoverflow.com/q/24446731
tags question: http://stackoverflow.com/q/24563385
tags question: http://stackoverflow.com/q/24573877
tags question: http://stackoverflow.com/q/24522090
tags question: http://stackoverflow.com/q/24482107
tags question: http://stackoverflow.com/q/24529473
tags question: http://stackoverflow.com/q/24549378
tags question: http://stackoverflow.com/q/24475706
tags question: http://stackoverflow.com/q/24454701
tags question: http://stackoverflow.com/q/24536804
tags question: http://stackoverflow.com/q/24488636
tags question: http://stackoverflow.com/q/24481848
tags question: http://stackoverflow.com/q/24530463
tags question: http://stackoverflow.com/q/24573027
tags question: http://stackoverflow.com/q/24468602

http://stackoverflow.com/comment/37913307
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24490795
has text: :-O - I think you got it. If edit your answer, I'll accept it.

http://stackoverflow.com/comment/66841004
comment on: http://stackoverflow.com/a/24570355
type: Comment
has text: @AnmolSinghJaggi It's a pathname for the KieFileSystem object kfs. Nothing to do with files on your disk etc.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37948958
has text: I set it in the constructor `new GridLayout(1, 2, 0, 0)` but the gap still shows.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24511643
type: Comment

http://stackoverflow.com/q/24429471
has comment: http://stackoverflow.com/comment/37796897
accepted answer: http://stackoverflow.com/a/24429527
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37797036
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37799274
has body: In my current android application I have created one Singleton Object which is responsible to communicate with Secure Element and also storing some secrets in file in internal storage. Now scenario is like if user wants to change the Secure Element He can just unplugged it and insert it again and when he do that he is asked to clear data from application. As my current application's process(even though I have closed my all activities) is not killed yet my Singleton Object is not get cleared. But I want to reset the state of my Singleton Object or say I want to create new Singleton Object and delete previous one. Below is my implementation: public class SEManager { private static SEManager INSTANCE = null; private SEManager() { } public static void init() throws Exception { if (INSTANCE != null) { throw new Exception("Invalid Operation"); } INSTANCE = new SEManager(); } public static SEManager getInstance() { return INSTANCE; } } I am confuse how to reset object state or delete its reference. One solution coming in mind is public static synchronized void reset(){ INSTANCE = null; } But I am not able to figure out its disadvantage.
has comment: http://stackoverflow.com/comment/37797834
has comment: http://stackoverflow.com/comment/37796777
has answer: http://stackoverflow.com/a/24429527
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has title: Killing singleton object

http://stackoverflow.com/q/24560085
favorite count: 0
has answer: http://stackoverflow.com/a/27538050
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27545653
has answer: http://stackoverflow.com/a/27538242
possible better answer: http://stackoverflow.com/a/27538050
tagged with: java
has body: When testing the persistence of my model I'm getting one attribute overwritten. I'm running the following test: @Test public void objectTest() throws Exception { tester.testClass(AssetUpdateReserve.class); Assert.assertEquals(tester.getResult().getErrors().size(), 0, "Errors found"); } My AssetUpdateReserve Entity: @Entity @Table(name = "ASSET_UPD_RESERVE") public class AssetUpdateReserve implements Serializable { private static final long serialVersionUID = 6530799190088978893L; @EmbeddedId @AttributeOverrides({ @AttributeOverride(name = "partitionId.assetSliceId", column = @Column(name = "PARTITION_ID")), @AttributeOverride(name = "partitionId.associatedKey", column = @Column(name = "PARTITION_ID_AK")), @AttributeOverride(name = "containerId.id", column = @Column(name = "CONTAINER_ID")), @AttributeOverride(name = "containerId.associatedKey", column = @Column(name = "CONTAINER_ID_AK")) }) private AssetUpdateReserveIndex id; // Default JSON/JAXB constructor public AssetUpdateReserve() { } } According to this I should have a primary key with four attributes. However, the same name in the associatedKey makes one of the attributes to be overwritten (in this particular case, CONTAINER_ID_AK overwrites PARTITION_AD_AK) That makes my primary key have only three fields. I've tried to comment the last @AttributeOverride, this fixes the problem and the table has the PARTITION_ID_AK column. However, I can't just dismiss the CONTAINER_ID_AK. My other entities: AssetSliceId @Embeddable public class AssetSliceId implements Serializable { private static final long serialVersionUID = 9065665917069565503L; public static final int MAX_VALUE = Integer.MAX_VALUE; @Column(name = "ASSET_SLICE_ID") private Integer assetSliceId; @Column(name = "ID_AK") private String associatedKey; public AssetSliceId() { super(); } } AssetUpdateReserveIndex: @Embeddable public class AssetUpdateReserveIndex implements Serializable { private static final long serialVersionUID = 1349614023445826884L; @Embed…
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/27538242
tagged with: jpa
downvote count: 0
score: 4
answer count: 3
has title: Overwritten field when persisting with JPA
tagged with: eclipselink

http://stackoverflow.com/q/24515803
has title: Ljava.lang.StackTraceElement debug android app
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-volley
tagged with: android
has body: I'm trying to debug my app to see where it stops running, but I'm confused with the following log "Ljava.lang.StackTraceElement;@42088f90" I don't know what it means or where it's coming from. 07-01 13:55:30.957 11534-11534/com.rep I/RM﹕ construct 07-01 13:55:30.957 11534-11534/com.rep I/RM﹕ onPreExecute 07-01 13:55:30.961 11534-12159/com.rep I/RM﹕ doInBackground 07-01 13:55:30.961 11534-12159/com.rep I/RM﹕ URL DE CONSULTA: http://192.168.1.1/rep/api/clientes 01 13:55:30.962 11534-12159/com.rep I/RM﹕ [Ljava.lang.StackTraceElement;@42088f90 This is the code: package com.rep.webservice.rest; import android.content.Context; import android.util.Log; import com.rep.model.ClienteModel; import com.rep.webservice.Servidor; import com.rep.webservice.volley.AuthFailureError; import com.rep.webservice.volley.Request; import com.rep.webservice.volley.RequestQueue; import com.rep.webservice.volley.Response; import com.rep.webservice.volley.VolleyError; import com.rep.webservice.volley.toolbox.JsonObjectRequest; import com.rep.webservice.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONObject; import java.io.PrintWriter; import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import static java.lang.String.valueOf; public class ClientesRest extends Servidor { private String recursoRest = "clientes"; private List arrayClientes; private RequestQueue mRequestQueue; private Context context; public ClientesRest(Context ctx) { this.context = ctx; } public final List getClientes() { String url = this.URL_WS + recursoRest; Log.i("RM", "URL DE CONSULTA: " + url); mRequestQueue = Volley.newRequestQueue(this.context); JsonObjectRequest mJsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { parseJSON(response); Log.i("RM", "resposta da api: " + response.toString()); } }, new Response…
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24515923
accepted answer: http://stackoverflow.com/a/24515923
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/37956907

http://stackoverflow.com/comment/37841778
comment on: http://stackoverflow.com/q/24441210
score: 0
type: Comment
type: QuestionComment
has text: Created an [Issue](http://jira.codehaus.org/browse/SUREFIRE-1083http://jira.codehaus.org/browse/SUREFIRE-1083) for that. To solve your problem define a property for the maven-surefire-plugin which is named differently in the meantime.

http://stackoverflow.com/a/24487524
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24487391
has body: The concurrencyLevel is just a hint, to help size internal data structures. There's no guarantee 1 would be the actual value used, and rather than behaving as a regular HashMap it may mean it would be less efficient to use if you actually used it from more than 1 thread. From the Javadoc: Using a significantly higher value than you need can waste space and time, and a significantly lower value can lead to thread contention.
score: 2
downvote count: 0

http://stackoverflow.com/comment/37804999
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24433289
type: Comment
has text: `String.hashCode` is optimized for arbitrary `String`s, preferably human readable text. It’s not optimized for `String`s using at max 12 different characters out of the 65536 possible. Just because it is difficult to *see* the flaws does not mean it’s a better solution. Your solution is just hiding what’s going on.

http://stackoverflow.com/comment/38034814
score: 0
has text: I went with this. I created them as static variables and made a wrapper function `log(Exception)` and `log(String)` (with a `pw.append` to add my own messages) for development/debug that either sends it to System.out or this depending on if I'm running it on local JVM or on the database JVM. I later had to capture the debugging messages of an external API done over System.out, but I had no access to the code to do what you suggested, so I had to use something similar to http://stackoverflow.com/questions/8708342/redirect-console-output-to-string-in-java .
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24434966

weblogic
tags question: http://stackoverflow.com/q/24428824
tags question: http://stackoverflow.com/q/24550026
tags question: http://stackoverflow.com/q/24573950
tags question: http://stackoverflow.com/q/24539959
tags question: http://stackoverflow.com/q/24514240
tags question: http://stackoverflow.com/q/24453449
tags question: http://stackoverflow.com/q/24562469
tags question: http://stackoverflow.com/q/24496770
tags question: http://stackoverflow.com/q/24464530
tags question: http://stackoverflow.com/q/24455263
tags question: http://stackoverflow.com/q/24488074
tags question: http://stackoverflow.com/q/24451930
tags question: http://stackoverflow.com/q/24580794
tag name: weblogic
tags question: http://stackoverflow.com/q/24433202
tags question: http://stackoverflow.com/q/24441096
type: Tag
tags question: http://stackoverflow.com/q/24498317
tags question: http://stackoverflow.com/q/24578438

http://stackoverflow.com/comment/38024025
comment on: http://stackoverflow.com/a/24551963
type: AnswerComment
score: 0
type: Comment
has text: Let inform me, you will get the answer

http://stackoverflow.com/a/24576988
has comment: http://stackoverflow.com/comment/38071558
type: Answer
has comment: http://stackoverflow.com/comment/38071625
score: 3
has body: You can get the stack trace of the current thread and parse the StackTraceElements in the return, to find out which methods are calling yours. You can check out this question here in SO.
upvote count: 3
has comment: http://stackoverflow.com/comment/38071704
downvote count: 0
answers question: http://stackoverflow.com/q/24576945

http://stackoverflow.com/comment/38026938
type: AnswerComment
score: 0
type: Comment
has text: @AngryOliver because via `List<Fruit>` you would be able to add to list of Apples also Banana and this time no exception would occur while trying to put this incorrect element into list, because list in reality is backed up by array of Object which would accept any kind of elements.
comment on: http://stackoverflow.com/a/24530643

http://stackoverflow.com/q/24558456
has body: I want to check if all elements of two sets of String are equal by ignoring the letter's cases. Set&lt;String&gt; set1 ; Set&lt;String&gt; set2 ; . . . if(set1.equals(set2)){ //all elements of set1 are equal to set2 //dosomething } else{ //do something else } However, this equality check doesn't ignore the cases of the string. Is there some other way of doing that?
has answer: http://stackoverflow.com/a/24558646
has answer: http://stackoverflow.com/a/24558663
has title: Java Set<String> equality ignore case
linked to: http://stackoverflow.com/q/12214576
tagged with: java
possible better answer: http://stackoverflow.com/a/24558646
tagged with: set
has answer: http://stackoverflow.com/a/24558837
has answer: http://stackoverflow.com/a/24558563
type: Question
type: AnsweredQuestion
upvote count: 37
has answer: http://stackoverflow.com/a/24558633
accepted answer: http://stackoverflow.com/a/24558837
answer count: 6
has comment: http://stackoverflow.com/comment/38036687
tagged with: ignore-case
score: 37
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24558652

http://stackoverflow.com/q/24493900
tagged with: java
tagged with: http
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/24494276
score: 0
has title: By default JMS is using HTTP?
answer count: 1
tagged with: jms
type: UnansweredQuestion
tagged with: soap
has body: For example I have a simple application and going to use JMS in order another application can take information from jms channel. By default, when I publish a message to JMS I use HTTP protocol - is it true? ( for example in java-ee examples ) I have heard it is popular to use SOAP over JMS? What are real benefits ?but why over? if soap it is transport protocol and not jms. jms is just a specification. Please help me to clarify.

http://stackoverflow.com/comment/38076521
type: AnswerComment
type: Comment
has text: the question is about comparing `Set<String>`, while you're referring to a method of `String`. These are not interchangeable, but I guess you could turn it into a proper answer by adding a loop around.
score: 3
comment on: http://stackoverflow.com/a/24558563

http://stackoverflow.com/q/24532685
tagged with: dependencies
has answer: http://stackoverflow.com/a/24538678
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24538678
type: Question
has title: Add a project to a plugin
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37990731
answer count: 1
linked to: http://stackoverflow.com/q/2869693
has comment: http://stackoverflow.com/comment/37990070
has body: I have a ordinary java project (P1). The project uses another java project (P2) which is added to the build path of P1. I create this dependency as I need to change both projects. I want if I change P2 then see changes in P1. I recently convert my project as a plugin. However, when I run the program it can not find the second project, and shows NoClassDefFoundError compiler error while from class path file I can see the project is added in class path. classpathentry combineaccessrules="false" kind="src" path="/P2"/ I know how to create a jar file from P2 and add that to the plugin (it can solve my problem), but I do not know how to add another eclipse project (as source code) to a plugin. As I said I want to change P2 as well and it is difficult to create a jar file from P2 after each change and add that to the plugin. Please let me know how can I add a source project to a plugin. Is it possible to do that? I also read this page, but could not help me.
tagged with: plugins

http://stackoverflow.com/comment/37989694
score: 0
type: Comment
type: QuestionComment
has text: How manage resource closing in `finally` block?
comment on: http://stackoverflow.com/q/24533419

http://stackoverflow.com/comment/38057009
has text: You missed "Lenovo" *flies away*
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24569326

http://stackoverflow.com/comment/37877561
score: 0
comment on: http://stackoverflow.com/q/24472935
type: Comment
type: QuestionComment
has text: How do they limit the JTextField? You've got their source code.

http://stackoverflow.com/a/24497658
has comment: http://stackoverflow.com/comment/42766735
accepted answer of: http://stackoverflow.com/q/24451124
type: Answer
answers question: http://stackoverflow.com/q/24451124
downvote count: 0
has comment: http://stackoverflow.com/comment/41142517
score: 9
has comment: http://stackoverflow.com/comment/37936058
type: AcceptedAnswer
has body: The easiest way to work with Cassandra and Spark is to use the official open source Cassandra driver for Spark developed by DataStax: https://github.com/datastax/spark-cassandra-connector This driver has been built on top of Cassandra Java Driver and provides a direct bridge between Cassandra and Spark. Unlike Calliope, it does not use the Hadoop interface. Additionally it offers the following unique features: support for all Cassandra data types, including collections, out of the box lightweight mapping of Cassandra rows to custom classes or tuples without the need to use any implicits or other advanced features in Scala saving any RDDs to Cassandra full support for Cassandra Virtual Nodes ability to filter / select on the server side, e.g. leveraging Cassandra clustering columns or secondary indexes
upvote count: 9

http://stackoverflow.com/q/24493333
tagged with: tomcat
score: 0
has title: Is it possible (or sane) to use an alternate dependency style for tomcat application deploys?
answer count: 1
tagged with: deployment
has answer: http://stackoverflow.com/a/24493382
accepted answer: http://stackoverflow.com/a/24493382
type: AnsweredQuestion
tagged with: java
type: Question
has body: We have an application that apparently has a lot of dependencies. It's a 150MB WAR file when packaged with all the dependencies. However, our application code only accounts for about 8MB of this. In the idea of trimming the time it takes to do a redeploy I was thinking that potentially we could have a "dependencies" something or another (I'm not terribly familiar with Java) that is a 142 MB WAR, and then our application that's actually just the 8MB and then we only have to redeploy that. Is this possible? If so, is it recommended? If not, why not?

http://stackoverflow.com/comment/37827699
has text: fixed it!I put my problem in brackets to be more comprehensive
type: Comment
comment on: http://stackoverflow.com/q/24445840
type: QuestionComment
score: 0

http://stackoverflow.com/a/59111836
type: Answer
answers question: http://stackoverflow.com/q/24541786
downvote count: 0
has body: Debugging using IDE's are always-helpful, but the ideal way of debugging through each elements in a stream is to use peek() before a terminal method operation since Java Steams are lazily evaluated, so unless a terminal method is invoked, the respective stream will not be evaluated. List&lt;Integer&gt; numFromZeroToTen = Arrays.asList(1,2,3,4,5,6,7,8,9,10); numFromZeroToTen.stream() .map(n -&gt; n * 2) .peek(n -&gt; System.out.println(n)) .collect(Collectors.toList());
score: 1
upvote count: 1

http://stackoverflow.com/comment/37802178
score: 0
has text: Is the MainCaller also a Spring Bean? If so, how do you instantiate it?
type: QuestionComment
comment on: http://stackoverflow.com/q/24432346
type: Comment

http://stackoverflow.com/a/36007392
type: Answer
has body: Without any plugins: You just need to enable highlight: (Idea v.2016, 2017 and 2018, previous versions may have same or similar settings) File -&gt; Settings -&gt; Editor -&gt; Inspections -&gt; Java -&gt; Serialization issues -&gt; Serializable class without 'serialVersionUID' - set flag and click 'OK'. (For Macs, Settings is under IntelliJ IDEA -&gt; Preferences...) For Idea v. 2022.1 (Community and Ultimate) it's on: File -&gt; Settings -&gt; Editor -&gt; Inspections -&gt; JVM Languages -&gt; Serializable class without 'serialVersionUID' - set flag and click 'OK' Now, if your class implements Serializable, you will see highlight and alt+Enter on class name will ask you to generate private static final long serialVersionUID. UPD: a faster way to find this setting - you might use hotkey Ctrl+Shift+A (find action), type Serializable class without 'serialVersionUID' - the first is the one.
has comment: http://stackoverflow.com/comment/78133371
has comment: http://stackoverflow.com/comment/80487031
has comment: http://stackoverflow.com/comment/133365739
downvote count: 1
has comment: http://stackoverflow.com/comment/80546886
has comment: http://stackoverflow.com/comment/136929461
score: 517
accepted answer of: http://stackoverflow.com/q/24573643
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24573643
upvote count: 518

http://stackoverflow.com/a/24554404
downvote count: 0
type: Answer
score: 6
upvote count: 6
accepted answer of: http://stackoverflow.com/q/24554241
answers question: http://stackoverflow.com/q/24554241
has body: I think you've misunderstood the purpose of setFirstDayOfWeek. That doesn't change c.get(Calendar.DAY_OF_WEEK) works at all - it changes the result of calling c.get(Calendar.WEEK_OF_MONTH) and c.get(Calendar.WEEK_OF_YEAR), as per the documentation: When setting or getting the WEEK_OF_MONTH or WEEK_OF_YEAR fields, Calendar must determine the first week of the month or year as a reference point. The first week of a month or year is defined as the earliest seven day period beginning on getFirstDayOfWeek() and containing at least getMinimalDaysInFirstWeek() days of that month or year. In other words, Sunday is always Sunday... but whether Sunday June 10th is in the same week as Monday June 11th or not depends on what is considered to be the first day of the week.
type: AcceptedAnswer

jtextpane
tags question: http://stackoverflow.com/q/24524881
tag name: jtextpane
type: Tag
tags question: http://stackoverflow.com/q/24532080
tags question: http://stackoverflow.com/q/24578741
tags question: http://stackoverflow.com/q/24503954
tags question: http://stackoverflow.com/q/24446042

http://stackoverflow.com/comment/37842456
comment on: http://stackoverflow.com/q/24454164
score: 0
type: Comment
type: QuestionComment
has text: @TAsk basically it sends a xml string to link and get response from that

http://stackoverflow.com/comment/38112036
score: 0
type: Comment
has text: @EricB. I have just updated an answer, it should now work with any JPA provider.
type: AnswerComment
comment on: http://stackoverflow.com/a/24570357

http://stackoverflow.com/q/24565031
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38048991
upvote count: 1
tagged with: switch-statement
has body: I've got JDK7 and switches with strings work on my development machine. My questions is, would the app breakdown on some users' systems? In other words, is it safe to use them at will? I am aware I could be confusing the JDK with the VM but please forgive my ignorance.
type: Question
linked to: http://stackoverflow.com/q/14367629
has title: Is it safe to use Switch statements with strings
has comment: http://stackoverflow.com/comment/38049446
downvote count: 0
answer count: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/24565101
favorite count: 0
has comment: http://stackoverflow.com/comment/38049153
tagged with: android
has answer: http://stackoverflow.com/a/24565101
type: AnsweredQuestion

http://stackoverflow.com/q/24505857
has comment: http://stackoverflow.com/comment/37938810
has body: This is my second day with java, and I can't figure out why public variable is 0 within private method. Code is as follows: public class SomeClass { public int[][] gridArray; private int N; public methodOne(int N){ gridArray = new int[N][N]; } private boolean isValid(int i, int j){ if (i &lt; 0 || i &gt; N || j &lt; 0 || j &gt; N){ StdOut.println(i + " and " + j + " and "+ N); throw new java.lang.IndexOutOfBoundsException(); } else{return true;} } public static void main(String[] args) { int N = 5; // some code for getting indices } So, I create an array, and input indices, and check is this indices are valid, or the are out of bounds. I always get exception, because within isValid method N is 0, despite declaration in main.
favorite count: 0
tagged with: private-methods
downvote count: 2
has comment: http://stackoverflow.com/comment/37939741
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37939693
has title: Java public variable is zero in private class
possible better answer: http://stackoverflow.com/a/24506011
has answer: http://stackoverflow.com/a/24505893
tagged with: java
has answer: http://stackoverflow.com/a/24506020
has answer: http://stackoverflow.com/a/24506011
has comment: http://stackoverflow.com/comment/37938780
type: Question
upvote count: 0
score: -2
linked to: http://stackoverflow.com/q/241088
accepted answer: http://stackoverflow.com/a/24505893
answer count: 3
tagged with: public-method
has comment: http://stackoverflow.com/comment/37938748

fork-join
tags question: http://stackoverflow.com/q/24485708
tag name: fork-join
type: Tag

http://stackoverflow.com/comment/38036389
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24558120
has text: What do you mean, it works when you remove that line? Does it terminate, or does it find a correct solution? Are you sure that it's nor just terribly slow?

http://stackoverflow.com/a/24602307
has comment: http://stackoverflow.com/comment/38121034
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38120782
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24568735
has comment: http://stackoverflow.com/comment/38121030
answers question: http://stackoverflow.com/q/24568735
has comment: http://stackoverflow.com/comment/38121698
type: Answer
has comment: http://stackoverflow.com/comment/38121260
has comment: http://stackoverflow.com/comment/38121515
has comment: http://stackoverflow.com/comment/38121229
has comment: http://stackoverflow.com/comment/38121083
upvote count: 12
score: 12
has body: Below, there's a simple working prototype to generate json from a string instance. Use this code snippet to update your client part. And it should work. import java.util.Base64; public class Test { public static void main(String[] args) { StringBuilder sb = new StringBuilder(); // composing string to be encoded sb.append("Part 1 of some text to be encoded to base64 format\n"); sb.append("Part 2 of some text to be encoded to base64 format\n"); sb.append("Part 3 of some text to be encoded to base64 format"); // getting base64 encoded string bytes byte[] bytesEncoded = Base64.getEncoder().encode(sb.toString().getBytes()); // composing json String json = "{\"serialDataByte\":\""+ new String(bytesEncoded) +"\"}"; System.out.println(json); } } UPDATE: The code uses Java 8 SDK. If you are using pre-Java8 version, then consider Apache Commons Codec for this task. Below there's a sample code, that uses Apache Commons Codec for Base64 encoding (please note that import directive has been changed): import org.apache.commons.codec.binary.Base64; public class Test { public static void main(String[] args) { StringBuilder sb = new StringBuilder(); // composing string to be encoded sb.append("Part 1 of some text to be encoded to base64 format\n"); sb.append("Part 2 of some text to be encoded to base64 format\n"); sb.append("Part 3 of some text to be encoded to base64 format"); // getting base64 encoded string bytes byte[] bytesEncoded = Base64.encodeBase64(sb.toString().getBytes()); // composing json String json = "{\"serialDataByte\":\""+ new String(bytesEncoded) +"\"}"; System.out.println(json); } } UPDATE 2: Upon sending POST requests make sure that you have marked your request as a POST request. Do not forget this line of code, before making the request: connection.setRequestMethod("POST"); and use HttpURLConnection instead of URLConnection: import java.net.HttpURLConnection;
has comment: http://stackoverflow.com/comment/38121666
has comment: http://stackoverflow.com/comment/38121680
has comment: http://stackoverflow.com/comment/38121399

http://stackoverflow.com/comment/37881724
comment on: http://stackoverflow.com/a/24475057
type: Comment
score: 1
type: AnswerComment
has text: it makes sense now i didnt know it is implemented as doubly linkedlist in java thanks mate

http://stackoverflow.com/a/24451275
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/37838801
answers question: http://stackoverflow.com/q/24451052
type: Answer
has comment: http://stackoverflow.com/comment/38576960
has body: this example use an executor with 10 threads... the idea is to submit your tasks and the executor will handle the threads for you. public class Test { private final Executor executor= Executors.newFixedThreadPool(10); public void executeTask(Runnable task){ executor.execute(task); } public static void main(String[] args) { Test test= new Test(); for(int i=0;i&lt;100;i++){ final int iteration=i; Runnable task=(new Runnable() { public void run() {System.out.println("Executing task "+iteration); }}); test.executeTask(task); } } }
upvote count: 1

http://stackoverflow.com/comment/37909826
score: 0
comment on: http://stackoverflow.com/q/24485147
type: Comment
type: QuestionComment
has text: can you please help Deinum...How to use that ? @Deinum

http://stackoverflow.com/comment/37923958
type: Comment
type: AnswerComment
has text: @richs A volatile write is visible to other threads however the order matters, as does the reads. I have updated my answer.
comment on: http://stackoverflow.com/a/24496540
score: 0

http://stackoverflow.com/comment/37802684
score: 0
comment on: http://stackoverflow.com/q/24432568
type: Comment
type: QuestionComment
has text: Check out this: http://stackoverflow.com/questions/4604239/install-application-programmatically-on-android Does it help?

spring-webflow
tags question: http://stackoverflow.com/q/24544242
type: Tag
tag name: spring-webflow

http://stackoverflow.com/q/24571939
has comment: http://stackoverflow.com/comment/38061891
has comment: http://stackoverflow.com/comment/38069611
type: Question
has comment: http://stackoverflow.com/comment/38061984
has comment: http://stackoverflow.com/comment/38061774
has title: better way to interrupt thread Java
has comment: http://stackoverflow.com/comment/38062080
has body: I have written a class in Java: public class Main { public static boolean firstRunning = true; public static void main(String[] args) { (new Thread(){ public void run(){ secondFunction(); } }).start(); firstFunction(); } public static void firstFunction() { for(int i = 0; i &lt; 10 &amp;&amp; firstRunning; i++) { try{Thread.sleep(1000);} catch(Exception e){} System.out.println("first - "+i); } return; } public static void secondFunction(){ try{Thread.sleep(3000);} catch(Exception e){} firstRunning = false; for(int i = 0; i &lt; 10; i++) { try{Thread.sleep(700);} catch(Exception e){} System.out.println("second - "+i); } } } I am calling the secondFuntion() in a new Thread after which I begin the execution of firstFuntion() in the Main Thread. After the execution of the Thread.sleep(3000) in the secondFuntion(), I want to make secondFunction() take over the Main Thread, for which I set the boolean flag firstRunning to false and cancel the execution of the Main Thread using the return statement. This approach works for me, but is there a more elegant way of doing the same? EDIT The output of the code is first - 0 first - 1 first - 2 second - 0 second - 1 second - 2 second - 3 second - 4 second - 5 second - 6 second - 7 second - 8 second - 9
has answer: http://stackoverflow.com/a/24572231
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24572754
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24572754
accepted answer: http://stackoverflow.com/a/24572231
linked to: http://stackoverflow.com/q/1036754
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38062146
has comment: http://stackoverflow.com/comment/38062038
downvote count: 0
has answer: http://stackoverflow.com/a/24573955
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38061816

http://stackoverflow.com/comment/38075658
has text: @user3649938 Please accept is as an answer then by clicking on the tick. :)
comment on: http://stackoverflow.com/a/24577284
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37889436
type: QuestionComment
has text: I remove @Controller and now it crash on line 31 - "Role role = roleManager.findById(1);" There is error: http://pastebin.com/YPCfA2D0
score: 0
comment on: http://stackoverflow.com/q/24476122
type: Comment

http://stackoverflow.com/q/24581910
accepted answer: http://stackoverflow.com/a/24581920
upvote count: 0
score: -2
has body: this is an android program I write for fun, but I am confused why the text view display the address of the string name instead of that string. the program is pretty easy, take a string by edittext from user and set it as textview. public class MainActivity extends Activity { Button b1,b2; TextView tv1,tv2,tv3; EditText et1,et2,et3; CheckBox cb1,cb2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b1=(Button)findViewById(R.id.button1); b2=(Button)findViewById(R.id.button2); et1=(EditText)findViewById(R.id.editText1); et2=(EditText)findViewById(R.id.editText2); et3=(EditText)findViewById(R.id.editText3); tv1=(TextView)findViewById(R.id.textView1); tv2=(TextView)findViewById(R.id.textView2); tv3=(TextView)findViewById(R.id.textView3); cb1=(CheckBox)findViewById(R.id.checkBox1); cb2=(CheckBox)findViewById(R.id.checkBox2); b1.setOnClickListener(new onclick()); b2.setOnClickListener(new onclick()); } class onclick implements OnClickListener{ public void onClick(View v){ if(v==b1){ String name=et1.getContext().toString(); /************mark********/ tv1.setText(" "+name); } else if(v==b2){ enter code here Intent myintent=new Intent(); myintent.setClass(MainActivity.this, Other.class); MainActivity.this.startActivity(myintent); } } }}
answer count: 2
favorite count: 0
downvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/24581920
has title: why it display the address of the string instead of the string
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24582298
tagged with: java
possible better answer: http://stackoverflow.com/a/24582298
type: Question

spring-mvc
tags question: http://stackoverflow.com/q/24503442
tags question: http://stackoverflow.com/q/24432828
tags question: http://stackoverflow.com/q/24566706
tags question: http://stackoverflow.com/q/24559007
tags question: http://stackoverflow.com/q/24547766
tags question: http://stackoverflow.com/q/24569213
tags question: http://stackoverflow.com/q/24544242
tags question: http://stackoverflow.com/q/24584380
tags question: http://stackoverflow.com/q/24553076
tags question: http://stackoverflow.com/q/24490357
tags question: http://stackoverflow.com/q/24497229
tags question: http://stackoverflow.com/q/24490506
tags question: http://stackoverflow.com/q/24488528
tags question: http://stackoverflow.com/q/24554255
tags question: http://stackoverflow.com/q/24431540
tags question: http://stackoverflow.com/q/24574935
tags question: http://stackoverflow.com/q/24448686
tags question: http://stackoverflow.com/q/24488888
tags question: http://stackoverflow.com/q/24510150
tags question: http://stackoverflow.com/q/24560635
tags question: http://stackoverflow.com/q/24511380
tags question: http://stackoverflow.com/q/24523279
tags question: http://stackoverflow.com/q/24540102
tags question: http://stackoverflow.com/q/24569287
tags question: http://stackoverflow.com/q/24475549
tags question: http://stackoverflow.com/q/24586653
tags question: http://stackoverflow.com/q/24471935
tags question: http://stackoverflow.com/q/24544699
tags question: http://stackoverflow.com/q/24576484
tags question: http://stackoverflow.com/q/24577458
tags question: http://stackoverflow.com/q/24506667
tags question: http://stackoverflow.com/q/24510145
tags question: http://stackoverflow.com/q/24546396
tags question: http://stackoverflow.com/q/24551650
tags question: http://stackoverflow.com/q/24554770
tags question: http://stackoverflow.com/q/24498662
tags question: http://stackoverflow.com/q/24534908
tags question: http://stackoverflow.com/q/24486751
tags question: http://stackoverflow.com/q/24498010
tags question: http://stackoverflow.com/q/24529251
tags question: http://stackoverflow.com/q/24457628
tags question: http://stackoverflow.com/q/24447468
tags question: http://stackoverflow.com/q/24560417
tags question: http://stackoverflow.com/q/24580383
tag name: spring-mvc
tags question: http://stackoverflow.com/q/24582747
tags question: http://stackoverflow.com/q/24582842
tags question: http://stackoverflow.com/q/24556976
tags question: http://stackoverflow.com/q/24495742
tags question: http://stackoverflow.com/q/24530603
tags question: http://stackoverflow.com/q/24528193
tags question: http://stackoverflow.com/q/24478326
tags question: http://stackoverflow.com/q/24551412
tags question: http://stackoverflow.com/q/24549971
tags question: http://stackoverflow.com/q/24432346
tags question: http://stackoverflow.com/q/24515853
tags question: http://stackoverflow.com/q/24567553
tags question: http://stackoverflow.com/q/24501590
type: Tag
tags question: http://stackoverflow.com/q/24457780
tags question: http://stackoverflow.com/q/24556102
tags question: http://stackoverflow.com/q/24550641
tags question: http://stackoverflow.com/q/24535164
tags question: http://stackoverflow.com/q/24549514
tags question: http://stackoverflow.com/q/24468340
tags question: http://stackoverflow.com/q/24428162
tags question: http://stackoverflow.com/q/24520602
tags question: http://stackoverflow.com/q/24571215
tags question: http://stackoverflow.com/q/24577091
tags question: http://stackoverflow.com/q/24449074
tags question: http://stackoverflow.com/q/24528515
tags question: http://stackoverflow.com/q/24475118
tags question: http://stackoverflow.com/q/24493702
tags question: http://stackoverflow.com/q/24569786
tags question: http://stackoverflow.com/q/24470884
tags question: http://stackoverflow.com/q/24430033
tags question: http://stackoverflow.com/q/24552899
tags question: http://stackoverflow.com/q/24491328
tags question: http://stackoverflow.com/q/24536480
tags question: http://stackoverflow.com/q/24534298

http://stackoverflow.com/q/24553900
tagged with: character-encoding
type: Question
tagged with: encoding
answer count: 1
has comment: http://stackoverflow.com/comment/38347168
score: 0
has title: Java | Duplicate characters on Windows 8 CMD UTF-8 encoding
tagged with: utf-8
tagged with: cmd
type: UnansweredQuestion
has body: I was trying to make cmd display UTF-8 encoded texts and I was finally able to do that. I wrote a class containing the following code in order to make java write characters encoded in UTF-8: String text = "çşğüöıÇŞĞÜÖİ UTF-8 (65001)"; System.setOut(new PrintStream(System.out, true, "utf8")); System.out.println(text); In command line, I entered the command chcp 65001 before running the class, in order to change the encoding setting of commandline. Anyway, after doing all these stuff I was finally able to print UTF-8 encoded characters. But I had a problem: The output was supposed to look like this çşğüöıÇŞĞÜÖİ UTF-8 (65001) Instead the output was as follows: çşğüöıÇŞĞÜÖİ UTF-8 (65001)TF-8 (65001) It duplicates some of the characters and I couldn't figure out why.
has answer: http://stackoverflow.com/a/24771968
tagged with: java

http://stackoverflow.com/comment/38076243
has text: @pravi you are welcome, here is another solution which may work for you UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
comment on: http://stackoverflow.com/a/24569118
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/24547657
tagged with: kotlin
has comment: http://stackoverflow.com/comment/38018498
score: 0
has comment: http://stackoverflow.com/comment/38016586
accepted answer: http://stackoverflow.com/a/24779961
answer count: 1
favorite count: 0
has body: I'm looking for documents about access modifiers in Kotlin. But its unfound. I want to know and check access modifier for package function and difference protected modifier in Kotlin and in Java. [edited] I'm looking for public document by Jetbrians. I found thread about access modifier. http://devnet.jetbrains.com/thread/451236?tstart=0
type: AnsweredQuestion
has title: Are there any documents about access modifiers in Kotlin?
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24779961
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/38017134
has comment: http://stackoverflow.com/comment/38017347

http://stackoverflow.com/q/24527022
has comment: http://stackoverflow.com/comment/37977587
upvote count: 0
score: -2
has body: Sorry if this question is not clear. I have very limited knowledge about hashmap. This was the question which was asked to me in the interview. If all objects return same hascode and If we use those objects as key to store in hashmap. How sorting works in this case? My understanding was if hashcode are same then new entry will replace the old entry in the hashmap. But when i searched to understand more about how hashmap works if the two objects hashcode is same, i foudn that both objects will be stored in the linked list form in the bucket. But its not clear how sorting will work in this case. If we try to sort this hashpMap using TreeMap. Please help me to understand this. Below code stores more than one entry in the hashmap where all the objects hashcode is same. import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class Employee implements Comparable { private String name; private int age; public Employee(String name, int age) { this.name = name; this.age = age; } @Override public String toString() { return name + ": " + age; } @Override public int hashCode(){ return 1; } @Override public boolean equals(Object o){ if (!(o instanceof Employee)) return false; Employee e = (Employee) o; return e.getName().equals(name) &amp;&amp; e.getAge() == age; } String getName() { return name; } int getAge() { return age; } public static void main(String a[]){ Employee e = new Employee("Sub" , 25); Employee e1 = new Employee("Sub1" , 20); Employee e2 = new Employee("Sub2" , 22); System.out.println(e); Map m = new HashMap(); m.put(e , "A"); m.put(e1 , "B"); m.put(e2 , "C"); System.out.println(m); TreeMap t = new TreeMap(m); System.out.println(t); } @Override public int compareTo(Object arg0) { return ((Employee)arg0).getName().compareTo(this.name); } }
has title: How HashMap Sorting work if all the key's hashcode is same
answer count: 3
has comment: http://stackoverflow.com/comment/37977550
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/35602164
tagged with: java
has answer: http://stackoverflow.com/a/24527262
has answer: http://stackoverflow.com/a/24527128
type: Question
tagged with: hashmap

http://stackoverflow.com/comment/37807208
type: Comment
has text: Not sure what you mean by in implementation. `son` is now a reference of type `Father`. You can call any method that is valid for father, but the actual object in memory is a `Son`.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24434893

http://stackoverflow.com/comment/37973202
has text: You can definitely avoid regex here. Use string methods.
comment on: http://stackoverflow.com/q/24524548
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37970791
score: 0
has text: This is a simple polymorphism question. Any book on Java can explain it. Or just search around Google.
comment on: http://stackoverflow.com/q/24523342
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24474905
has answer: http://stackoverflow.com/a/24474956
linked to: http://stackoverflow.com/q/21215914
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
tagged with: do-while
answer count: 2
linked to: http://stackoverflow.com/q/24475590
score: 0
accepted answer: http://stackoverflow.com/a/24474984
tagged with: while-loop
has answer: http://stackoverflow.com/a/24474984
possible better answer: http://stackoverflow.com/a/24474956
has title: Java SE do while loop issues
has body: I have a problem with my java application when i compile my codes it says that it cannot find symbol roomLength. what the application supposed to do is prompt the user to input a room name then if it is "quit" then it has to close the program. otherwise it will prompt for the length, width and height of the room. if any of these dimensions is zero or lesser, it will reprompt for the dimensions again. class Room { private String name; private double length; private double width; private double height; public Room(String r, double l, double w, double h) { name = r; length = l; width = w; height = h; } public String getName() { return name; } public double getLength() { return length; } public double getWidth() { return width; } public double getHeight() { return height; } public double getArea() { double area = length*width; return area; } public double getVolume() { double volume = length*width*height; return volume; } public void setName(String s) { name = s; } } And here's my main method. import java.util.Scanner; class TestRoom { public static void main(String [] args) { Scanner userInput = new Scanner(System.in); System.out.println("Please enter the name of room"); String roomName = userInput.next(); if(roomName.equals("quit")) { userInput.close(); } else { do { Scanner dimensionsInput = new Scanner(System.in); System.out.print("Please enter the dimensions of the room, length, width and height accordingly"); double roomLength = dimensionsInput.nextDouble(); double roomWidth = dimensionsInput.nextDouble(); double roomHeight = dimensionsInput.nextDouble(); Room r = new Room(roomName, roomLength, roomWidth, roomHeight); } while (roomLength &gt; 0 || roomWidth &gt; 0 || roomHeight &gt; 0); System.out.println("The name of room: " + r.getName() + " Dimensions: L= " + r.getLength() + "X " + "W= " + r.getWidth() + "X " + "H= " + r.getHeight()); System.out.println("Area of room= " + r.getArea()); System.out.println("Volume of room= " + r.getVolume()); } } } Thanks in adva…

http://stackoverflow.com/comment/37983734
score: 0
type: Comment
type: QuestionComment
has text: If so, what's the difference between that and `List<T>`?
comment on: http://stackoverflow.com/q/24530393

http://stackoverflow.com/q/24531396
answer count: 2
has comment: http://stackoverflow.com/comment/37985657
has comment: http://stackoverflow.com/comment/37986192
has comment: http://stackoverflow.com/comment/37985887
possible better answer: http://stackoverflow.com/a/24531639
tagged with: java
has comment: http://stackoverflow.com/comment/37986392
has answer: http://stackoverflow.com/a/24531639
accepted answer: http://stackoverflow.com/a/24532092
downvote count: 1
has body: Input file- 5 1 2 3 4 5 2 3 4 5 6 3 2 1 5 8 My work is i should read this input file my.txt and swap its first and last column and output it to another file comp.txt but I am getting a blank file comp.txt import java.io.BufferedReader; import java.io.FileReader; import java.io.PrintStream; import java.io.*; // to swap first and last column of 2D array public class Swap { private static BufferedReader in = null; private static int row = 0; private static int column = 0; private static int[][] matrix = null; public static void main(String[] args) throws Exception { try { // String filepath = args[0]; int lineNum = 0; int row = 0; in = new BufferedReader(new FileReader("my.txt")); String line = null; while ((line = in.readLine()) != null) { lineNum++; if (lineNum == 1) { column = Integer.parseInt(line); } else { String[] tokens = line.split(","); for (int j = 0; j &lt; tokens.length; j++) { if (j == 0) matrix[row][0] = Integer.parseInt(tokens[column]); else matrix[row][j] = Integer.parseInt(tokens[j]); } row++; } } } catch (Exception ex) { System.out.println("The code throws an exception"); System.out.println(ex.getMessage()); } finally { if (in != null) in.close(); } try { PrintStream output = new PrintStream(new File("comp.txt")); for (int i = 0; i &lt; row; i++) { for (int j = 0; j &lt; column; j++) { output.println(matrix[i][j] + " "); } } output.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } } Here is the output I am getting at console- The code throws an exception null Apart from this I am getting a blank comp.txt file
has comment: http://stackoverflow.com/comment/37986585
upvote count: 0
has comment: http://stackoverflow.com/comment/37987243
has comment: http://stackoverflow.com/comment/37985904
type: AnsweredQuestion
tagged with: swap
score: -1
tagged with: text-files
favorite count: 0
has comment: http://stackoverflow.com/comment/37988155
has answer: http://stackoverflow.com/a/24532092
has title: swap first and last column of a 2D array in a text file in java
tagged with: multidimensional-array
type: Question
has comment: http://stackoverflow.com/comment/37986104

http://stackoverflow.com/q/24522434
has answer: http://stackoverflow.com/a/24530758
tagged with: java
tagged with: jaxb
upvote count: 1
answer count: 1
tagged with: mule
accepted answer: http://stackoverflow.com/a/24530758
has body: I am a newbie at both JAXB and Mule. We have an application that would connect to various third parties, each providing their own XSDs to define message schemas. If I define different JAXBContext objects for each third party, I get "more than one JAXBContext registered" error. So I have one context with packageNames separated by a colon (e.g. "com.myorg.pack1:com.myorg.pack2:com.myorg.pack3") Now I am seeing namespaces getting generated in the messages even though the XSDs have element configured as unqualified. This only happens for the root node. Unfortunately, the 3rd party i am interacting with does not give a response if there's a namespace. Is there a way to not have the namespaces? Any pointers will be appreciated
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: JAXB + Mule. Avoid namespaces in XML transformations

http://stackoverflow.com/a/24524525
answers question: http://stackoverflow.com/q/24524371
type: Answer
has body: Only we can use Enums for the constant values which are in the single group. Let us suppose: Weeks, Months, Colours, Gender, Process states It is not the good idea to use single enum for storing all constants. Instead we can use one enum for each group of constants. Let us suppose you have maintaining some colour codes then better to have Colour enum instead of saving as constants.
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/24493051
linked to: http://stackoverflow.com/q/8819842
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37915746
downvote count: 1
has comment: http://stackoverflow.com/comment/37916118
tagged with: java
has body: I have following line of code: DecimalFormat df = new DecimalFormat("#.##"); System.out.println(df.format(23.00)); System.out.println(Double.parseDouble(df.format(23.00d))); System.out.println(df.parse("23.00").doubleValue()); First line print 23 but in 2nd and 3rd line when i convert it to double it prints 23.0 . showing 23.0 doesnt makes any sense. How can i get a double value 23. I checked these best-way-to-format-a-double-value-to-2-decimal-places how-to-nicely-format-floating-numbers-to-string-without-unnecessary-decimal-0
type: Question
score: 0
has answer: http://stackoverflow.com/a/24493161
has comment: http://stackoverflow.com/comment/37915733
has answer: http://stackoverflow.com/a/24493188
has comment: http://stackoverflow.com/comment/37915718
favorite count: 0
has comment: http://stackoverflow.com/comment/37915719
has title: Format double value?
answer count: 3
linked to: http://stackoverflow.com/q/703396
has answer: http://stackoverflow.com/a/24493150
has comment: http://stackoverflow.com/comment/37916390

http://stackoverflow.com/a/24436152
has comment: http://stackoverflow.com/comment/37817093
score: 3
has body: Well keep in mind its never a nice solution. You act like you would be on a command line so you execute Commands like you would on the shell. And does always depend on your platform. You said you don't want code, I will give it to you anyway ;) Runtime rt = Runtime.getRuntime(); Process pr = rt.exec("service nginx start"); That is done with plan java. I highly advise you to use a script language for that. Thats just not Java.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24435906
upvote count: 3
answers question: http://stackoverflow.com/q/24435906
type: Answer
has comment: http://stackoverflow.com/comment/37809411
downvote count: 0

http://stackoverflow.com/comment/37959482
type: AnswerComment
has text: So those zeros are part of your content? What about using MTOM to send your file? Maybe that could be a solution?
type: Comment
comment on: http://stackoverflow.com/a/24507383
score: 0

http://stackoverflow.com/a/24558049
upvote count: 1
has body: Sounds like you have an admin user, say asdf. You want to get to the Oracle DB with the admin credentials. This could be achieved using JNDI configured in Weblogic. In Weblogic console go to Services > Data Sources. Create a new generic data source, making sure to create a JNDI name () . Use default database driver. Fill in all needed connection information and test the database connectivity. On the look up replace the string argument with the JNDI name you provided in the console, i.e. dataSource = (javax.sql.DataSource) ctx.lookup("");.
downvote count: 0
answers question: http://stackoverflow.com/q/24520562
has comment: http://stackoverflow.com/comment/38073004
type: Answer
score: 1

http://stackoverflow.com/comment/37799577
comment on: http://stackoverflow.com/q/24429943
type: Comment
type: QuestionComment
has text: The application server itself is multithreaded, and the method Data_availability() *will* be called from multiple threads concurrently; if you have other requirements (f.e. if the deletion will take long enough to deplete the application server's thread pool, or if the application server has a had limit on the time spent in each thread) then it's a different matter.
score: 1

http://stackoverflow.com/q/24521130
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
upvote count: 1
has title: ZipEntry.isDirectory() and Enumeration<? extends ZipEntry> only see directory contents, not the directory
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24521188
tagged with: java
type: Question
has body: I'm working on looking through a .zip file to confirm that all the contained files are named correctly, and running into some trouble. Here's the file hierarchy: -.zip -dir -file1 -file2 -file3 -file4 -file5 -file6 Code: for (Enumeration&lt;? extends ZipEntry&gt; e = zf.entries(); e.hasMoreElements(); ) { ZipEntry entry = e.nextElement(); System.out.println("ZipEntry name: " + entry.getName()); ... } Usual output: ZipEntry name: dir/file1 ZipEntry name: dir/file2 ZipEntry name: dir/file3 ZipEntry name: file4 ZipEntry name: file5 ZipEntry name: file6 The desired output would also contain ZipEntry name: dir/ Strangely enough, I have one test case where I get the desired output: when using a .zip of identical hierarchy that was emailed to me. Whenever I use the .zips that I have compressed on my machine, I get the "Usual output." I'd really like to have consistent behavior, but I can't figure out what's going wrong. Any ideas? Thanks in advance!
answer count: 1
accepted answer: http://stackoverflow.com/a/24521188
downvote count: 0
score: 1

http://stackoverflow.com/q/24472916
has comment: http://stackoverflow.com/comment/37889103
has body: I have two tables which map relationship. There are WP_Post and WP_Term which are master data. There is WP_Term_Relationship which has relationship between WP_Post and WP_Term_Taxonomy Tabels. There is WP_Term_Taxonomy which has relationship between WP_Term_Relationship and WP_Term Tabels. I have two classes for Event(Post) and SchoolCategory(Term). Post has list of Term field. I am try to get all terms corresponding Post. But there are two relation tables in between so not able to map. public class Event { @Id @GeneratedValue private long id; @Column(name = "name") private String name; //need mapping here. private List&lt;SchoolCategory&gt; schoolCategories; } Any one have any idea. Could you please put your thoughts and views. I am using Hibernate Annotation.
answer count: 1
tagged with: hibernate-mapping
tagged with: hibernate-annotations
type: UnansweredQuestion
score: 0
has title: Two relationship tables between two mater tables
tagged with: orm
has answer: http://stackoverflow.com/a/24479092
type: Question
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/24459136
has answer: http://stackoverflow.com/a/39316815
accepted answer: http://stackoverflow.com/a/24459185
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24459196
has answer: http://stackoverflow.com/a/24459196
has body: On my android google map application I'm trying to calculate the average speed by taking the time (in milliseconds) and distance (in meters) and performing the next calculation on it: private double avgSpeed = 0; public void calcAvgSpeed(double distance, long time) { distance = distance / 1000; //1000 = km time = time / 3600000; // 1000 = sec, 60000 = min, 3600000 = hrs avgSpeed = (double) (distance / time); } to make sure it works i ran it with calcAvgSpeed(300, 30000); in which 300 is 300 meters and 30000 is 30000ms(or 30sec). Calculations I made say that avgSpeed should be 36 after the method. But when I print the result it says 'infinity' as if I'm dividing by zero.. Does anybody see if my method is wrong or why I get this weird answer?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37851715
tagged with: math
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37851739
has title: Average Speed Calculation returns 'infinity'
has answer: http://stackoverflow.com/a/24459185
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/37852097
favorite count: 0

http://stackoverflow.com/comment/37900390
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24484537
has text: I think this would be considered counting and we are not allowed to do that

http://stackoverflow.com/q/24579236
has answer: http://stackoverflow.com/a/37109876
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38076413
linked to: http://stackoverflow.com/q/23028989
has body: When I run "mvn dependency:tree" for my project it shows the following: [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ xxxxx --- [INFO] com.xxx.xxx:xxxxx:war:3.1.0-SNAPSHOT ... [INFO] +- commons-configuration:commons-configuration:jar:1.5:compile [INFO] | \- commons-beanutils:commons-beanutils-core:jar:1.7.0:compile [INFO] +- org.seleniumhq.selenium:selenium-api:jar:2.34.0:test [INFO] | +- com.google.guava:guava:jar:14.0:test [INFO] | \- org.json:json:jar:20080701:test [INFO] +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.34.0:test [INFO] | +- org.seleniumhq.selenium:selenium-remote-driver:jar:2.34.0:test [INFO] | | +- cglib:cglib-nodep:jar:2.1_3:test [INFO] | | +- net.java.dev.jna:jna:jar:3.4.0:test [INFO] | | \- net.java.dev.jna:platform:jar:3.4.0:test [INFO] | \- net.sourceforge.htmlunit:htmlunit:jar:2.12:test [INFO] | +- org.apache.commons:commons-lang3:jar:3.1:test [INFO] | +- org.apache.httpcomponents:httpmime:jar:4.2.3:test [INFO] | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.12:test [INFO] | +- xerces:xercesImpl:jar:2.10.0:test &gt;&gt;&gt;[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile [INFO] | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.18:test [INFO] | +- net.sourceforge.cssparser:cssparser:jar:0.9.9:test [INFO] | | \- org.w3c.css:sac:jar:1.3:test [INFO] | \- org.eclipse.jetty:jetty-websocket:jar:8.1.9.v20130131:test [INFO] +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.34.0:test ... As you see on the marked line, the xml-apis has "compile" scope, and as result it is packed into .war file. Why could it happen? More interestingly it happens only while Java5 is used, for Java6 the dependency appears as "test". Maven version: 3.0.4
downvote count: 0
has answer: http://stackoverflow.com/a/24598787
upvote count: 11
tagged with: maven-3
answer count: 3
has comment: http://stackoverflow.com/comment/38076863
possible better answer: http://stackoverflow.com/a/37109876
has comment: http://stackoverflow.com/comment/38076967
has title: Maven brings "test" transitive dependency as "compile"
favorite count: 0
has comment: http://stackoverflow.com/comment/38126872
has comment: http://stackoverflow.com/comment/38075919
has comment: http://stackoverflow.com/comment/38076893
has answer: http://stackoverflow.com/a/35914733
accepted answer: http://stackoverflow.com/a/35914733
tagged with: maven
score: 11
type: AnsweredQuestion

http://stackoverflow.com/comment/37831794
comment on: http://stackoverflow.com/q/24448377
type: Comment
type: QuestionComment
has text: Where is your Small class?
score: 0

http://stackoverflow.com/comment/38052863
type: QuestionComment
comment on: http://stackoverflow.com/q/24487301
score: 0
has text: After I delete the line "gl.glBindVertexArray(0);" at the end of display() method, the exception disappeared. It looks strange to me.
type: Comment

http://stackoverflow.com/comment/37985726
has text: A lot of the time files contain some metadata which describes the size of the file... You can also just keep reading bytes and store them in some sort of dynamically sized data structure, like ArrayList.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24493964

http://stackoverflow.com/a/24515501
has body: You should do this: public Class Units{ String utopicname; public Units(Strign utopicname){ this.utopicname = utopicname; } public void setUtopicName(String utopicname){ this.utopicname=utopicname; } public String getUtopicName(){ return utopicname; } } ////////////////////////// ArrayList&lt;Units&gt; units; Cursor c = dbOpen.getUnits(); do{ Units unit = new Units(c.getString(2)); units.add(unit); }while(c.moveToNext()); ListView listview = (ListView) findViewById(R.id.listView1); AdapterLists adapterlists = new AdapterLists(this,R.layout.main_layout, units); listview.setAdapter(adapterlists); class AdapterLists extends ArrayAdapter { Activity context = null; public AdapterLists(Activity context, int layout,ArrayList&lt;Units&gt; units) { super(context, layout, canales); this.context = context; } public View getView(final int position, View convertView,ViewGroup parent) { LayoutInflater inflater = context.getLayoutInflater(); View item = inflater.inflate(R.layout.unit_row, null); TextView ui_unit_utopicname = (TextView)item.findViewById(R.id.txt_row); String dat_unit_utopicname = units.get(position).getUtopicName(); ui_unit_utopicname.setText(dat_unit_utopicname); return item; } } You need to crerate a layout (main_layout.xml) whith a TextView (txt_row.xml)
upvote count: 0
answers question: http://stackoverflow.com/q/24515275
has comment: http://stackoverflow.com/comment/37957279
has comment: http://stackoverflow.com/comment/38167593
score: -1
has comment: http://stackoverflow.com/comment/38002944
has comment: http://stackoverflow.com/comment/37956463
has comment: http://stackoverflow.com/comment/38072862
has comment: http://stackoverflow.com/comment/37956399
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/38231591

http://stackoverflow.com/q/24464772
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/24498947
has body: I require the need to run a process async but I am unsure if I should use Bukkit's implementation (BukkitRunnable) or Java's. Which is considered to be more standard when developing a Bukkit plugin?
answer count: 1
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37864702
has answer: http://stackoverflow.com/a/24498947
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: bukkit
has title: When needing to use another thread, should you use Bukkit's implmentation or Java's?

http://stackoverflow.com/comment/37925080
comment on: http://stackoverflow.com/a/24498234
type: AnswerComment
score: 0
type: Comment
has text: @J_mie6 the Client sends the heartbeat to the server, it doesnt send it to itself.... the server is supposed to read the heartbeat, and provide some type of response via its outputstream.

http://stackoverflow.com/comment/37848238
comment on: http://stackoverflow.com/q/24456795
has text: @Kyllopardiun I have added the .classpath file
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37899702
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24483695
type: AnswerComment
has text: See http://tools.ietf.org/html/rfc1518 - class C _is completely irrelevant to the OP's question_, and unless you're studying for a CCNA/CCIE (where bizarrely Cisco still require this knowledge) no-one these days needs to know about it.

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/24551657
type: Tag
tags question: http://stackoverflow.com/q/24444790

http://stackoverflow.com/comment/37864737
type: QuestionComment
has text: Okay, using a simple Map to store the contents of the node that's being called getSortedChildren on drastically improved performance, please post an answer so I can accept it :)
score: 0
comment on: http://stackoverflow.com/q/24465763
type: Comment

http://stackoverflow.com/comment/37945170
score: 0
type: QuestionComment
type: Comment
has text: have you added the permission to write to external storage`?
comment on: http://stackoverflow.com/q/24509454

http://stackoverflow.com/a/24777848
downvote count: 0
has comment: http://stackoverflow.com/comment/39183241
upvote count: 16
answers question: http://stackoverflow.com/q/24437564
has body: is what they are saying about this: OK, guys, sorry about all this trouble, and we apologize for the messed up releases. Here's the summary: There is no way to update an existing ADT bundle that you might have downloaded. You can do one of two options: Install Eclipse from eclipse.org and install ADT by pointing to the update site: https://dl-ssl.google.com/android/eclipse Download bundles from here: Linux 64-bit VM: http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20140702.zip Linux 32-bit VM: http://dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip Mac: http://dl.google.com/android/adt/adt-bundle-mac-x86_64-20140702.zip Windows 32-bit: http://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip Windows 64-bit: http://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip Starting with ADT bundle 23.0.2, you should be able to update to future versions of ADT. Source: https://code.google.com/p/android/issues/detail?id=72912
type: Answer
score: 16

http://stackoverflow.com/q/24535091
accepted answer: http://stackoverflow.com/a/24535191
tagged with: spring
has comment: http://stackoverflow.com/comment/37992827
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37992764
has comment: http://stackoverflow.com/comment/37992861
type: Question
has title: Required String parameter error on spring
has answer: http://stackoverflow.com/a/24535191
score: 0
answer count: 1
has body: I am getting Required String parameter error if the value contains %, Could you please let me know why this is happening and a solution for this For example if my url is localhost:8080/getsearchresult?searchparam=test it works But if pass % in url, spring gives me error localhost:8080/getsearchresult?searchparam=% then getting error and error is Required String parameter searchparam Could you please let me know the reason behind this and would be great if suggest some solution for this
tagged with: url

http://stackoverflow.com/a/24442057
answers question: http://stackoverflow.com/q/24441002
has body: I figured it out! I broke out my "Core Java Volume 1" 9th edition book and it says "Note that you must always use / separator, regardless of the directory separator on the system that actually stores the resource files." (Horstmann, page 571, chapter 10.1 JAR Files). So this works: FileCopyFromJAR.copy("/folder/test.txt", "c:\\test12.txt"); Hope this helps anyone out there! It was driving me crazy!
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24441002

http://stackoverflow.com/comment/37893261
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24480285
has text: @JakeGrim This is a website set up to help *programmers*. There's no bias against newbies, nor favoritism towards veterans -- just preference as to the *quality* of questions. Imagine you're trying to get a professor or TA to help you -- you don't want them to keep on bothering you for additional information, and you *definitely* don't want to give the impression that you want them to do your thinking for you. Think of Stack Overflow as a last resort -- only ask a question after you've exhausted *everything*, and when you do ask that question, make sure you include *everything* you have done.

http://stackoverflow.com/comment/37997968
score: 0
comment on: http://stackoverflow.com/q/24537799
type: QuestionComment
type: Comment
has text: What is the package name at the top of `JavaApplications8.java`?

http://stackoverflow.com/q/24578438
downvote count: 0
tagged with: descriptor
has body: I'm migrating from Weblogic 11g to 12c, during the deployment process it fails and shows the following error: Caused by: weblogic.application.naming.ReferenceResolutionException: [J2EE:160199]Error resolving ejb-ref "ejb/BizRuleFacade" from module "BizAgi-ejb.jar" of application "BizAgi-ear-Weblogic". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because multiple EJBs in the application were found to implement the "BizAgi.bpm.rules.entities.BizRuleFacade" interface, including BizAgi-war.war/BizRuleFacadeBean, BizAgi-ejb.jar/BizRuleFacadeBean. Specify a qualified ejb-link for this ejb-ref to indicate which EJB is the target of this ejb-ref. My web.xml file looks like this: ejb/BAScopeLogFacade Session BizAgi.PAL.historylog.entities.BAScopeLogFacade BizAgi-ejb.jar#BAScopeLogFacadeBean The BizAgi-ejb.jar is a module inside the ear (BizAgi-ear-Weblogic.ear). How can i properly deploy my application?
has answer: http://stackoverflow.com/a/60729698
favorite count: 0
has title: weblogic 12c deployment failure
has comment: http://stackoverflow.com/comment/38075537
type: UnansweredQuestion
score: 5
tagged with: deployment
answer count: 4
type: Question
tagged with: jakarta-ee
tagged with: weblogic
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/56899740
has answer: http://stackoverflow.com/a/24678628
has comment: http://stackoverflow.com/comment/38143024
has answer: http://stackoverflow.com/a/55001403

http://stackoverflow.com/comment/37828791
score: 0
type: AnswerComment
has text: have to overrride getPreferredSize for APIs based on Swings containers
type: Comment
comment on: http://stackoverflow.com/a/24443497

opengl
tags question: http://stackoverflow.com/q/24571888
tags question: http://stackoverflow.com/q/24473181
tags question: http://stackoverflow.com/q/24499391
tags question: http://stackoverflow.com/q/24515909
tags question: http://stackoverflow.com/q/24439040
tags question: http://stackoverflow.com/q/24484918
tags question: http://stackoverflow.com/q/24493315
type: Tag
tags question: http://stackoverflow.com/q/24501859
tags question: http://stackoverflow.com/q/24469381
tags question: http://stackoverflow.com/q/24470748
tags question: http://stackoverflow.com/q/24487301
tags question: http://stackoverflow.com/q/24503393
tag name: opengl

http://stackoverflow.com/q/24473470
linked to: http://stackoverflow.com/q/1812244
linked to: http://stackoverflow.com/q/2340406
linked to: http://stackoverflow.com/q/7033676
has answer: http://stackoverflow.com/a/36479187
has comment: http://stackoverflow.com/comment/37879381
linked to: http://stackoverflow.com/q/18664579
has title: Where can I upload files that can be accessed by Tomcat?
linked to: http://stackoverflow.com/q/19138706
has comment: http://stackoverflow.com/comment/37914034
has comment: http://stackoverflow.com/comment/37891947
tagged with: jakarta-ee
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/36479187
linked to: http://stackoverflow.com/q/132052
tagged with: java
linked to: http://stackoverflow.com/q/2422468
has comment: http://stackoverflow.com/comment/37902005
linked to: http://stackoverflow.com/q/4543936
type: Question
score: 0
answer count: 1
tagged with: file-upload
tagged with: tomcat
has body: I am running a Java J2EE app in Tomcat and I would like to upload some files that can be directly served by Tomcat via URL (ie, I don't want to create an additional servlet to serve the files and I don't want to use Apache). What is the solution to this? I know I should not create files inside the deployed WAR directory (if it is extracted at all), as illustrated in this very old post. I tried creating another directory under "webapps": System.getProperty("catalina.base") + "/webapps/uploadedFiles/"; but Tomcat does not seem to serve any file at "localhost:8080/uploadedFiles/...". So I had to put the files inside the webapps/ROOT directory, were they could be accessed. However, this looks ugly and it's probably not really correct, because I think the ROOT directory is not designed for such purposes. My question is: HOW CAN I MAKE TOMCAT SERVE my upload files, considering that they cannot be placed in the deployed directory because they can be overwritten? Or, what is the same: where should I place my upload files so Tomcat can serve them directly via HTTP request and they don't get overwritten by redeployment?

http://stackoverflow.com/comment/38042703
type: AnswerComment
has text: So then Google's fragment lifecycle diagram here is incorrect then? http://developer.android.com/images/fragment_lifecycle.png I also see that onStart() is the method called to confirm the fragment is visible: http://developer.android.com/reference/android/app/Fragment.html#onStart()
type: Comment
comment on: http://stackoverflow.com/a/24540201
score: 0

http://stackoverflow.com/comment/37900363
type: Comment
type: QuestionComment
has text: Also, we were not allowed to count the letters, that is why I didn't use int s.
score: 0
comment on: http://stackoverflow.com/q/24483551

http://stackoverflow.com/comment/37960332
comment on: http://stackoverflow.com/q/24517643
has text: Your if header `if (i != j & RandomArray[i] != 0) ` needs two `&`, not just one.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25064614
type: AcceptedAnswer
has body: Problem was that the cxf classes needed to be set on the classpath even though they were bundled into my jar... Didn't make sense why but that was the fix.
answers question: http://stackoverflow.com/q/24447280
has comment: http://stackoverflow.com/comment/108202319
type: Answer
score: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/138691050
accepted answer of: http://stackoverflow.com/q/24447280
has comment: http://stackoverflow.com/comment/80474941
upvote count: 4
has comment: http://stackoverflow.com/comment/135669613

http://stackoverflow.com/q/24472566
tagged with: java
tagged with: swing
type: Question
has body: I'm trying to Refresh my data on JLabel Text. My data on "mod.getAllPlaneteByUser(u).getQte_or()" get data from my DataBase. The component "lblRefresh" is just a JLabel listener. --> Initialization : JLabel lblRessOr = new JLabel(); lblRessOr.setText(Integer.toString(mod.getAllPlaneteByUser(u).getQte_or())); --> Add By default on my contentPane : lblRessOr.setForeground(Color.RED); lblRessOr.setFont(new Font("Lucida Grande", Font.BOLD, 16)); lblRessOr.setBounds(225, 141, 73, 16); contentPane.add(lblRessOr); --> Use on my MouseListener : if(e.getSource() == lblRefresh){ lblRefresh.setText(Integer.toString(mod.getAllPlaneteByUser(u).getQte_or())); lblRefresh.repaint(); } Anybody know how i can refresh my data ?
has answer: http://stackoverflow.com/a/24472774
has comment: http://stackoverflow.com/comment/37876931
has title: Refresh data on JLabel - Java SWING
has comment: http://stackoverflow.com/comment/37876963
score: 0
answer count: 1
tagged with: jlabel
has comment: http://stackoverflow.com/comment/37907757
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37919315
tagged with: refresh

http://stackoverflow.com/q/24476756
has answer: http://stackoverflow.com/a/24476990
has answer: http://stackoverflow.com/a/24476788
possible better answer: http://stackoverflow.com/a/24476782
accepted answer: http://stackoverflow.com/a/24476802
tagged with: system.out
favorite count: 0
answer count: 5
has body: Is there any error in the following code? It shows cant find symbol, symbol: class out location: class System. In the log, it show a lot of errors, including java.lang.ClassFormatError: Method "" in class Area has illegal signature "(Ljava/lang/Object;)Ljava/lang/System$out$println;" import java.util.*; class Area { double pi=3.14; Scanner sc=new Scanner(System.in); System.out.println("Enter the value of r"); int r=sc.nextInt(); System.out.println("enter the value h"); int h=sc.nextInt(); void areaOfCircle() { double area1=pi*r*r; System.out.println("area of circle="+area1); } void areaOfCylinder() { double area2=2*pi*r*(r+h); System.out.println("area of cylinder="+area2); } public static void main(String args[]) { Area a=new Area(); a.areaOfCircle(); a.areaOfCylinder(); } }
has title: Error in System.out.println
upvote count: 1
has answer: http://stackoverflow.com/a/24476802
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24476782
type: Question
has answer: http://stackoverflow.com/a/24476818
downvote count: 0

http://stackoverflow.com/comment/38024917
comment on: http://stackoverflow.com/q/24551922
has text: What's your progress so far? Please show some code.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37811601
comment on: http://stackoverflow.com/a/24437089
type: Comment
score: 0
type: AnswerComment
has text: Well, it doesn't make much sense to even want the original name of an obfuscated class name, since there's not really anything you can do with it other than to log it.

http://stackoverflow.com/q/24557864
has answer: http://stackoverflow.com/a/24558265
tagged with: mssql-jdbc
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24558009
downvote count: 0
has title: Error :Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
tagged with: jdbc
has comment: http://stackoverflow.com/comment/38035426
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: My code is : try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=Java-Test;user=sa;password=199088037635;"; link = (Connection) DriverManager.getConnection(connectionUrl); } catch (ClassNotFoundException e) { System.out.println("Class Error: "+ e.toString()); } catch (SQLException se) { System.out.println("Driver Error: " + se.toString()); } I get the error : Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: com.microsoft.sqlserver.jdbc.SQLServerConnection cannot be cast to com.sun.corba.se.pept.transport.Connection at SQL.createAndShowGUI(SQL.java:42) Similar code in other projects runs correctly. But in this project it doesn't run.
score: 1
tagged with: java

http://stackoverflow.com/a/56188131
upvote count: 4
downvote count: 0
has body: As said by @Sedrick you can use fontawesomefx library and use it in FXML as follows: Note: JavaFX 8 and FontAwesomeFx v8.9 dashboard.fxml <?xml version="1.0" encoding="UTF-8"?> <?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?> <?import javafx.scene.control.Button?> <?import javafx.scene.layout.AnchorPane?> <FontAwesomeIconView glyphName="CLOSE" glyphSize="24"/> In scene builder looks like below:
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24430121

http://stackoverflow.com/q/24531879
has comment: http://stackoverflow.com/comment/37986522
has title: How to wait for the GUI finishing its update - Swing
has comment: http://stackoverflow.com/comment/37986565
type: Question
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
has body: JPanel[] panels = new JPanel[5]; // lets just say its still filled and does not just contain null to keep it short while(true){ for(JPanel panel : panels){ // set the color of the panel to different colors } } Im coloring a few panels in a permannent cyclus. Now my problem is, that the update of the gui has a delay because of the thread which is updating it. Now i am looking for a way to join this thread and wait exactly until it´s done before starting the next cyclus JPanel[] panels = new JPanel[5];// lets just say its still filled and does not just contain null to keep it short while(true){ for(JPanel panel : panels){ // set the color of the panel to different colors } // wait until the gui-update is over } Hope somebody can hlep me :) Thanks!
has comment: http://stackoverflow.com/comment/37989211
tagged with: java

http://stackoverflow.com/q/24565960
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring
has answer: http://stackoverflow.com/a/24566286
linked to: http://stackoverflow.com/q/7280115
type: AnsweredQuestion
has body: Is there a way to easily use Spring Injection to grab one or more *.xml data files from a folder location (either in a deployed *.war or on a server folder) and inject that data from the *.xml files into a Java class (e.g. in a web service)? I have been asked by another programmer if I can do this. I've had a look at a few links on stackoverflow, but so far the easiest way I've found is to put the *.xml files into a particular folder location (e.g. WEB-INF/classes) and use something like this to retrieve them: Thread.currentThread().getContextClassLoader.getResourceAsStream("/WEB-INF/classes/data.xml") The above method is easy; however, it is obviously not Spring Injection. Is there a way to do this using Spring Injection instead? I would have thought that since configuration files can be loaded this way, that xml data could also be loaded similarly. Thanks.
tagged with: java
tagged with: jboss
type: Question
has title: Spring Injection of XML Data Files to Java Classes
accepted answer: http://stackoverflow.com/a/24566286
score: 0
answer count: 1

http://stackoverflow.com/q/24430063
has comment: http://stackoverflow.com/comment/37818534
has answer: http://stackoverflow.com/a/24430180
has comment: http://stackoverflow.com/comment/37797713
has body: I can't figure out what I am doing wrong here. I just wrote a similar code that worked fine. once I got a handle on how to use the scanner class. I am working on a program that takes the height and base of a right triangle and then calculates the perimeter, area, and hypotenuse. But it returns 0.0 for each method and I can't figure out if I am missing some sort of syntax or if I am just really messing up my calculations. Can someone just point me in the right direction of my mistake? public class RightTriangle { private double height; private double base; private final double hypotenuse = Math.sqrt(Math.pow(height, 2) + Math.pow(base, 2)); public RightTriangle(double triHeight, double triBase) { triHeight = height; triBase = base; } public double getPerimeter() { double perimeter = height + base + hypotenuse; return perimeter; } public double getArea() { double area = (height + base) / 2; return area; } public double getHypotenuse() { return hypotenuse; } } Here is my main method: import java.util.Scanner; public class CalculateTriangle { public static void main(String[] args) { Scanner triangleHeight = new Scanner(System.in); System.out.print("Enter Triangle Height: "); double height = triangleHeight.nextDouble(); Scanner triangleBase = new Scanner(System.in); System.out.print("Enter Triangle Base: "); double base = triangleBase.nextDouble(); RightTriangle newTriangle = new RightTriangle(height, base); newTriangle.getPerimeter(); double perimeter = newTriangle.getPerimeter(); newTriangle.getArea(); double area = newTriangle.getArea(); newTriangle.getHypotenuse(); double hypotenuse = newTriangle.getHypotenuse(); System.out.println(perimeter); System.out.println(area); System.out.println(hypotenuse); } }
has title: Right Triangle calculations returning 0?
has comment: http://stackoverflow.com/comment/37797678
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/24430098
answer count: 2

http://stackoverflow.com/q/24540630
tagged with: java
tagged with: javafx
has title: How to draw a gradient over the scene on JavaFX?
has body: Is there a way to draw a radial gradient from black to transparent over the entire scene of a JavaFX stage? I want to achieve something like this:
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/24541577
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24541957
favorite count: 0
tagged with: javafx-8
type: Question
possible better answer: http://stackoverflow.com/a/24541957
tagged with: javafx-2
score: 4
accepted answer: http://stackoverflow.com/a/24541577

http://stackoverflow.com/q/24439580
tagged with: jar
has title: Maven and Referenced Libraries
has answer: http://stackoverflow.com/a/24440532
has body: I have a eclipse java project. It has external jar in Referenced Libraries. I want to use Maven. But I would like to know how to include this external jar in Maven. Is it necessary a repository?
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24439663
has answer: http://stackoverflow.com/a/24439829
upvote count: 2
type: UnansweredQuestion
tagged with: maven
score: 2
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37818837

http://stackoverflow.com/comment/37797451
comment on: http://stackoverflow.com/q/24429553
score: 0
type: Comment
type: QuestionComment
has text: and where should I add this?

http://stackoverflow.com/comment/37901197
type: Comment
score: 0
has text: Is the Database Server started?
comment on: http://stackoverflow.com/q/24485283
type: QuestionComment

http://stackoverflow.com/comment/38551077
score: 0
type: Comment
type: QuestionComment
has text: I have installed the Oracle Java 7 JDK and have set the JAVA_HOME and appended the $JAVA_HOME/bin to existing $PATH variable.
comment on: http://stackoverflow.com/q/24544049

http://stackoverflow.com/q/24520528
tagged with: android
has comment: http://stackoverflow.com/comment/38260185
has body: EDIT: Now that I've figured out some behavior, I'm wondering, why does it not send the request as soon as I call flush()? or close()? Why does it wait until I call getResponseCode()? Original question: I am new to the HttpsURLConnection class in java, and looked on the doc and found it not very enlightening. I have inherited this code on a project I am working on (I did not write it myself) and wondered what it's doing, and how it can be improved. For example, I can't tell if "writeBytes" actually sends the data or "close." I've looked at many javadocs and found them to be ambiguous, and haven't found any good resources for this topic in books or blog posts online. Could someone please enlighten me, or point me to some good resources? By the way, this code is for an android SDK library I am working on. Note: I understand the theory of HTTP requests very well. I took a class on it. I know all about URL parameters (using the ?name=value) and cookies and RESTful services and TCP and IP... etc. Just struggling to find good docs so I know how to use the java libraries. Edit: Changed this to the HttpClient code because it turns out I couldn't use Https and still see the request from the echo server. It has the same idea though. import java.io.BufferedInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; public class HttpClient { public static final String DEBUG_URL = "http://10.20.1.61:8001/api/ad/v5/"; public static final String MAPPED_KEYWORDS = "get_mapped_keywords/"; private static byte[] buffer = new byte[1024]; static NetworkReturn sendHttpPost(String urlString, String postData) { URL url; HttpURLConnection con = null; try { url = new URL(urlString); con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-length", String.valueOf(postData.length())); con.setRequestProperty(…
possible better answer: http://stackoverflow.com/a/24521228
has answer: http://stackoverflow.com/a/24521388
has answer: http://stackoverflow.com/a/24521228
tagged with: http
has title: What method call in HttpsURLConnection actually sends the HTTP request?
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/24521091
linked to: http://stackoverflow.com/q/2082057
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24521388
downvote count: 0
tagged with: url
favorite count: 0
answer count: 3

http://stackoverflow.com/q/24468059
linked to: http://stackoverflow.com/q/3053864
tagged with: android
possible better answer: http://stackoverflow.com/a/24468115
accepted answer: http://stackoverflow.com/a/24468099
has answer: http://stackoverflow.com/a/24468115
type: AnsweredQuestion
tagged with: java
score: 4
tagged with: eclipse
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24468099
answer count: 2
has title: Setting "Wrap Content" to a view programmatically
downvote count: 0
favorite count: 0
has body: Is it possible to set Wrap Content Identifier int? Will the following code work? EditText ET = new EditText(getActivity()); ET.setWidth(WRAP_CONTENT);

http://stackoverflow.com/q/24486010
has answer: http://stackoverflow.com/a/24491365
type: Question
tagged with: jsf-2
answer count: 2
possible better answer: http://stackoverflow.com/a/24489578
has answer: http://stackoverflow.com/a/24489578
linked to: http://stackoverflow.com/q/16842912
score: 0
linked to: http://stackoverflow.com/q/7437882
linked to: http://stackoverflow.com/q/7764545
accepted answer: http://stackoverflow.com/a/24491365
has title: JSF Passing Bean to View Failing
has body: I am trying to write a simple JSF page that initially includes two subviews/includes, and pass the backing bean to one of the includes because the include is meant to be reusable (and possibly included more than once in a larger application). This is the relevant code: page1.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:pf="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" template="templates/template1.xhtml"> <ui:define name="subheader"> Person Details </ui:define> <ui:define name="bodyContent"> <h:form> <c:forEach items="#{page1Bean.blockNames}" var="blockName"> <c:choose> <c:when test="#{blockName} eq 'block1'"> <ui:include src="block1.xhtml" > <ui:param name="bean" value="#{page1Bean.myBean}"/> </ui:include> </c:when> <c:otherwise> <ui:include src="#{blockName}.xhtml" /> </c:otherwise> </c:choose> </c:forEach> <pf:commandButton value="Ajax Button" action="#{page1Bean.ajaxSubmit()}"/> </h:form> </ui:define> </ui:composition> block1.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:pf="http://primefaces.org/ui"> This is the first block <h:panelGrid columns="3" style="margin-bottom:10px" cellpadding="5"> <pf:outputLabel for="firstName" value="Nombre:" /> <pf:inputText id="firstName" value="#{bean.firstName}" /> <h:message id="firstNameMessage" for="firstName" /> </h:panelGrid> </ui:composition> Page1Bean.java package com.views.prototype; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.context.FacesContext; @ManagedBean public class Page1Bean { private List<String> blockNames; private Block1Bean myBean; public Page1Bean(…
type: AnsweredQuestion
tagged with: jsf
linked to: http://stackoverflow.com/q/7248439
tagged with: java

http://stackoverflow.com/comment/37985657
type: QuestionComment
score: 0
has text: Why do this in java rather than a more appropriate (scripting) language?
comment on: http://stackoverflow.com/q/24531396
type: Comment

http://stackoverflow.com/comment/38051891
score: 1
has text: Due to runtime expense of creating a new object and adding it to the screen, which could cause multiple updates, it's generally preferred to update what's already there if possible ;)
comment on: http://stackoverflow.com/q/24566192
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37862881
type: AnswerComment
has text: The scenario is if user is already logged in into facebook on the same browser then when he visit my site,it will automatically displays his email id related to facebook.So I want to extract that email id.Any suggestions?
type: Comment
comment on: http://stackoverflow.com/a/24465005
score: 0

http://stackoverflow.com/a/24490004
has comment: http://stackoverflow.com/comment/37909822
upvote count: 2
has comment: http://stackoverflow.com/comment/37909894
has comment: http://stackoverflow.com/comment/37910182
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37910033
accepted answer of: http://stackoverflow.com/q/24489780
type: Answer
has body: Either Add the jar that has ExitListener class in it in your class-path Class-Path: test.jar gson.jar &lt;exitlistenerjar&gt; or Write your own ExitListener and use in your App. EDIT On other thought you can use this code and add it to your application import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class ExitListener extends WindowAdapter { public void windowClosing(WindowEvent event) { System.exit(0); } }
has comment: http://stackoverflow.com/comment/37919529
answers question: http://stackoverflow.com/q/24489780
has comment: http://stackoverflow.com/comment/37910052
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37910521

http://stackoverflow.com/q/24573594
has answer: http://stackoverflow.com/a/24584526
tagged with: irc
has comment: http://stackoverflow.com/comment/38086293
type: AnsweredQuestion
tagged with: bots
tagged with: java
type: Question
has title: IRC bot issue regarding channel retrieval
has comment: http://stackoverflow.com/comment/38085341
has comment: http://stackoverflow.com/comment/38085388
accepted answer: http://stackoverflow.com/a/24584526
has body: I would like to keep this short and simple for everyone. I've been working on a personal project just to learn something small of creating a relatively basic IRC bot using pIRC Java API. Things were looking relatively well however I'm having(and have been having for days) issues in regards to obtaining current channel and current channel users. The bot will only really support a single channel per instance for now but I would like to be able to display all current users on the left side of my frame as shown below: The light blue is where I would like to display the users and the dark blue is where I would like to display channel messages In PIRC you ought to call listChannels() method first, which in turn calls onChannelInfo() after every server it reads it returns (String channel, int userCount, String topic). The issue is that I want to filter my channels only by channel name, thus @Overriding the current onChannelInfo is not enough. If anyone has used pIRCBot before and knows what's going on please do help. I've been working on this issue for days and spent countless hours going back and fourth, nothing seemed to work.. Nothing ever returned and thus never appended on my JTextArea.. TL;DR - I would like to display users in current channel in left side and messages in right side but am having alot of issues with retrieving channel users and information! Thanks a million in advance. ALSO, here's the API for anyone who would like to look at - http://www.jibble.org/javadocs/pircbot/
score: 0
has comment: http://stackoverflow.com/comment/38086247
has comment: http://stackoverflow.com/comment/38085458
answer count: 1
has comment: http://stackoverflow.com/comment/38085228

http://stackoverflow.com/a/24449315
score: 2
downvote count: 0
upvote count: 2
has body: What's happening is you are stuck in your for-loop until it is done processing and then you repaint. What you should do is, since you are extending JPanel you have access to the Component's paintComponent method which is called when you first paint and on repaint of the component. Like So @Override public void paintComponent(Graphics g) { } Rather than your public void paint(Graphics g) { } When you override paintComponent, however, you need to make sure you call it's parent's paintComponent Like so: @Override public void paintComponent(Graphics g) { super.paintComponent(g); } And while we are at it we can call your Update method before or after all of your painting, I chose before everything in my example: @Override public void paintComponent(Graphics g) { update(); super.paintComponent(g); // Super is used to reference the parent // All of your painting methodology repaint(); // Force the component to repaint so this gets called over and over. } Be sure to remove that for-loop; of course you could always keep it if you wanted to have a lot of data before drawing. And if you really wanted you could always keep the exact same code you have but follow the similar pattern as I said above. Like this: public void paint(Graphics g) { update(); // All of your painting methodology repaint(); // Force the component to repaint so this gets called over and over. }
has comment: http://stackoverflow.com/comment/37849487
has comment: http://stackoverflow.com/comment/37840456
has comment: http://stackoverflow.com/comment/37840415
answers question: http://stackoverflow.com/q/24448799
type: Answer

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

http://stackoverflow.com/comment/37975735
has text: -1 for not showing any research effort.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24525970

http://stackoverflow.com/comment/37996050
has text: HashSet is the best way to verify if element contains or not and it's done in constant time. Notice that the contains method is case sensitive and it will not work if you want to compare with the string "Cat" from the given sample code, then it's good idea do add a lowercase keyword and compare only in lowercase mode, for example.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24536414
type: Comment

http://stackoverflow.com/comment/37845618
score: 0
type: AnswerComment
type: Comment
has text: Thanks Eckes, I will study that Protobuf and see how it can help me to do that. As quicly I read, I think it's the better approach on what I want to do.
comment on: http://stackoverflow.com/a/24455497

http://stackoverflow.com/comment/38001664
type: QuestionComment
has text: Does the container prepare a servlet pool for performance reasons?
type: Comment
comment on: http://stackoverflow.com/q/24539675
score: 0

http://stackoverflow.com/q/24533317
has comment: http://stackoverflow.com/comment/37992419
has answer: http://stackoverflow.com/a/24536736
tagged with: swing
accepted answer: http://stackoverflow.com/a/24536736
linked to: http://stackoverflow.com/q/13427174
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24535062
has body: I want to disable beep sound in JFormattedTextField, but I have some restriction. I only have access to the JFormattedTextField instance. I can't create a new subclass I can't change system setting. Other part of the program may need the beep sound
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24535062
upvote count: 1
has title: disable beep sound in JFormattedTextField
favorite count: 0
tagged with: jformattedtextfield

http://stackoverflow.com/a/24538674
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24538509
type: Answer
has comment: http://stackoverflow.com/comment/109863624
score: 34
has comment: http://stackoverflow.com/comment/42725903
accepted answer of: http://stackoverflow.com/q/24538509
downvote count: 0
has comment: http://stackoverflow.com/comment/79627381
has body: Once the code is compiled, there's no such thing as an inner class. If you look at the results of javac, you'll see two files: A.class A$B.class So class B is not loaded when A is loaded, B just happens to be defined in A. Edit For example, given these two files, package kuporific; public class A { private static class B {} private class C {} } and a build.gradle file (for convenience): apply plugin: 'java' First, build by running gradle build. Then, unzip the resulting JAR file (located in build/libs): ├── META-INF │ └── MANIFEST.MF └── kuporific ├── A$B.class ├── A$C.class └── A.class Opening each file (in IntelliJ, for example), reveals what the compiler has done: A.class: package kuporific; public class A { public A() { } private class C { public C() { } } private static class B { public B() { } } } A$B.class: package kuporific; class A$B { private A$B() { } } A$C.class: package kuporific; import kuporific.A; class A$C { private A$C(A this$0) { this.this$0 = this$0; } } Notice that A$B does not have a reference to its parent, A, while A$C does. This is because the former is a static inner class, and the latter is not, and both A$B and A$C are now package private classes. This is how non-static inner classes are able to directly reference their parent instance's fields and methods, and vice versa. (Any private fields of the parent class referenced in an inner class are made package private as well.) Next, let's see what effect loading class A has on A$B and A$C. First, add the following Java class: package kuporific; public class Main { public static void main(String[] args) throws ClassNotFoundException { Main.class.getClassLoader().loadClass("kuporific.A"); } } Now add the following to the build.gradle file: apply plugin: 'application' mainClassName = 'kuporific.Main' applicationDefaultJvmArgs = ["-verbose:class"] The -verbose:class outputs all classes that are loaded by the JVM (see Java - Get a list of all Classes loaded in the JVM). Run gradle run on the com…
upvote count: 34
has comment: http://stackoverflow.com/comment/42725650
has comment: http://stackoverflow.com/comment/42714728

http://stackoverflow.com/comment/37962556
has text: No error, im just getting back the result as null. it should be not null
comment on: http://stackoverflow.com/a/24518554
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37971928
type: Comment
has text: Isn't that there should be only one `public` class in a file? Or have I mistaken?
comment on: http://stackoverflow.com/a/24523824
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37803357
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24432775
type: Comment
has text: Ah there it is. Drag/Drop a Swing Containers Panel, right click, set layout. Thank you my good sir. EDIT: You can also do that for the JFrame (Form?) itself. Now I just need to figure out how to actually do stuff with it...

http://stackoverflow.com/q/24588068
tagged with: converters
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/38091374
tagged with: binary
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24588212
has title: How to Convert Text on a JTextArea to acsii binary and back on java
has body: I am writing code to make a converter for text to binary. i used this. public static void BinaryConverter() { String string = Window.TextArea.getText(); byte[] bytes = string.getBytes(); System.out.println(string + "=" + bytes); } I then get this in the console. =[B@79e7c7fb
type: Question
has answer: http://stackoverflow.com/a/24588212
upvote count: 2
tagged with: ascii
score: 0
downvote count: 2

http://stackoverflow.com/a/24582826
answers question: http://stackoverflow.com/q/24582796
type: Answer
has comment: http://stackoverflow.com/comment/38082012
has comment: http://stackoverflow.com/comment/38082587
has comment: http://stackoverflow.com/comment/38081982
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38082602
has comment: http://stackoverflow.com/comment/38082524
has body: Two options would be to either use String formatting: String.format("%02x", b &amp; 0xff) //Where b is your byte value Or you could use your byte(s) as an integer(s) and use this method in the Integer class: Integer.toHexString(int i) An example: //Just some image on my hard drive File file = new File("C:\\Users\\%username%\\Pictures\\Memes\\What_If_I_Told_You.jpg"); StringBuilder builder = new StringBuilder(); try { FileInputStream fin = new FileInputStream(file); byte[] buffer = new byte[1024]; int bytesRead = 0; while((bytesRead = fin.read(buffer)) &gt; -1) for(int i = 0; i &lt; bytesRead; i++) builder.append(String.format("%02x", buffer[i] &amp; 0xFF)).append(i != bytesRead - 1 ? " " : ""); } catch (IOException e) { e.printStackTrace(); } System.out.println(builder.toString()); The output of this was: ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48... etc -Thomas
upvote count: 1

http://stackoverflow.com/a/24545823
has comment: http://stackoverflow.com/comment/38015407
has comment: http://stackoverflow.com/comment/38016244
has comment: http://stackoverflow.com/comment/38015626
score: 0
type: Answer
has body: MongoDB does have a .group() method that could be used, but really this is more of a wrapper around the "mapReduce" methods and the better modern approach is to use the aggregation framework db.collection.aggregate([ { "$match": { "status": 1 }} { "$group": { "_id": null, "total": { "$sum": "$key1" } }} ]) Or even without "matching" the documents first: db.collection.agregate([ { "$group": { "_id": null, "total": { "$sum": { "$cond": [ { "$eq": [ "$status", 1 ] }, "$key1" 0, ] } } }} ]) For the Java driver, you are essentially just constructing DBObject types. Either by parsing something simple like the JSON shown or programatically: BasicDBObject match = new BasicDBObject( "$match", new BasicDBObject("status", 1) ); BasicDBObject group = new BasicDBObject( "$group", new BasicDBObject("_id", null).append( "total", new BasicDBObject( "$sum", "$key1" ) ) ); DBCollection collection = db.getCollection("mycollection"); AggregationOutput output = collection.aggregate(match,group); Take a general look at the Aggregation to SQL mapping chart in the documentation for a basic overview of things you might be familiar with and how to implement them. Also see Aggregation Framework and the Java Driver
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38015780
answers question: http://stackoverflow.com/q/24545492

http://stackoverflow.com/comment/37877598
score: 1
has text: Use a DocumentFilter instead
comment on: http://stackoverflow.com/q/24472935
type: Comment
type: QuestionComment

sonarqube
tags question: http://stackoverflow.com/q/24488823
type: Tag
tag name: sonarqube
tags question: http://stackoverflow.com/q/24432134
tags question: http://stackoverflow.com/q/24491480
tags question: http://stackoverflow.com/q/24540884
tags question: http://stackoverflow.com/q/24548273
tags question: http://stackoverflow.com/q/24470814

http://stackoverflow.com/comment/37800727
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24431370
has text: @Nivas: Jep it its... I searched but didnt found it. Thanks
type: Comment

http://stackoverflow.com/comment/38003885
has text: @TheBlindSpring It shows true but the controls are still not visible. I have added my declaration in the question. Let me know if this is correct.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24540339

http://stackoverflow.com/comment/44838679
comment on: http://stackoverflow.com/a/24564612
type: Comment
has text: This is an excellent blog post on the rationale behind Sutart's answer: http://blog.joda.org/2014/11/optional-in-java-se-8.html
score: 1
type: AnswerComment

http://stackoverflow.com/a/24437150
type: Answer
has body: First change edittext string to uppercase because you are comparing "A" as String AA = A.getText().toString().toUpperCase();//Alternative String And then display image as if (AA.equals("A"){ J.setImageResource(R.drawable.my_image); }else{ } where my_image.png in project's drawable folder.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24437060
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24437060

http://stackoverflow.com/comment/37956733
comment on: http://stackoverflow.com/a/24497750
score: 0
type: AnswerComment
has text: Are you still using `=+` instead of `=`? Can you show your code? This works fine for me. Maybe it has something to do with you trying to base your x frequency on your y position?
type: Comment

http://stackoverflow.com/a/50762246
has body: Here is what i use in my sprite class. I give it the vector where i clicked camera.unproject(new Vector3().set(x,y,0));. returns true if clicked in the area of the sprite. /*** * * @param v3 Vector with MouseClickPosition * @return true if click was inside rectangle x --&gt; x + width, y --&gt; y + * height */ public boolean clicked(Vector3 v3){ Rectangle rec = getBoundingRectangle(); if(v3.x &gt;= rec.x &amp;&amp; v3.x &lt; rec.x + getWidth()){ if(v3.y &gt;= rec.y &amp;&amp; v3.y &lt; rec.y + getHeight()){ System.out.println("click_on\t" + v3.x + ", " + v3.y); return true; } else{ return false; } } else{ return false; } }
type: Answer
answers question: http://stackoverflow.com/q/24501268
score: 0

http://stackoverflow.com/a/24547980
accepted answer of: http://stackoverflow.com/q/24547873
has body: The "prototype" keyword just means that each time you ask Spring for an instance, you will get a fresh instance. With the wiring you have, you are only asking once. So I expect that your taskExecutor bean will be a single instance.
type: Answer
answers question: http://stackoverflow.com/q/24547873
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/37807066
comment on: http://stackoverflow.com/q/24431609
has text: @I-LOVE-2-REVIVE His partition code always chooses `a[j]` as the pivot (which is `x`). His program is close but has silly bugs that he needs to find by himself.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24476810
has title: Write the code to display first 50 numbers of the series 3,7,16,35
score: 0
has comment: http://stackoverflow.com/comment/37884895
answer count: 1
has comment: http://stackoverflow.com/comment/37885306
has comment: http://stackoverflow.com/comment/37885019
type: UnansweredQuestion
has body: Write the code to display first 50 numbers of the series: 3,7,16,35..... I have done the coding for this question but the output shows only "35" when i click the display button . please help .. (i need to do this question using do-while loop) Here is the coding..... private void displayActionPerformed(java.awt.event.ActionEvent evt) { int a=3,count=1,c=1; do { resulttf.setText(a+","); a=(2*a)+c; c++; count++; }while(a&lt;=50); }
has answer: http://stackoverflow.com/a/24476860
tagged with: java
has comment: http://stackoverflow.com/comment/37884954
has comment: http://stackoverflow.com/comment/37884926
type: Question
has comment: http://stackoverflow.com/comment/37884978
has comment: http://stackoverflow.com/comment/37884883
has comment: http://stackoverflow.com/comment/37884909

http://stackoverflow.com/q/24442463
linked to: http://stackoverflow.com/q/12057817
tagged with: java
has comment: http://stackoverflow.com/comment/37821782
type: Question
has comment: http://stackoverflow.com/comment/37822244
has comment: http://stackoverflow.com/comment/37821251
score: 0
has comment: http://stackoverflow.com/comment/37821711
has comment: http://stackoverflow.com/comment/37821705
has title: Getting coordinates of outside window
has comment: http://stackoverflow.com/comment/37822083
linked to: http://stackoverflow.com/q/6091531
has body: I know how to easily get the coordinates of a jPanel that you make in a program, but I am really trying to figure out how to get the coordinates of a window that isn't jPanel + jFrame; such as a window in Chrome or even just a directory (not swing). Usually, I can find something online, but this seems to be a feature that perhaps Java cannot perform. I am looking for some higher knowledge about this.
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/6091531
has comment: http://stackoverflow.com/comment/37821710
has comment: http://stackoverflow.com/comment/37822347
answer count: 0

unit-testing
tags question: http://stackoverflow.com/q/24572550
tags question: http://stackoverflow.com/q/24491905
tags question: http://stackoverflow.com/q/24520499
tags question: http://stackoverflow.com/q/24490214
tags question: http://stackoverflow.com/q/24566104
tags question: http://stackoverflow.com/q/24515077
tags question: http://stackoverflow.com/q/24454287
tags question: http://stackoverflow.com/q/24440338
tags question: http://stackoverflow.com/q/24497765
tags question: http://stackoverflow.com/q/24510742
tags question: http://stackoverflow.com/q/24473660
tags question: http://stackoverflow.com/q/24560508
tags question: http://stackoverflow.com/q/24483524
tags question: http://stackoverflow.com/q/24443479
tags question: http://stackoverflow.com/q/24569534
tags question: http://stackoverflow.com/q/24544049
tags question: http://stackoverflow.com/q/24431427
tags question: http://stackoverflow.com/q/24540683
tags question: http://stackoverflow.com/q/24444957
tags question: http://stackoverflow.com/q/24471281
tags question: http://stackoverflow.com/q/24491397
tags question: http://stackoverflow.com/q/24527391
type: Tag
tags question: http://stackoverflow.com/q/24427685
tags question: http://stackoverflow.com/q/24588056
tags question: http://stackoverflow.com/q/24509754
tag name: unit-testing
tags question: http://stackoverflow.com/q/24492365
tags question: http://stackoverflow.com/q/24497087
tags question: http://stackoverflow.com/q/24573988
tags question: http://stackoverflow.com/q/24540951
tags question: http://stackoverflow.com/q/24456001
tags question: http://stackoverflow.com/q/24551166
tags question: http://stackoverflow.com/q/24548085
tags question: http://stackoverflow.com/q/24455021
tags question: http://stackoverflow.com/q/24437556
tags question: http://stackoverflow.com/q/24514667
tags question: http://stackoverflow.com/q/24456057

http://stackoverflow.com/a/24482032
type: AcceptedAnswer
downvote count: 0
has body: You are mostly correct. The native character representation in java is UTF-16. However when converting characters to bytes you either specify the charset you are using, or the system uses it's default which has usually been UTF-8 whenever I checked. This will yield interesting results if you are mixing and matching. eg for my system the following System.out.println(Charset.defaultCharset().name()); ByteBuffer bybf = ByteBuffer.wrap("Olé".getBytes()); Charset utf16 = Charset.forName("UTF-16"); CharBuffer chbf = utf16.decode(bybf); System.out.println(chbf); bybf = ByteBuffer.wrap("Olé".getBytes(utf16)); chbf = utf16.decode(bybf); System.out.println(chbf); produces UTF-8 佬쎩 Olé So this part is only correct if UTF-16 is the default charset getBytes() result is this same UTF-16 byte sequence. So either always specify the charset you are using which is safest as you will always know what is going on, or always use the default.
accepted answer of: http://stackoverflow.com/q/24481238
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/37899556
answers question: http://stackoverflow.com/q/24481238
has comment: http://stackoverflow.com/comment/37899544
has comment: http://stackoverflow.com/comment/37895164
score: 11

http://stackoverflow.com/a/24912174
has body: I had to move this to it's own variable and to close it new java.io.StringReader(doc)
accepted answer of: http://stackoverflow.com/q/24456836
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24456836
score: 2
downvote count: 0

http://stackoverflow.com/comment/38066771
type: QuestionComment
comment on: http://stackoverflow.com/q/24574804
has text: I thought about that, but not as giving it an entire class -- I'll give it a go. Also what do you think of 'brute forcing' it? e.g I have an array of things that use the color, I generate a color check if it's been used and if it has regenerate?
score: 0
type: Comment

http://stackoverflow.com/a/24546872
has body: It seems that your cursor is empty. So instead of checking null cursor try checking - if(cursor.getCount() &gt; 0) { //do stuff } else { //Empty cursor } Then check where the control is going - going in if condition or in else condition. UPDATE: Since the cursor.getCount() returned 0, so there is no data in your cursor. To get data you can do following - Cursor cursor = Db.query(TABLE_NAME, new String[] { COLUMN_ID, COLUMN_TITLE, COLUMN_BODY }, COLUMN_ID + "= 2", null, null, null, null, null); NOTE: rowid = 2 is the row id from your table TABLE_NAME. You can check this table and see what rowid is there for this table and substitute it in place of 2. The problem is because your dynamic rowid is not matched with your any of the table rowid. ILLUSTRATION - | _ID | TITLE | NOTES | -------------------------------------------------- | 1 | jsush | ----- | -------------------------------------------------- | 2 | jsushshai | ----- | -------------------------------------------------- Looking at the table, it is clear that you have only two rowid values 1 and 2. So if your query does not match any of these values from its rowid then the cursor will be empty. You passed the rowid value in a method getNote(long rowId) which doesn't match any of the table rowid. The similar situation is here you can look for more help - cursorindexoutofboundsexception-index-0-requested-with-a-size-of-0 UPDATE: Try this - public Cursor getNote(long rowId) throws SQLException { Cursor cursor = Db.query("notes", new String[] { "_ID", "TITLE", "NOTES"}, "_ID=1", null, null, null, null, null); cursor.moveToFirst(); if(cursor.getCount() &gt; 0) { //do stuff } else { //Empty cursor } return cursor; }
has comment: http://stackoverflow.com/comment/38018260
upvote count: 1
has comment: http://stackoverflow.com/comment/38018291
answers question: http://stackoverflow.com/q/24546749
has comment: http://stackoverflow.com/comment/38018696
has comment: http://stackoverflow.com/comment/38016639
has comment: http://stackoverflow.com/comment/38019200
has comment: http://stackoverflow.com/comment/38018869
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38017674
has comment: http://stackoverflow.com/comment/38015242
has comment: http://stackoverflow.com/comment/38017428
accepted answer of: http://stackoverflow.com/q/24546749
has comment: http://stackoverflow.com/comment/38015839
type: Answer
has comment: http://stackoverflow.com/comment/38015090
has comment: http://stackoverflow.com/comment/38018444
has comment: http://stackoverflow.com/comment/38017716
score: 1

http://stackoverflow.com/comment/37906585
comment on: http://stackoverflow.com/a/24480622
type: AnswerComment
score: 0
has text: `KeyChain` API is available only for devices with android 4.0 and above.
type: Comment

http://stackoverflow.com/comment/37799226
comment on: http://stackoverflow.com/q/24430656
score: 1
has text: `cuisine_name.setText(cuisine + ", " + priceCategory);` and remove `price_category` TextView
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33031936
score: 40
upvote count: 41
has comment: http://stackoverflow.com/comment/111209248
has comment: http://stackoverflow.com/comment/75205306
answers question: http://stackoverflow.com/q/24471109
downvote count: 1
has comment: http://stackoverflow.com/comment/111221658
type: Answer
has body: I have nice solution for RecyclerView's onItemClickListener for the items and subitems Step 1- Create an interface public interface OnRecyclerViewItemClickListener { /** * Called when any item with in recyclerview or any item with in item * clicked * * @param position * The position of the item * @param id * The id of the view which is clicked with in the item or * -1 if the item itself clicked */ public void onRecyclerViewItemClicked(int position, int id); } Step 2- Then use it in adapter's onBindViewHolder method in the following way /** * Custom created method for Setting the item click listener for the items and items with in items * @param listener OnRecyclerViewItemClickListener */ public void setOnItemClickListener(OnRecyclerViewItemClickListener listener) { this.listener = listener; } @Override public void onBindViewHolder(ViewHolder viewHolder, final int position) { // viewHolder.albumBg.setBackgroundResource(_itemData[position] // .getImageUrl()); viewHolder.albumName.setText(arrayList.get(position).getName()); viewHolder.artistName.setText(arrayList.get(position).getArtistName()); String imgUrl = arrayList.get(position).getThumbImageUrl(); makeImageRequest(imgUrl, viewHolder); viewHolder.parentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onRecyclerViewItemClicked(position, -1); } }); viewHolder.settingButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onRecyclerViewItemClicked(position, v.getId()); } }); } // class to hold a reference to each item of RecyclerView public static class ViewHolder extends RecyclerView.ViewHolder { public TextView albumName, artistName; public ImageView albumIcon, settingButton; public LinearLayout parentView; public ViewHolder(View itemLayoutView) { super(itemLayoutView); // albumBg = (LinearLayout) itemLayoutView // .findViewById(R.id.albumDlbg); albumName = (TextView) itemLayoutView.findViewById(R.id.albumName); art…
has comment: http://stackoverflow.com/comment/111221726
has comment: http://stackoverflow.com/comment/54584660

http://stackoverflow.com/q/24431693
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24464871
accepted answer: http://stackoverflow.com/a/24464871
tagged with: hql
type: Question
tagged with: projection
has title: Hibernate HQL Projection Issue with Set Using AliasToBeanResultTransformer
answer count: 1
score: 0
has body: I am having a problem with Hibernate HQL Projection using the AliasToBeanResultTransformer, basically the result I am trying to return isn't being mapped properly to the bean, here is the situation: The HQL query that I am using is this: select entity.categoryTypes as categoryTypes from nz.co.doltech.ims.server.entities.IncidentEntity entity where (entity.id = :id105019) I want to get the CategoryType's from the IncidentEntity based on its join relationship. This works fine when I'm not attempting to use any transformer on it. categoryTypes is a Set and the transformer keeps trying to check the Method's parameter types and fails because instead of finding a CategoryTypeEntity it finds a java.util.Set as if its trying to map a single CategoryTypeEntity into the categoryTypes field. I would have thought that because its a Set it would pull the data out as a Set and then try map it to the categoryTypes field. Apparently not though. @javax.persistence.Entity(name = "incidents") @Cache(usage=CacheConcurrencyStrategy.TRANSACTIONAL) public class IncidentEntity implements Entity { ... @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "incident_categorytype", joinColumns = { @JoinColumn(name = "incident_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "categorytype_id", nullable = false, updatable = false) }) private Set&lt;CategoryTypeEntity&gt; categoryTypes = new HashSet&lt;CategoryTypeEntity&gt;(); ... public Set&lt;CategoryTypeEntity&gt; getCategoryTypes() { return categoryTypes; } public void setCategoryTypes(Set&lt;CategoryTypeEntity&gt; categoryTypes) { this.categoryTypes = categoryTypes; } } Here is the call I make: Query query = session.createQuery("select entity.categoryTypes as categoryTypes from nz.co.doltech.ims.server.entities.IncidentEntity entity " + "where (entity.id = :id105019)") query.setResultTransformer(Transformers.aliasToBean(IncidentEntity.class)); return query.list(); The exceptions I get are: Caused by: or…
type: AnsweredQuestion
tagged with: resulttransformer
linked to: http://stackoverflow.com/q/18713235

http://stackoverflow.com/q/24555005
has answer: http://stackoverflow.com/a/24555351
type: Question
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/61982131
has comment: http://stackoverflow.com/comment/38030327
has answer: http://stackoverflow.com/a/61982131
tagged with: java
has body: Following is the folder structure of my application, I have created a resource folder under webapp which has resource folders for CSS and JS In the servlet-context file I have mapped the resources to resources/inspiremetheme as below, &lt;mvc:resources mapping="/resources/**" location="/resources/inspiremetheme/" /&gt; I have included in JSP page as below, &lt;head&gt; &lt;script type="text/javascript" src="/resources/js/jquery-1.11.1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/resources/js/inspireme.js"&gt;&lt;/script&gt; &lt;link type="text/css" rel="stylesheet" href="&lt;c:url value="resources/css/global.css"/&gt;" /&gt; &lt;/head&gt; The problem here is I am not able to load my JS files where as the CSS file is loaded properly. I was not able to understand what I have missed. Update - 1: The file structure after unzipping is as below, Inspireme | |------ META-INF | |------resources --> inspiremetheme --> css and js folders | |------ WEB-INF --> classes, jsp, lib, web.xml
accepted answer: http://stackoverflow.com/a/24555351
has comment: http://stackoverflow.com/comment/38029891
answer count: 2
has comment: http://stackoverflow.com/comment/38030342
downvote count: 0
tagged with: javascript
has comment: http://stackoverflow.com/comment/38030274
has comment: http://stackoverflow.com/comment/38029975
has comment: http://stackoverflow.com/comment/38030376
tagged with: css
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38030077
has title: Spring-Maven: Unable to load Javascript file
tagged with: maven
tagged with: spring

http://stackoverflow.com/comment/38059655
score: 0
type: Comment
type: QuestionComment
has text: This command is used in script file where variable path is to be used. Is the above right for passing the argument path to script file? How to use this argument in script file
comment on: http://stackoverflow.com/q/24568613

http://stackoverflow.com/q/24511817
has comment: http://stackoverflow.com/comment/37950265
has comment: http://stackoverflow.com/comment/37949500
tagged with: interpolation
tagged with: java
has answer: http://stackoverflow.com/a/24512119
has comment: http://stackoverflow.com/comment/37949238
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24512004
tagged with: math
has comment: http://stackoverflow.com/comment/37949679
score: 0
answer count: 2
has title: cubic interpolation in java
has comment: http://stackoverflow.com/comment/37949404
has comment: http://stackoverflow.com/comment/37949482
has comment: http://stackoverflow.com/comment/37949643
favorite count: 0
has comment: http://stackoverflow.com/comment/37949179
has body: For a Java program I'm making I need to interpolate 4 points, to calculate the y-value of a 5th point, at given x-value. Say I have the following points: p1(0, 0) p2(1, 2) p3(2, 4) p4(3, 3) // The x-values will always be 0, 1, 2, and 3 Now I want to interpolate these points to find what the y-value should be for given x, say x=1.2 (this x value will always be between point 2 and point 3) Can anyone help me to make a Java method for finding the y coordinate of this fifth point?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37949445

http://stackoverflow.com/comment/37824976
comment on: http://stackoverflow.com/q/24444565
has text: Have you considered reading the [documentation](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42664769
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24451026
type: Comment
has text: There's no such method as setOutline()...

http://stackoverflow.com/comment/37797667
score: 1
type: Comment
has text: Check this link : http://tuckey.org/urlrewrite/ . You can also try out apache mod_rewrite : http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
type: AnswerComment
comment on: http://stackoverflow.com/a/24428857

http://stackoverflow.com/a/24499601
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24489186
has comment: http://stackoverflow.com/comment/72011741
type: Answer
has comment: http://stackoverflow.com/comment/72001842
has comment: http://stackoverflow.com/comment/37942323
score: 18
upvote count: 18
answers question: http://stackoverflow.com/q/24489186
has body: If you are using Jackson (which should be the default for JBoss EAP 6) you can use custom JsonSerializers For the LocalDate: public class DateSerializer extends JsonSerializer&lt;LocalDate&gt; { @Override public void serialize(LocalDate date, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeString(date.toString("dd/MM/yyyy")); } } For the Money: public class MoneySerializer extends JsonSerializer&lt;Money&gt; { @Override public void serialize(Money money, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeStringField("val", money.getAmount().toString()); jgen.writeStringField("curr", money.getCurrencyUnit().getCurrencyCode()); jgen.writeEndObject(); } } Both Serializers can be registered globally: @Provider public class JacksonConfig implements ContextResolver&lt;ObjectMapper&gt; { private ObjectMapper objectMapper; public JacksonConfig() { objectMapper = new ObjectMapper(); SimpleModule module = new SimpleModule("MyModule", new Version(1, 0, 0, null)); module.addSerializer(Money.class, new MoneySerializer()); module.addSerializer(LocalDate.class, new DateSerializer()); objectMapper.registerModule(module); } public ObjectMapper getContext(Class&lt;?&gt; objectType) { return objectMapper; } } For parsing JSON in this custom format you need to implement custom JsonDeserializers. If you are using Jettison you can do the same thing with custom XmlAdapters.

http://stackoverflow.com/comment/37949100
type: Comment
has text: @skiwi yes you are right - and actually SIZED is removed by the `spliteratorUnknownSize` method. I have amended.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24511534

http://stackoverflow.com/a/24546160
has body: An abstract class is good choice : If you think you will plan on using inheritance since it provides a common base class implementation to derived classes If you want to be able to declare non-public members. If you think you will need to add methods in the future When you want some methods with definitions – so an abstract class can have non-abstract methods with actual implementation details. But remember an abstract class cannot be instantiated. It can only be used as a superclass for other classes that extend the abstract class.
type: Answer
answers question: http://stackoverflow.com/q/24545947
score: 0

http://stackoverflow.com/q/24580361
has body: controllers->Students.java public class Students extends Controller { /* Create a new student form */ public static Result create(){ Form&lt;Student&gt; studentform = form(Student.class); return ok(createstudentform.render(studentform)); } public static Result save(){ Form&lt;Student&gt; studentform = form(Student.class).bindFromRequest(); if(studentform.hasErrors()){ return badRequest(createstudentform.render(studentform)); } studentform.get.save(); flash("success", "Student" + studentform.get().usn + "has been created"); return ok(index.render("Your new application is ready.")); } } Routes: # Home page GET / controllers.Application.index() # Add a student GET /students/new controllers.Students.create() POST /students controllers.Students.save() # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.at(path="/public", file) Compilation error: Cannot use a method returning javax.xml.transform.Result as an Handle
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38080053
tagged with: routes
has title: Compiler error : Cannot use a method returning javax.xml.transform.Result as an Handler in routes in play framework
score: 0
tagged with: playframework
tagged with: playframework-2.2
has comment: http://stackoverflow.com/comment/38078213
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38079117
answer count: 0

http://stackoverflow.com/comment/38017440
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24545589
has text: @AlexR Reflection can also make final fields non final. `Field field = MyClass.class.getDeclaredField("val"); field.setAccessible(true); field.setInt(r, 2);` will set `val` to 2 despite being final. Even [string can be made mutable](http://stackoverflow.com/questions/20945049/is-a-java-string-really-immutable)

http://stackoverflow.com/a/26237056
answers question: http://stackoverflow.com/q/24437564
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: I found these instructions in a comment. Download the newest version of ADT and use your existing workspace. This is actually the least pain-full upgrade you'll ever do. It didn't mess with the .android folder so I still had my original debug key. Only things missing were a couple of add ons I hardly ever use and they are easily installed into the new version. Note don't install into your existing adt folder create a new folder so you can still fall back if the new install doesn't work.

http://stackoverflow.com/comment/38397325
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24608780
has text: This is not a correct answer as this only changed the language to other than what OP wanted, the zh_TW. The OP wanted to set to half-wdith in language zh_TW which can't be achieved in any of the methods described in this answer.

http://stackoverflow.com/comment/37805237
has text: Thanks for that, quite right. I ended up validating the HTML elements existed rather than doing string comparisons.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24428923

http://stackoverflow.com/a/24554140
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38028415
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24553884
has body: The simplest way is to have CustFragmentOne, CustFragmentTwo, etc. implement a common interface. That way you just need to do a single instanceof check against that interface, instead of needing to check each concrete class individually. Another way would be something like along these lines: How to implement onBackPressed() in Fragments?
answers question: http://stackoverflow.com/q/24553884
upvote count: 2

http://stackoverflow.com/comment/37994921
comment on: http://stackoverflow.com/q/24530647
score: 0
type: Comment
type: QuestionComment
has text: Add your solution as an answer for other user please.

http://stackoverflow.com/q/24484776
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/24488988
has comment: http://stackoverflow.com/comment/37901641
answer count: 2
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/37900307
score: 4
has body: I'm trying to tune IntelliJ IDEA. In the company I now work they use Nexus as a store for Maven plugins. In maven settings file (.m2/settings.xml) there are Nexus repositories : .../nexus/content/repositories/releases .../nexus/content/repositories/releases-temporal/ .../nexus/content/repositories/snapshots In IDEA I see errors like: Plugin '''org.apache.maven.plugins:maven-project-info-reports-plugin:2.7''' not found Inspects a Maven model for resolution problems. Though Nexus contains it as I can see through it's web interface. What might be the problem?
has comment: http://stackoverflow.com/comment/37900615
has comment: http://stackoverflow.com/comment/37900930
favorite count: 0
has comment: http://stackoverflow.com/comment/37900527
has title: IntelliJ IDEA shows plugin not found
type: UnansweredQuestion
tagged with: maven
tagged with: java
has answer: http://stackoverflow.com/a/24485632

http://stackoverflow.com/comment/37966536
type: QuestionComment
has text: How would you describe it in an xsd?
score: 0
comment on: http://stackoverflow.com/q/24520991
type: Comment

http://stackoverflow.com/comment/37835157
type: Comment
type: QuestionComment
has text: Use variable after you put something in it, then it will not print NULL
comment on: http://stackoverflow.com/q/24450300
score: 0

http://stackoverflow.com/q/24489192
possible better answer: http://stackoverflow.com/a/24489281
type: Question
has answer: http://stackoverflow.com/a/24489281
upvote count: 0
favorite count: 0
has title: How to make this generic?
answer count: 3
has answer: http://stackoverflow.com/a/24489322
tagged with: generics
has comment: http://stackoverflow.com/comment/37908057
downvote count: 3
score: -3
has answer: http://stackoverflow.com/a/24489260
has body: I have got a question. How to make this whole code generic? So the variables, methods and classes? If somebody can show how this have to be done. It would help me a lot! public class Linkedlist { private Node head; private class node{ Object data; Node next; } //Getter for data head-node Object getFirstDate () { Thanks!
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24489260
tagged with: java

gradle
tags question: http://stackoverflow.com/q/24537373
tags question: http://stackoverflow.com/q/24539899
tags question: http://stackoverflow.com/q/24575163
tags question: http://stackoverflow.com/q/24470814
tags question: http://stackoverflow.com/q/24538929
type: Tag
tags question: http://stackoverflow.com/q/24481014
tags question: http://stackoverflow.com/q/24560732
tags question: http://stackoverflow.com/q/24537841
tags question: http://stackoverflow.com/q/24526027
tag name: gradle
tags question: http://stackoverflow.com/q/24499692
tags question: http://stackoverflow.com/q/24547943
tags question: http://stackoverflow.com/q/24566687
tags question: http://stackoverflow.com/q/24448366
tags question: http://stackoverflow.com/q/24531483
tags question: http://stackoverflow.com/q/24548085
tags question: http://stackoverflow.com/q/24521235
tags question: http://stackoverflow.com/q/24460299
tags question: http://stackoverflow.com/q/24497871

http://stackoverflow.com/comment/37864814
type: AnswerComment
comment on: http://stackoverflow.com/a/24464405
type: Comment
has text: Another way - Cursor c = database_ob.query(dbobj.TABLE_NAME, cols, null,null, null, null, dbobj.KEY_ID + " DESC ");
score: 0

http://stackoverflow.com/a/24440060
has comment: http://stackoverflow.com/comment/37853592
upvote count: 2
has comment: http://stackoverflow.com/comment/37841441
has comment: http://stackoverflow.com/comment/37845005
type: Answer
answers question: http://stackoverflow.com/q/24436921
score: 2
downvote count: 0
has body: A good way to implement a plugin architecture in OSGi is to use OSGi services. You package the Fizz interface and everything else that forms your API into one bundle. Then you use a second bundle for the FizzImpl and use an activator or e.g. blueprint to publish the impl instance as an OSGi service. The last part is your main application which needs to bind the service and call the service using the interface. So this would be your default setup. Then someone can create another bundle with an alternative implementation and also publish it as a service. To distinguish the two services you can specify properties when publishing the service. Then in your main application you can use a configurable filter to bind the service which matches the filter. So you can switch the impl by changing the filter. I used this approach in cxf xkms to implement an ldap based backend for xkms that can be switched for something else. This is the blueprint file for the ldap impl: https://github.com/apache/cxf/blob/master/services/xkms/xkms-x509-repo-ldap/src/main/resources/OSGI-INF/blueprint/blueprint.xml and this is the blueprint xml for the main application: https://github.com/apache/cxf/blob/master/services/xkms/xkms-osgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml and as a last part this is the java code to bind a service using a configurate filter: https://github.com/apache/cxf/blob/master/services/xkms/xkms-service/src/main/java/org/apache/cxf/xkms/service/CertificateRepoProxyFactory.java
has comment: http://stackoverflow.com/comment/37848175

http://stackoverflow.com/q/24525899
accepted answer: http://stackoverflow.com/a/24533698
answer count: 1
has title: SimpleDateFormat: Inconsistent Pattern Letters
favorite count: 0
has comment: http://stackoverflow.com/comment/37975565
has body: Recently I looked into the Documentation for SimpleDateFormat and noticed some inconsistencies (in my opinion) in how they handle the letters for parsing. For example, look at these representations: M: Month in year D: Day in year d: Day in month "x in year" is a bigger timespan than "x in month" and has therefore uppercase letters so this makes perfect sense to me. But then there is w: Week in year W: Week in month Here, the letters are swapped, which is totally counter-intuitive in my opinion. It seems like these two should be the other way around, to conform to the "pattern" mentioned above. Another example are the different hour-representations: H: Hour in day (0-23) k: Hour in day (1-24) K: Hour in am/pm (0-11) h: Hour in am/pm (1-12) I kinda get the idea. Uppercase letters for hours starting with 0, lowercase letters for hours starting with 1. Here, both lowercase letters should be swapped, because shouldn't the same letters belong to the same category? (H/h for hour in day, K/k for hour in am/pm) So my question is this: Is there a reason behind this seemingly counter-intuitive representation? The only reason i could think of is, that some of these pattern letters were added at a later time and they couldn't change the already existing ones, because of downwards compatibility. But other than that, it doesn't make much sense to me.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24533698
upvote count: 1
downvote count: 1
type: Question
tagged with: simpledateformat
score: 0

http://stackoverflow.com/comment/38011557
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24544907
has text: maybe like `String s1=req.getResponse().toString();`?
score: 5

http://stackoverflow.com/q/24432346
tagged with: spring
has comment: http://stackoverflow.com/comment/37802397
has body: I have create a service bean and declare variable . Pseudocode : //one class @Service @Transactional(propagation=Propagation.REQUIRES_NEW) public class CustomerService { public Map<Long,Boolean> someMap= new HashMap<>(); } //caller class @Component @Path("/maincontroller") class MainCaller{ @Autowired CustomerService customerService; @POST @Path("/process") public Response processCustomer() { try{ //some processing }finally{ synchronized (customerService.someMap) { //liee 64 //do some work on map } } } I am getting null pointer exception @liee a i dont understand this. As far i know spring creates bean after initializing all its properties. and as i declared someMap with new variable it should not be null. then why it is giving null pointer exception. ERROR : com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container java.lang.NullPointerException at org.hungama.controller.MainCaller.processCustomer(MainCaller.java:64) //Web.xml contextConfigLocation /WEB-INF/config/rest-servlet.xml org.springframework.web.context.ContextLoaderListener jersey-serlvet com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages org.test.controller 1 jersey-serlvet /rest/* //SPRING-CONTEXT <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc…
has comment: http://stackoverflow.com/comment/37803166
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24440698
has comment: http://stackoverflow.com/comment/37802402
tagged with: java
has comment: http://stackoverflow.com/comment/37802335
has comment: http://stackoverflow.com/comment/37803641
type: Question
has comment: http://stackoverflow.com/comment/37802515
has comment: http://stackoverflow.com/comment/37802765
tagged with: jersey
has title: spring property initialization issue
has comment: http://stackoverflow.com/comment/37803094
has comment: http://stackoverflow.com/comment/37803705
has comment: http://stackoverflow.com/comment/37803377
score: 0
has comment: http://stackoverflow.com/comment/37802881
has comment: http://stackoverflow.com/comment/37802326
answer count: 1
has comment: http://stackoverflow.com/comment/37802248
has comment: http://stackoverflow.com/comment/37803201
has comment: http://stackoverflow.com/comment/37802230
has answer: http://stackoverflow.com/a/24440698
has comment: http://stackoverflow.com/comment/37803110
has comment: http://stackoverflow.com/comment/37803331
has comment: http://stackoverflow.com/comment/37803206
has comment: http://stackoverflow.com/comment/37802780
has comment: http://stackoverflow.com/comment/37803613
has comment: http://stackoverflow.com/comment/37802178

http://stackoverflow.com/comment/38085394
comment on: http://stackoverflow.com/q/24584710
type: Comment
has text: And the jar in the folder where you call `javac`?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37856877
has text: I think this might be similar to https://stackoverflow.com/questions/24396722/dll-calling-another-dll-with-jna ?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24461687

http://stackoverflow.com/comment/37989656
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24533068
has text: Thanks Artem for your response.I am glad to see you on SO.Just I am using default <aggregator> behaviour:<int:aggregator input-channel="test4" ref="xmlAggregator" method="aggreagateAdditionalFolders"></int:aggregator>. The problem here is I am using many Xpath splitters in the code, but I just need the aggregation of the messages split by the first splitter. However I am able to get the split messages of the first splitter in different lists of messages. But, Ideally, they should arrive as a single list of messages at the aggregator end. It would be great if you can share some pseudo code.

http://stackoverflow.com/comment/38163848
type: AnswerComment
type: Comment
has text: I got you but imagine 1000 users are retrieved and the server needs to format them all. Even using the cached patterns it takes CPU time and memory to do the formattation.
comment on: http://stackoverflow.com/a/24624612
score: 0

http://stackoverflow.com/comment/37933770
has text: Can you post your logcat output ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24503024

http://stackoverflow.com/q/24497871
type: Question
linked to: http://stackoverflow.com/q/592448
has comment: http://stackoverflow.com/comment/37924390
tagged with: file-permissions
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24844417
favorite count: 0
tagged with: linux
tagged with: windows
accepted answer: http://stackoverflow.com/a/24844417
type: AnsweredQuestion
score: 2
has body: I am developing my program on redhat 6 and I set my permissions in Gradle with commandLine 'chmod', '-R', '775', '&lt;myFolder&gt;' This is great but it will not work on Windows. Does Gradle have a platform-independent way of setting program permissions?
upvote count: 2
has title: Is there a platform-indepenent way of setting file permissions with gradle?
tagged with: java
tagged with: gradle

http://stackoverflow.com/q/24535528
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/37994083
has title: Run java Selenium in command prompt
has comment: http://stackoverflow.com/comment/37993749
has answer: http://stackoverflow.com/a/24535909
accepted answer: http://stackoverflow.com/a/24535909
type: AnsweredQuestion
has body: I have this code: import org.openqa.selenium.firefox.FirefoxDriver; public class Test { public static void main(String[] args) { try{ FirefoxDriver driver = new FirefoxDriver(); driver.get("http:\\www.yahoo.com"); } catch(Exception e){ e.printStackTrace(); } } } and I want to run it in cmd. For this reason I call the following commands in a .bat file. javac -classpath "C:\selenium-2.42.2\selenium-server-standalone-2.42.2.jar;C:\selenium-2.42.2\selenium-java-2.42.2.jar;C:\selenium-2.42.2\selenium-firefox-driver-2.42.2.jar" Test.java java Test The following error is returned: C:\selenium-2.42.2&gt;javac -classpath "C:\selenium-2.42.2\selenium-server-standalo ne-2.42.2.jar;C:\selenium-2.42.2\selenium-java-2.42.2.jar;C:\selenium-2.42.2\sel enium-firefox-driver-2.42.2.jar" Test.java C:\selenium-2.42.2&gt;java Test Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/f irefox/FirefoxDriver at Test.main(Test.java:6) Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.firefox.Firefox Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more Also, the following information will help: java -version got: java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) C:\Program Files (x86)\Mozilla Firefox&gt;firefox.exe -v | more Mozilla Firefox 30.0 Maybe this post will marked as duplicate but I followed others suggestions without any success. Can you please cast some light the situation? Here is the jar files I use. Thanks! PS: Win7 64bit
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/37865170
comment on: http://stackoverflow.com/a/24457132
score: 0
has text: Thanks for the definition. I probably should just go on and try using a single port instead.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37959559
comment on: http://stackoverflow.com/q/24517126
type: QuestionComment
has text: I'm not translating the view, the `octagon` method draws the _actual_ joystick, where the Joystick class is just the View for the whole thing.
type: Comment
score: 0

http://stackoverflow.com/comment/38000952
type: Comment
type: QuestionComment
has text: Complete answer here: [Java Language Keywords](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html). Only `const` and `goto` are currently reserved but not used.
score: 2
comment on: http://stackoverflow.com/q/24539332

http://stackoverflow.com/comment/37957927
type: Comment
type: QuestionComment
has text: `moveBelow` sets the position in the 'Z order' which is used to control the order controls are drawn when they **overlap**.
score: 0
comment on: http://stackoverflow.com/q/24515655

http://stackoverflow.com/q/24579020
has answer: http://stackoverflow.com/a/24579068
tagged with: boolean
score: 0
has body: I am a beginner Java student. This is the general idea of what I'm doing. I have a list of things that a user can pick from by inputting the corresponding number. After they input ONE integer, the string next to the item prints as YES. If they decide they don't want it anymore, they have to input that same number again and then string is supposed to change to NO. My nested loop technique is allowing for this change, but changes it right back after reading the next if statement. I have been working on this for a very long time. Can anyone please nudge me in the right direction to identify this problem? do { int num=input.nextInt(); if (num == 7) { if(s.equals("NO")) //corresponding string { s = "YES"; } if(s.equals("YES")) //same corresponding string { s = "NO"; } } //similar if statements for different conditions //similar if statements for different conditions }while(myBoolean()==true);
answer count: 3
has comment: http://stackoverflow.com/comment/38074822
accepted answer: http://stackoverflow.com/a/24579243
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: do-while
possible better answer: http://stackoverflow.com/a/24579062
tagged with: if-statement
has answer: http://stackoverflow.com/a/24579062
has answer: http://stackoverflow.com/a/24579243
has title: How to write a nested if statement within a Do-While Loop?

http://stackoverflow.com/q/24518393
tagged with: java
tagged with: classpath
has title: java command line compilation
type: Question
has body: I have a simple, single file java program that relies on a single static jar. The java code and the jar reside in the same directory. For this one-off solution I don't want to bring in the weight of ant or maven, and just want to compile it directly. On my dev box, the following compiles and runs my code fine: javac -cp ".;dependency.jar" File.java java -cp ".;dependency.jar" File However, on my test box, the java command fails, and I get the following output: Error: Could not find or load main class File If I change my classpath arg to -cp "." I get the following output: Exception in thread "main" java.lang.ClassNotFoundException: dependency My dev box is 64-bit Windows/Cygwin and java version 1.7.0_55. My test box is 64-bit Linux and java version 1.7.0_45. What is going wrong on my test box?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24518417
favorite count: 0
has answer: http://stackoverflow.com/a/24518417
type: AnsweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/q/24532002
possible better answer: http://stackoverflow.com/a/24532230
has answer: http://stackoverflow.com/a/24532230
has answer: http://stackoverflow.com/a/24532129
upvote count: 1
has comment: http://stackoverflow.com/comment/37986979
has body: I checked all the methods, didn't worked! I want to check when the Button is clicked set text to "Good" else set the text to "Jump". and is this possible? The Button text it "Jump" and when clicked set to "Good" else reset the text to original without using setText again? public void onClick(View arg0) { // TODO Auto-generated method stub if(b.isSelected()){ b.setText("Good"); } else b.setText("Jump"); } });
type: AnsweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24532205
has answer: http://stackoverflow.com/a/24532112
type: Question
accepted answer: http://stackoverflow.com/a/24532205
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/37986808
has comment: http://stackoverflow.com/comment/37986853
tagged with: android
tagged with: android-activity
answer count: 4
has title: How to check if button has clicked run this else this?

http://stackoverflow.com/comment/37968291
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24521937
has text: I'd suggest you to use `System.out.println(newConvert.getInput())` instead :)

http://stackoverflow.com/comment/37954619
has text: also see http://stackoverflow.com/q/16680096/262852 perhaps threads, or a thread pool, is the standard approach.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24514575

http://stackoverflow.com/q/24519449
linked to: http://stackoverflow.com/q/819720
answer count: 4
downvote count: 0
has title: unable to marshal type as an element because it is missing an @XmlRootElement annotation for auto generated classes
favorite count: 0
type: Question
has body: I need to validate Class object against my schema in which I have provided regular expression to validate fields for auto generated JAXB classes. When I try to validate my class object I get below error: unable to marshal type "xyz" as an element because it is missing an @XmlRootElement annotation Here is the code that I use to validate my autogenerated class object: jc = JAXBContext.newInstance(obj.getClass()); source = new JAXBSource(jc, obj); Schema schema = schemaInjector.getSchema(); Validator validator = schema.newValidator(); validator.validate(source); Is there any other way I can solve this?
has answer: http://stackoverflow.com/a/24520105
linked to: http://stackoverflow.com/q/76178871
has answer: http://stackoverflow.com/a/59249216
has answer: http://stackoverflow.com/a/24673266
has answer: http://stackoverflow.com/a/53545520
score: 76
tagged with: jakarta-ee
tagged with: schema
tagged with: java
type: UnansweredQuestion
tagged with: jaxb
upvote count: 76

http://stackoverflow.com/comment/37911181
comment on: http://stackoverflow.com/a/24490795
has text: :) someone got in whilst I was typing
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38062679
type: AnswerComment
has text: Please remove your above comment - it contains your personal credentials!!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24571802

http://stackoverflow.com/q/24586630
type: Question
tagged with: graphics
has body: I've a listView and each row has an icon . I want when I click on the row , the image begin to rotating around in the center of its self , Like a progressbar . I'v searched , But I really don't know anything about graphic in java and it's all I need from it !! thanks
accepted answer: http://stackoverflow.com/a/24587337
score: 0
answer count: 1
has title: java-Rotating image in it's position
tagged with: android
has answer: http://stackoverflow.com/a/24587337
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38089394
tagged with: java

http://stackoverflow.com/q/24546873
upvote count: 0
answer count: 1
favorite count: 0
has body: I am receiving a DateTime object from external system. I receive a date like 2012-06-20T13:30:00+05:30. The external system has created the date using the Joda-Time API. I am not able to find the corresponding Date format for this. Moreover I want to convert the time to 09:00:00+01:30 (different time zone).
tagged with: timezone
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/38015040
has answer: http://stackoverflow.com/a/24559377
has comment: http://stackoverflow.com/comment/38015824
tagged with: java
downvote count: 2
type: Question
tagged with: jodatime
score: -2
has comment: http://stackoverflow.com/comment/38015067
has title: Want to determine convert time as per specific time zone

http://stackoverflow.com/a/24548478
type: Answer
answers question: http://stackoverflow.com/q/24547766
has body: I would suggest to create another temporary bean in your context, and use it in your conditional case. unfortunately, I will have to call getBean() method to reassign my reference to the temp bean. For example: In your configuration file, you will have to define two beans: &lt;bean id="originalBean" class="x.y.z.MyBean" /&gt; &lt;bean id="temporaryBean" class="x.y.z.MyBean" /&gt; And in your beans that reference that bean you will have to autowire using the @Qualifer @Autowired @Qualifier("originalBean") private MyBean myBean; And in your conditional use case you will reassign that reference to the temporaryBean if(conditioalCase) { myBean = ApplicationContext.getBean("temporaryBean"); }
score: 0

http://stackoverflow.com/comment/37971383
score: 0
comment on: http://stackoverflow.com/q/24523627
type: Comment
type: QuestionComment
has text: could you give the code to me ? I want it to be parsed from string

http://stackoverflow.com/comment/51984755
comment on: http://stackoverflow.com/a/24746411
type: Comment
has text: I agree with @EpicPandaForce on this one. I also came to upvote this answer after reading the section of Commonsware's book on handling clicks in RecyclerViews It has worked great for me so far.
score: 2
type: AnswerComment

http://stackoverflow.com/a/24495543
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24493125
answers question: http://stackoverflow.com/q/24493125
type: Answer
upvote count: 2
has body: Checkstyle is perfectly happy with the source files only. Compiled versions of your classes are not required. However, it is still better to have compiled classes available, because a few individual checks do make use of compiled .class files. These checks mention the fact that they need binaries in their documentation. One is the JavadocMethod check you mention. This one will still function without binaries, but you may see some irritation in the logs. The other check I can think of needing compiled classes is RedundantThrows. This one will probably not do much good with only sources. You'd have to give it a try. In both cases, you can suppress the load errors by setting the suppressLoadErrors property to true. Without binaries, the check will not be able to gather inheritance information. So some features of the check will be limited, but it will otherwise work fine or at least not bother you.
has comment: http://stackoverflow.com/comment/45135224
score: 2

http://stackoverflow.com/q/24488821
tagged with: oop
has comment: http://stackoverflow.com/comment/37908584
score: 1
has comment: http://stackoverflow.com/comment/37935600
tagged with: java
accepted answer: http://stackoverflow.com/a/24515766
has body: I want to ask if there is a possible way to switch the tab panels from a click of a button in another class. I have 2 class and classA is in default package and the other one is in another package. My button is placed in classB and my tabbed panes are in classA. How can I change tabs by clicking the button in my classB? If passing variables are not going to work between the default package and another package its okay I'll just put classB in the same package so it'll be easier to access variables from classA. ** EDIT ** Okay I made a short ver of my code and this is the result: Test.java package test; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import btn.button; public class Test { JFrame frame = new JFrame(); JTabbedPane tabpane = new JTabbedPane(); JPanel panel1 = new JPanel(); GridBagConstraints c = new GridBagConstraints(); final static boolean shouldFill = true; GridBagLayout grid = new GridBagLayout(); public Test() { // TODO code application logic here // public button switch; frame.setVisible(true); frame.setSize(821,421); final Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int x=(int)((dimension.getWidth() - frame.getWidth())/2); int y=(int)((dimension.getHeight() - frame.getHeight())/2); frame.setLocation(x, y); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel container = new JPanel(); container.setLayout(new BorderLayout()); container.setBackground(new Color(0,128,0)); tabpane = new JTabbedPane(); //Tab Pane tabpane.setBackground(new Color(0,128,0)); tabpane.setSize(801,351); JPanel jp1 = new JPanel(); // First Tab Panel jp1.setBackground(new Color(0,128,0)); jp1.setLayout(grid); JButton popout = new JButton("MORE"); popout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { button button = new button(); } }); jp1.add(popout); JPanel jp2 = new JPanel(); // Second Tab Panel …
has comment: http://stackoverflow.com/comment/37932628
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/24515766
answer count: 1
has comment: http://stackoverflow.com/comment/37908981
has comment: http://stackoverflow.com/comment/37908976
favorite count: 0
has comment: http://stackoverflow.com/comment/37909374
has comment: http://stackoverflow.com/comment/37909115
linked to: http://stackoverflow.com/q/7053283
has comment: http://stackoverflow.com/comment/37933553
has title: How to switch tabs from a button placed in another class / package?
has comment: http://stackoverflow.com/comment/37907690
has comment: http://stackoverflow.com/comment/37939091
has comment: http://stackoverflow.com/comment/37932723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37908791
has comment: http://stackoverflow.com/comment/37908503
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/37933797
tagged with: swing
has comment: http://stackoverflow.com/comment/37913292
has comment: http://stackoverflow.com/comment/37907449
type: Question
has comment: http://stackoverflow.com/comment/37909107

http://stackoverflow.com/q/24539948
has comment: http://stackoverflow.com/comment/38002390
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38003441
upvote count: 1
type: Question
tagged with: jsoup
has body: I am trying to extract the data from the table on the following website. I.e Club, venue, start time. http://www.national-autograss.co.uk/february.htm I have got many examples on here working that use a css class table but this website doesn't. I have made an attempt with the code below but it doesn't seem to provide any output. Any help would be very much appreciated. import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class Main { public static void main(String[] args) { Document doc = null; try { doc = Jsoup.connect("http://www.national-autograss.co.uk/february.htm").get(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Elements elements = doc.select("table#table1"); String name; for( Element element : elements ) { name = element.text(); System.out.println(name); } } }
downvote count: 0
has title: Extracting data from HTML table with Jsoup
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24540747
accepted answer: http://stackoverflow.com/a/24540747

http://stackoverflow.com/comment/38063416
type: Comment
type: QuestionComment
has text: i've resolved: InputStream stream = f.retrieveFileStream("/photo/"+ft);
comment on: http://stackoverflow.com/q/24571571
score: 0

http://stackoverflow.com/comment/37929276
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24500497
has text: `UCCSStudent` is not a subclass of `Student`, if that's part of your homework. In Java, you should use the `extends` keyword to notify a class extends (is a subclass of) some class.

http://stackoverflow.com/a/36479187
type: Answer
score: 2
has body: Saving uploaded file (don't use getRealPath() nor part.write()!) Head to the following answers for detail on properly saving the obtained InputStream (the fileContent variable as shown in the above code snippets) to disk or database: Recommended way to save uploaded files in a servlet application How to upload an image and save it in database? How to convert Part to Blob, so I can store it in MySQL? Serving uploaded file Head to the following answers for detail on properly serving the saved file from disk or database back to the client: Load images from outside of webapps / webcontext / deploy folder using &lt;h:graphicImage&gt; or &lt;img&gt; tag How to retrieve and display images from a database in a JSP page? Simplest way to serve static data from outside the application server in a Java web application Servlet for serving static content Source
accepted answer of: http://stackoverflow.com/q/24473470
answers question: http://stackoverflow.com/q/24473470
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24740971
has body: First I would like to answer the technical aspect of your question: A WatchEvent just gives you the file name of a changed (or created or deleted) file and nothing more. So if you need any logic beyond this you have to be implement it on your own (or use an existing library of course). If you want to read only new lines, you have to remember the position for each file and whenever this file is changed you can move to the last known position. To get the current position you could use a CountingInputStream from the Commons IO package (credits go to [1]). To jump to the last position, you can use the function skip. But you are using a GZIPInputStream, this means that skip will not give you a great performance boost since skipping a compressed stream is not possible. Instead GZIPInputStream skip will uncompress the stream as it would when you are reading it so you will experience only little performance improvements (try it!). What I don't understand is why you are using compressed log files at all? Why don't you write uncompressed logs with a DailyRollingFileAppender and compress it at the end of the day, when the application doesn't access it anymore? Another solution could be to keep the GZIPInputStream (store it) so that you don't have to reread the file again. It may depend on how many log files you have to watch to decide if this is reasonable. Now some questions on your requirements: You didn't mention the reason why you want to watch the log files in real time. Why don't you centralize your logs (see Centralised Java Logging)? For example take a look on logstash and this presentation (see [2] and [3]) or on scribe or on splunk, which is commercial (see [4]). A centralized log would give you the opportunity to really have real time reactions based on your log data. [1] https://stackoverflow.com/a/240740/734687 [2] Using elasticsearch, logstash &amp; kibana to create realtime dashboards - slides [3] Using elasticsearch, logstash &amp; kibana to create realtime das…
has comment: http://stackoverflow.com/comment/38416743
answers question: http://stackoverflow.com/q/24555822
score: 5
has comment: http://stackoverflow.com/comment/38489392
has comment: http://stackoverflow.com/comment/38545651
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/38434411
has comment: http://stackoverflow.com/comment/38443160
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38412424
has comment: http://stackoverflow.com/comment/38402438
has comment: http://stackoverflow.com/comment/38564398
type: Answer
accepted answer of: http://stackoverflow.com/q/24555822
has comment: http://stackoverflow.com/comment/38446289

http://stackoverflow.com/q/24544130
has title: Correct implementation of time based storage of objects
type: AnsweredQuestion
tagged with: java
has body: For a given task, I should store an object while keeping track of the time of its creation at least per day. The easiest solution I could find is to use Calendar to set day of year based on time stamp of objects creation. Here is the object in a simple form: public class PhysicalActivity implements Serializable { private long mTimestamp; private int mYear; private int mMonthOfYear; private int mWeekOfYear; private int mWeekOfMonth; private int mDayOfYear; private int mDayOfMonth; private int mDayOfWeek; public PhysicalActivity(long timestamp){ mTimestamp = timestamp; Calendar c = Calendar.getInstance(); c.setTimeInMillis(mTimestamp); c.setTimeZone(TimeZone.getDefault()); mYear = c.get(Calendar.YEAR); mMonthOfYear = c.get(Calendar.MONTH); mWeekOfYear = c.get(Calendar.WEEK_OF_YEAR); mWeekOfMonth = c.get(Calendar.WEEK_OF_MONTH); mDayOfYear = c.get(Calendar.DAY_OF_YEAR); mDayOfMonth = c.get(Calendar.DAY_OF_MONTH); mDayOfWeek = c.get(Calendar.DAY_OF_WEEK); } //Getters for all members... } Then I have this object that holds all instances in an List&lt;PhysicalActivity&gt;: public class PhysicalActivityHolder implements Serializable { private long mCreationTimestamp; private long mLastUpdateTimestamp; private List&lt;PhysicalActivity&gt; mList; public PhysicalActivityHolder(long creationTimestamp) { mCreationTimestamp = creationTimestamp; if(mList == null) { mList = new ArrayList&lt;PhysicalActivity&gt;(); } } public void addPhysicalActivity(PhysicalActivity pa){ if(mList == null) { throw new NullPointerException("List is null"); } else { mList.add(pa); } } public List&lt;PhysicalActivity&gt; getPhysicalActivitiesForDayOfYear(int dayOfYear) { List&lt;PhysicalActivity&gt; activities = null; for(PhysicalActivity p : mList) { if(p.getDayOfYear() == dayOfYear){ activities.add(p); } } return activities; } //Some similar methods for getting list by month of year, week of year...etc... } Then whenever there is a new PhysicalActivity instance is coming, I read the PhysicalACtivity…
tagged with: calendar
type: Question
score: 0
answer count: 1
tagged with: serialization
has answer: http://stackoverflow.com/a/24544210
tagged with: android
accepted answer: http://stackoverflow.com/a/24544210

http://stackoverflow.com/q/24554709
type: Question
has comment: http://stackoverflow.com/comment/38029355
linked to: http://stackoverflow.com/q/2784183
has comment: http://stackoverflow.com/comment/38053782
has comment: http://stackoverflow.com/comment/38032559
linked to: http://stackoverflow.com/q/777302
has comment: http://stackoverflow.com/comment/38036928
score: 0
has title: JAX-WS HowTo get xml string from request
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
tagged with: web-services
has body: I have such issue. I have web service @WebService @SOAPBinding(style = Style.RPC) public interface ServerWebService { @WebMethod WSResponse calculateValue(@WebParam(name = "WSRequest") WSRequest request) throws ServerFault, TfmRequestInputFault; } with POJO for request: @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class WSRequest implements Serializable { @XmlElement(required = true) private String promotionData; public String getPromotionData() { return promotionData; } public void setPromotionData(String promotionData) { this.promotionData = promotionData; } } Xml request is something like this: &lt;soapenv:Envelope&gt; &lt;soapenv:Body&gt; &lt;cal:calculateValue&gt; &lt;WSRequest&gt; &lt;promotionData&gt; **&lt;anotherXML&gt;....&lt;/anotherXML&gt;** &lt;/promotionData&gt; &lt;/WSRequest&gt; &lt;/cal:calculateValue&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; When the request come to web service, XML from is not saved to String field of my POJO. Tell me please what i'm doing wrong? This issue happens only with xml as field, when simple string comes as - everything works fine.
tagged with: java

http://stackoverflow.com/q/24583026
has body: I am using Eclipse as my IDE. I have previously made and exporting my different programs in eclipse as executable jar files, but those were all programs involving frames. I was messing around with the classic text based programs I had and decided that I wanted to export the said text-based programs. However, when I try and do this I am left with a jar file that does not run or do anything. I have had no success in having my text-based programs to run outside of Eclipse.
tagged with: java
tagged with: eclipse
type: Question
tagged with: export
score: 0
answer count: 1
tagged with: executable-jar
has title: Exporting a Java text-based program into an executable JAR?
tagged with: text-based
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24583132

http://stackoverflow.com/q/24576975
tagged with: java
has body: in the InvertingAmplifier constructor I tried to call the super constructor with Amplifier(r1, r2) but it didn't work. I see that super(r1, r2) is the accepted way but I don't understand why. public Amplifier( int resistance1, int resistance2) { r1 = resistance1; r2 = resistance2; } public class InvertingAmplifier extends Amplifier { public InvertingAmplifier (int r1, int r2) { super(r1, r2); }
score: 0
linked to: http://stackoverflow.com/q/1168345
has comment: http://stackoverflow.com/comment/38070957
duplicate of: http://stackoverflow.com/q/1168345
has comment: http://stackoverflow.com/comment/38156495
type: UnansweredQuestion
answer count: 0
has title: why use super when constructing a subclass
type: Question
has comment: http://stackoverflow.com/comment/38071054

http://stackoverflow.com/a/24476089
score: 1
answers question: http://stackoverflow.com/q/24474988
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24474988
has body: The question is very abstract, and you can read lots of books or articles about OOP, design patterns and code styling, so I will just give few practical tips: You can use MVC pattern. Create three packages yourpackage.view, yourpackage.model, yourpackage.controller and split your classes by this model. You can create package yourpackage.utiles and put there all classes with only static methods, which are used in all your app. Don't put too much code into one class, Java is very objected oriented. Very simple example: you have game with 4 screens. You should create parent Screen class, 4 classes which will be extended from Screen for every screen and class ScreenManager which will change screens. In game dev Singleton is very useful pattern. You can use it for GraphicMangaer, charcter progress holding, dpad controller, etc. About your question, there is no reason to put create() method into your classes, constructor is enough. What you can do is to create draw() method in every class which draws something and put there all logic of drawing. Then you can just call draw() methods of your classes in your screen render() method.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37824513
type: QuestionComment
comment on: http://stackoverflow.com/q/24444361
has text: http://stackoverflow.com/questions/9440844/java-order-of-operations-using-two-assignment-operators-in-a-single-line
score: 0
type: Comment

http://stackoverflow.com/q/24451777
type: Question
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/37839939
answer count: 1
has title: tomcat jdbc realm - j_security not redirecting
has answer: http://stackoverflow.com/a/24484258
type: UnansweredQuestion
has body: <Realm className="org.apache.catalina.realm.JDBCRealm" driverName="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/db" connectionName="user" connectionPassword="password" allRolesMode="authOnly" digest="SHA" userTable="app" userNameCol="login" userCredCol="login" userRoleTable="login" roleNameCol="group"/> FORM realm /login.jsp /error.jsp username: password: < input type="submit" name="btnLogin" value="login"> when deployed,I get HTTP Status 400 - Invalid direct reference to form login page Here is browser console output.. Remote Address:::1:8080 Request URL:http://devserver:8080/testapp/j_security_check Request Method:POST Status Code:400 Bad Request Request Headersview source Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8,ta;q=0.6 Cache-Control:max-age=0 Connection:keep-alive Content-Length:53 Content-Type:application/x-www-form-urlencoded Cookie:JSESSIONID=BE7C932856A7794D9C780531A29FB25F Host:localhost:8080 Origin:http://devserver:8080 Referer:http://devserver:8080/testapp/timeout.jsp User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36 Form Dataview sourceview URL encoded j_username:testuser j_password:testuser btnLogin:login Response Headersview source Connection:close Content-Length:1054 Content-Type:text/html;charset=utf-8 Date:Fri, 27 Jun 2014 12:13:00 GMT Server:Apache-Coyote/1.1 ALso I enabled log for realm and j_security_check is not redirecting after successfull login Jun 27, 2014 5:42:49 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FINE: Not subject to any constraint Jun 27, 2014 5:43:00 PM org.apache.catalina.authenticator.AuthenticatorBase invoke FINE: Security checking request POST /testapp/j_security_check Jun 27, 2014 5:43:00 PM org.apache.catalina.authenticator.FormAuthenticator authenticate FINE: Authenticating username 'testuser' Jun 27, 2014 5:43:00…
tagged with: java
has comment: http://stackoverflow.com/comment/37898446

http://stackoverflow.com/a/24483237
answers question: http://stackoverflow.com/q/24483130
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: It will call method with String argument... classes in Java are direct or indirect subclasses of Object. So String is a subtype of Object, the method overloaded to accept a String is more specific than the method overloaded to accept an Object. A String can be converted (upcast) to Object, but an Object cannot be converted (downcast or upcast) to String, so the method taking the String argument is more specific. Therefore, print(String s) will be invoked by the call print(null).

http://stackoverflow.com/q/24518727
score: 0
answer count: 3
tagged with: android
has body: I'm very new to develop android apps, I'm struggling with my code, I'm getting the following error, and I can't understand why it is happening, I'm trying to use volley to connect to an API, but before that the user has to login first an then see the content. 07-01 17:21:16.143 22971-23604/com.rep E/YOUR_APP_LOG_TAG﹕ I got an error java.lang.NullPointerException at com.rep.webservice.volley.toolbox.Volley.newRequestQueue(Volley.java:45) at com.rep.webservice.rest.ClientesRest.getClientes(ClientesRest.java:52) at com.rep.webservice.Sincronizar.start(Sincronizar.java:26) at com.rep.app.login.LoginActivity$SincronizarTask.doInBackground(LoginActivity.java:311) at com.rep.app.login.LoginActivity$SincronizarTask.doInBackground(LoginActivity.java:280) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) What I'm doing is, first I get the API data: mSincronizarTask = new SincronizarTask(getApplicationContext()); mSincronizarTask.execute((Void) null); Then I create an Asynctask: public class SincronizarTask extends AsyncTask&lt;Void, Void, Boolean&gt; { private Context ctx; private ProgressDialog mProgressDialog; private Sincronizar mSincronizar = new Sincronizar(this.ctx); public SincronizarTask(Context activity) { Log.i("RM", "construct"); ctx = activity; } @Override protected void onPreExecute() { super.onPreExecute(); Log.i("RM", "onPreExecute"); } @Override protected Boolean doInBackground(Void... params) { Log.i("RM", "doInBackground"); try { mSincronizar.start(); } catch (Exception e) { Log.i("RM", String.valueOf(e.getStackTrace())); } // this.mProgressDialog.dismiss(); return true; } @Override protected void onPostExecute(final Boolean succes…
has comment: http://stackoverflow.com/comment/37962417
has answer: http://stackoverflow.com/a/24534110
accepted answer: http://stackoverflow.com/a/24534110
has comment: http://stackoverflow.com/comment/37962794
has answer: http://stackoverflow.com/a/35669521
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37962398
type: Question
possible better answer: http://stackoverflow.com/a/24520598
linked to: http://stackoverflow.com/q/218384
has title: Volley android java.lang.NullPointerException
has answer: http://stackoverflow.com/a/24520598
tagged with: android-volley

http://stackoverflow.com/q/24529155
type: Question
has comment: http://stackoverflow.com/comment/75611107
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37985295
upvote count: 1
has comment: http://stackoverflow.com/comment/37983889
tagged with: gwt
has comment: http://stackoverflow.com/comment/37984773
tagged with: java
tagged with: gwt-ext
has body: I added a ComboBox to a FlexTable and added that flextable to a Window of gwtext.But Now while clicking the ComboBox,the values in the ComboBox are displaying behind the Window. I created Window and added the ContentPanel which contains the FlexTable as below: window = new com.gwtext.client.widgets.Window(); window.setAutoWidth(true); window.setWidth("1200"); window.setHeight("350"); window.setTitle("RRF New Joinee List"); window.setClosable(true); window.setModal(true); window.setPlain(true); window.setCloseAction(com.gwtext.client.widgets.Window.HIDE); window.add(cpfilter); window.add(panelForPopUpNew); window.show(); Please give suggestion how to resolve this.
has title: ComboBox values are displaying behind the window in gwtext
downvote count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38003196
type: Comment
comment on: http://stackoverflow.com/q/24539920
score: 0
has text: @JEY Turns out my Node.js was sending plain-text not json when the server was created. I inherited the server from a colleague so I did not realize they had it set up this way. :) Thanks for the response!
type: QuestionComment

http://stackoverflow.com/comment/38564398
type: AnswerComment
comment on: http://stackoverflow.com/a/24740971
type: Comment
has text: Updated the code, hope you can read it. What I didn't try is to store the whole `GZIPInputStream` instead of the position. If you want to get some Groovy introduction, try http://groovykoans.org/
score: 0

http://stackoverflow.com/a/24614806
downvote count: 0
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/62483616
type: Answer
has body: Figured it out by grabbing the classpath of the an instance of Model: Model model = new Model(); ClassPool pool = ClassPool.getDefault(); ClassClassPath ccpath = new ClassClassPath(model.getClass()); pool.insertClassPath(ccpath); CtClass ctClass = pool.get("com.project.Model");
answers question: http://stackoverflow.com/q/24540102

http://stackoverflow.com/comment/37919262
has text: That didn't work. It is not the immediate superclass that declares the `logger` variable, and I'm not sure the relation to that class at all, as I have no source code for the class that the Logger is declared in.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24494715

http://stackoverflow.com/q/24516990
score: 2
duplicate of: http://stackoverflow.com/q/1069528
tagged with: java
type: Question
has body: lets say i have this interface public interface HavingName { HavingName withName(String name); String getName(); } there are multiple implementations of this interface, each one implementing the factory method withName that returns a new instance of its type, only with the new name. now i want to write a NameSanitizer that can iterate over a list of concrete HavingName instances and sanitize each name according to some rule class NameSanitizer { public &lt;T extends HavingName&gt; List&lt;T&gt; sanitizeNames(List&lt;T&gt; lines) { return FluentIterable.from(lines).transform(new Function&lt;T, T&gt;() { @Override public T apply(T line) { return sanitizeName(line); } }).toList(); } // TODO: how to avoid this casting warning? private &lt;T extends HavingName&gt; T sanitizeName(T line) { final String name = line.getName(); return shouldSanitize(name) ? (T) line.withDisplayName(sanitize(name)) : line; } } i'd love to know if their was any way to avoid the casting warning
linked to: http://stackoverflow.com/q/1069528
has title: can i avoid this casting warning?
favorite count: 0
upvote count: 3
downvote count: 1
tagged with: generics
answer count: 0
type: UnansweredQuestion
tagged with: java-8

http://stackoverflow.com/comment/37899894
comment on: http://stackoverflow.com/q/24484205
has text: float[] values={12.34f,-12}; float value =0.00f; for(float b: values) replace 1st three lines with this. then output comes 0.34000
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37828348
comment on: http://stackoverflow.com/a/24433289
has text: just recall that you have two `int` values, the hash codes of `left` and `right`. They are already `int`s, distributed over the entire `int` range. Now, what you basically do is to transform these `int`s like `String.valueOf(i).hashCode()` which obviously adds tons of collisions to these values which didn’t exist before (you may test it if it’s not so obvious to you). Arithmetically there’s no difference in whether you first perform this transformation and combine the poor results or concat the `String`s first and calculate the hash code afterwards.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/38297881
type: AnswerComment
comment on: http://stackoverflow.com/a/24573593
score: 0
type: Comment
has text: Sorry!! Can't reproduce your issue as I tried my best so this is what I know.

http://stackoverflow.com/a/24440989
has comment: http://stackoverflow.com/comment/37822030
answers question: http://stackoverflow.com/q/24438108
score: 0
type: Answer
has body: EDIT: original answer was kind of lazy; adding some more clarification. Wow, this is beyond bizarre - I wasn't entirely complete in my User.java listing. What I was actually doing was: return new User() { { setFirstName("Fernando"); setLastName("Alonso"); } }; You wouldn't think this would be a problem, but when I changed it to be the more orthodox: User user = new User(); user.setFirstName("Fernando"); user.setLastName("Alonso"); return user; It works like a charm! The issue was that, with my original code, I was creating an anonymous subclass of my User POJO. To the JVM, this is not the same thing as an instance of the User class at all, but rather an anonymous class that lives within the UserServiceBean itself. To illustrate: User anonymousUser = new User() { { setFirstName("Fernando"); setLastName("Alonso"); } }; Inspecting the anonymousUser reference variable reveals it to be pointing at an instance of UserServiceBean$1 (with the "$1" part being Java's way of identifying an anonymous inner class) Doing the more traditional: User user = new User(); user.setFirstName("Fernando"); user.setLastName("Alonso"); And inspecting the user reference variable reveals to to be an instance of the User class (as you would expect). So, with this information in hand, the original error indicating that UserServiceBean itself needed to be serializable now makes perfect sense!

http://stackoverflow.com/comment/37896558
score: 0
comment on: http://stackoverflow.com/a/24482832
type: Comment
has text: The approximation being 7.2865997E8
type: AnswerComment

http://stackoverflow.com/comment/37976340
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your help. My question is: 1. What use is the XML generated from XFA pdf form. 2. How do we create an XML for populating the PDF considering I have the form and the XML generated using code. Also, please suggest on using how to handle the dynamic elements of the form.
comment on: http://stackoverflow.com/a/24508853

http://stackoverflow.com/q/24468242
has title: Conversion with multiple steps in Java
answer count: 2
has answer: http://stackoverflow.com/a/24468313
has body: I'm sorry if the title is misleading, but I am not really sure how else to describe it. I am trying to write a program in Java that would convert data, given only some of the conversion factors. For example, if I have these conversion factors: Convert a to b by multiplying a by 10 Convert b to c by multiplying b by 20 Convert c to a by dividing c by 200 How would I write a method that would convert a to c? I know that it would have to first convert a to b and then b to c but I do not know how to teach Java to recognize patterns like that. I know that I could just write if statements to check for these directly, however, I have a lot of these conversions and all those if statements seem terribly inefficient. Is there a better way?
score: 0
accepted answer: http://stackoverflow.com/a/24468313
has comment: http://stackoverflow.com/comment/37868832
has comment: http://stackoverflow.com/comment/37868866
has answer: http://stackoverflow.com/a/24468312
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24468312
tagged with: java

http://stackoverflow.com/comment/52023061
has text: Check this: https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
comment on: http://stackoverflow.com/q/24452075
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37988692
comment on: http://stackoverflow.com/a/24531846
score: 0
type: Comment
has text: You said subclass should have aa sequnceId column with a FK to the base sequnceId column, and so on. So in my case ther isnt `coz it is said about table-per-subclass that Subclass dont use parents fields. Do i have to declarete it implicity?
type: AnswerComment

http://stackoverflow.com/comment/38026653
type: Comment
comment on: http://stackoverflow.com/a/24507281
type: AnswerComment
has text: What for? I want a functionality similar to clicking on a mailto: address
score: 0

http://stackoverflow.com/a/24584055
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38105970
has body: I want to display distinct year in combo box in ascending order. But the output in combobox appears to be repetitive, repetitive in the sense that it shows all the elements of the column of database but i want to show only the distinct data of the column And you say this is the query you are using to accomplish that @NamedQuery(name = "Production.findByYearOfProduction", query = "SELECT DISTINCT p FROM Production p WHERE p.yearOfProduction = :yearOfProduction ORDER Bp.yearOfProduction ASC" )}) The problem with this query is that it's used to find a list Production entities by the yearOfProduction. So say you use this query with the year 1990. That means that any Production entity that was produced in 1990 with be part of the result set. So the only year of production you will see is 1990. What you want is just the distinct values in a single column, where the actual Production entity is not necessarily concerned. So your query should look more like SELECT DISTINCT p.yearOfProduction FROM Production p ORDER BY p.yearOfProduction ASC The return value should be a list of just the distinct years, and having no connection to the Production entity. You may want to do some refactoring to your code, where calling this query will return a List&lt;String&gt;. And that's the list you want to use for your combo box, not a List&lt;Production&gt;. Where should you do this refactoring? I can't tell, as you haven't provided the code where you call this query. Note: So what you should do is create a separate @NamedQuery, and the one you currently have, I think you want to keep for maybe a different combo box maybe, where after a year is selected from the first combo box, the second one is populate with all Production entities for that year. Also note your toString just lists the year of production. So if you want some other representation of the Production entity in a the second combo box, you should change that also. Also keep in mind when you auto-create an entity in Netbeans, It …
upvote count: 1
answers question: http://stackoverflow.com/q/24582836
type: Answer
has comment: http://stackoverflow.com/comment/38086850
has comment: http://stackoverflow.com/comment/38105998

http://stackoverflow.com/q/24476791
has answer: http://stackoverflow.com/a/24477007
accepted answer: http://stackoverflow.com/a/24477007
has body: I have a series of URL params and I need extract some of them that are repeated. For example: Required params "m" I have a string how this: m=123456789&amp;reset=true&amp;color=blue&amp;getppm=1112&amp;comparechars=yes&amp;alternatem=5&amp;..... This repeats about 10 times with different values. I have this regex: m=(.*?)&amp; But my problem is that other params are entering too (getppm, alternatem). m is the first in some cases. It could vary in some cases, and I can't use &amp;m= in such cases. How can I solve this problem? EDIT: The m param normally is continued by a serie of numbers and uppercase letters on this type: m=1A2B3C4D6D8A7D5S.32D4D1D5D3D6D8D&amp;nextparam=... I was trying with {x,x} variations without successfull
has answer: http://stackoverflow.com/a/24476944
has comment: http://stackoverflow.com/comment/37884948
score: 0
answer count: 2
tagged with: url
tagged with: regex
possible better answer: http://stackoverflow.com/a/24476944
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37885035
has title: Match repeated pattern in a query string using a regex
type: Question
has comment: http://stackoverflow.com/comment/37884854

http://stackoverflow.com/comment/38082756
has text: Inject the `HttpServletRequest` and obtain the IP-Address [like explained here](http://stackoverflow.com/questions/4678797).
comment on: http://stackoverflow.com/q/24574900
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24444476
answers question: http://stackoverflow.com/q/24444361
score: 1
upvote count: 1
downvote count: 0
has body: x = y = z is same as x=(y=z) so, first y is assigned the value of z , i,e 3 and then the result is assigned to x. At the end of it, values will be x = 3, y = 3 and z = 3
type: Answer

jax-ws
tags question: http://stackoverflow.com/q/24571990
type: Tag
tags question: http://stackoverflow.com/q/24441730
tags question: http://stackoverflow.com/q/24469256
tags question: http://stackoverflow.com/q/24428369
tags question: http://stackoverflow.com/q/24563583
tags question: http://stackoverflow.com/q/24429207
tags question: http://stackoverflow.com/q/24447695
tag name: jax-ws

http://stackoverflow.com/a/24486793
type: AcceptedAnswer
score: 8
has body: Short answer - because that's the way they designed it. As described in the reference guide: When an ApplicationContext is loaded, it automatically searches for a MessageSource bean defined in the context. The bean must have the name messageSource. If such a bean is found, all calls to the preceding methods are delegated to the message source.... If the ApplicationContext cannot find any source for messages, an empty DelegatingMessageSource is instantiated in order to be able to accept calls to the methods defined above. This is just a hard-coded value that is searched for. If you don't supply a bean with that name, you'll end up with a DelegatingMessageSource instance that won't resolve any of your messages, giving you a NoSuchMessageException.
answers question: http://stackoverflow.com/q/24486636
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/24486636
downvote count: 0

http://stackoverflow.com/q/24433089
has comment: http://stackoverflow.com/comment/37805143
has comment: http://stackoverflow.com/comment/37803690
has answer: http://stackoverflow.com/a/24438161
linked to: http://stackoverflow.com/q/12351570
has answer: http://stackoverflow.com/a/24450716
has comment: http://stackoverflow.com/comment/37805269
has comment: http://stackoverflow.com/comment/37805011
tagged with: swing
has answer: http://stackoverflow.com/a/32320767
type: Question
has body: I'm using an UndoManager to capture changes in my JTextArea. The method setText() however deletes everything and then pastes the text. When I undo I firstly see an empty area and then it would show which text it had before. How to reproduce: Run the following code Click the setText() button Press CTRL+Z to undo (you'll see an empty textarea!) Press CTRL+Z to undo (you'll see the actual previous text) I want to skip 3). import javax.swing.AbstractAction; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.KeyStroke; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.text.Document; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; import java.awt.event.ActionEvent; import javax.swing.JButton; import java.awt.event.ActionListener; @SuppressWarnings("serial") public class JTextComponentSetTextUndoEvent extends JFrame { JTextArea area = new JTextArea(); public JTextComponentSetTextUndoEvent() { setSize(300, 300); setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().setLayout(null); area.setText("Test"); area.setBounds(0, 96, 146, 165); getContentPane().add(area); JButton btnSettext = new JButton("setText()"); btnSettext.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { area.setText("stackoverflow.com"); } }); btnSettext.setBounds(0, 28, 200, 50); getContentPane().add(btnSettext); final UndoManager undoManager = new UndoManager(); Document doc = area.getDocument(); doc.addUndoableEditListener(new UndoableEditListener() { public void undoableEditHappened(UndoableEditEvent evt) { undoManager.addEdit(evt.getEdit()); } }); area.getActionMap().put("Undo", new AbstractAction("Undo") { public void actionPerformed(ActionEvent evt) { try { if (undoManager.canUndo()) { undoManager.undo(); } } catch (CannotUndoException e) { } } }); area.getInputMap().put(KeyStroke.getKeyStroke("con…
tagged with: jtextarea
tagged with: undo-redo
has title: JTextArea setText() & UndoManager
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/37804239
upvote count: 4
has answer: http://stackoverflow.com/a/37503870
linked to: http://stackoverflow.com/q/7229226
accepted answer: http://stackoverflow.com/a/24450716
downvote count: 0
has answer: http://stackoverflow.com/a/77943029
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/61714557
linked to: http://stackoverflow.com/q/13714966
possible better answer: http://stackoverflow.com/a/24438161
type: AnsweredQuestion

http://stackoverflow.com/a/33183111
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24484406
has body: first of all, you have to provide logged user type like admin or user at login time . if logged user type is admin then pass url parameter like userType='ADMIN' or userType='USER' and check in header.jsp page if userType='ADMIN' load 2 tabs otherwise one tab.
downvote count: 0

http://stackoverflow.com/comment/43037603
comment on: http://stackoverflow.com/a/24544960
type: AnswerComment
score: 0
type: Comment
has text: @StuartMarks But libjvm.so itself is also a shared library, so how to statically link a non-PIC library (having assembly code)? Should I link such a library to who loads libjvm.so? Is it ever possible?

http://stackoverflow.com/comment/38017926
comment on: http://stackoverflow.com/a/24547764
score: 0
type: AnswerComment
has text: thanks but I am reading string value from socket so "\" character does not exist.
type: Comment

http://stackoverflow.com/a/31113617
type: Answer
answers question: http://stackoverflow.com/q/24431540
accepted answer of: http://stackoverflow.com/q/24431540
has body: This Problem is totally different but showing different error message. Some code change happened, for that used "clone" on domain object(Which is a very big Object). So all the connections are occupied and there are no resource for new request.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/38451318
score: 0
has text: Did u get the answer for this? I am also getting same error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24519462

http://stackoverflow.com/comment/37873070
score: 0
type: AnswerComment
has text: There are 3 of my replies before this comment, including a screenshot, what should I add more ?
type: Comment
comment on: http://stackoverflow.com/a/24469412

http://stackoverflow.com/a/24467584
accepted answer of: http://stackoverflow.com/q/24467374
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24467374
has comment: http://stackoverflow.com/comment/37868093
has comment: http://stackoverflow.com/comment/37870008
upvote count: 3
has body: I would recommend you to use dynamic data structures provided by the JDK. To be more concrete, those implementing the List interface seem to match your goal. You should gather your data in a List object and later you can generate an array from it. For example: List&lt;String&gt; titleId = new ArrayList(); Lets suppose you are getting your data from a JDBC result set: while(res.next()) { titleId.add(res.getString("dbTableColumn")); } Finally, you generate an array from the list and pass it to CustomList constructor: CustomList adapter = new CustomList(getActivity(), data.titleId.toArray(), ...);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37868022
has comment: http://stackoverflow.com/comment/37870061

http://stackoverflow.com/a/24469067
has comment: http://stackoverflow.com/comment/37873092
has comment: http://stackoverflow.com/comment/75092808
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37877529
has comment: http://stackoverflow.com/comment/37877781
type: Answer
has comment: http://stackoverflow.com/comment/38076502
answers question: http://stackoverflow.com/q/24467675
has comment: http://stackoverflow.com/comment/38075910
accepted answer of: http://stackoverflow.com/q/24467675
score: 9
has body: The sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) - according to the stack trace you provided, mockito got a bit confused when reporting the error. It's not really related with your problem, but anyway that's the NativeMethodAccessorImpl.invoke0 which is native (see grep code). The SpringJUnit4ClassRunner runs it, it's how it works, nothing you should care about. Now about your real problem, as I wrote in comment, It's because Spring wraps the mock object into a proxy. If you add System.out.println(memberRepositoryMock.getClass()); you'll see in the console that it's not the mock but some proxy there. Mockito can only stub mocks, so that's why you recieve the error. The question might be now, how to work this around. First thing is that your test is not actually an integration test as you are trying to mock the repository instead of really test how the data access behave. In this case I would resign from using the spring-test and simply go for simple MockitoJUnitRunner. UPDATE: OK, now knowing that it is actually the cache to be tested, I understand you need the mocked repository to be decorated with Spring cache and that your test IS an integration test indeed. Here's how it could be done. A little variation of mentioned frant.hartm proposal but without use of static reference. Slightly more natural I think. @ActiveProfiles(Profiles.TEST) @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { FullIntegrationTestConfiguration.class, BaseTestConfiguration.class, MemberCachingIntegrationTest.Config.class }) public class MemberCachingIntegrationTest { @Autowired private MemberRepository cachedRepository; @Autowired private MockProvider mockProvider; @After public void validate() { validateMockitoUsage(); } @Test public void test() { when(mockProvider.get().findByEmail(anyString())).thenReturn("foo", "bar"); String firstInvocation = cachedRepository.findByEmail("foo@foo.com"); assertThat(firstInvocation, is("foo")); String secondInvocati…
upvote count: 9

http://stackoverflow.com/q/24503603
favorite count: 0
has body: I have define super class who's member variables are private and functions are public. I want that super class' methods to be accessible in the child class, but not from the outside of that class. In other words, super class' methods become private in the child class so that they can not be accessed from outside of the class. Is this behavior possible or not?
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37934863
has title: How to make a super class whose member function becomes private in the child
tagged with: java
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24503755
has answer: http://stackoverflow.com/a/24503633
score: -2
has comment: http://stackoverflow.com/comment/37934898

http://stackoverflow.com/q/24491300
has answer: http://stackoverflow.com/a/24491349
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has answer: http://stackoverflow.com/a/24491460
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37912344
has answer: http://stackoverflow.com/a/24491457
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37912345
has title: Intent Activity not working
has body: I'm doing a basic activity of moving from one page to another. Everything was going perfect until I get two pages deep into the app. I used the same exact code for each page class, put the activities in the manifest and made sure all words were spelled correctly, etc., but the intent doesn't do anything when I try to go three pages deep. There are no error messages in the log at all. When I click on a button on the third page, it just turns blue but doesn't move to the next page like the previous pages. Here's my code: from page 1 to 3: Page1: public class MainActivity extends ActionBarActivity { Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, MainMenu.class); startActivity(intent); } }); } } Page 2: has more buttons... public class MainMenu extends ActionBarActivity { Button button; Button button2; Button button3; Button button4; Button button5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_menu); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); button3 = (Button) findViewById(R.id.button3); button4 = (Button) findViewById(R.id.button4); button5 = (Button) findViewById(R.id.button5); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, OneMain.class); startActivity(intent); } }); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, TwoMa…

http://stackoverflow.com/comment/37868327
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24467602
has text: Nothing but time, but I thought it would be a useful question for others too, since I didn't find an answer easily.

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/24495893
tags question: http://stackoverflow.com/q/24444790
type: Tag
tags question: http://stackoverflow.com/q/24471109

http://stackoverflow.com/a/24478324
score: 5
has body: Move the call to setVisible(true) to the end of the code. Other tips: See the advice of @trashgod. Don't set the size of the frame, but instead call pack() after all components are added. To set a GUI in the center of the screen, use setLocationRelativeTo(null) but better is to use setLocationByPlatform(true) before the GUI is visible. For frame positioning, you cannot go by setLocationByPlatform(true). See this answer for demo.
type: Answer
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24478296

http://stackoverflow.com/comment/37873783
comment on: http://stackoverflow.com/a/24470719
type: Comment
has text: @user3602008: I agree with camickr. You will want to accept his answer and use his recommendations.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24449972
has body: As pointed out in other answers: By synchronizing on this, you are exposing the object hat you are locking on. But to point out again why this may be a problem: It can cause deadlocks. Imagine, for example, these two methods being executed by two different threads: private final Object localMonitor = new Object(); private final Pool pool = new Pool(); void methodA() { synchronized (localMonitor) { pool.releaseObject(null); } } void methodB() { synchronized (pool) { synchronized (localMonitor) { System.out.println("Performing some work..."); } } } The first thread will synchronize on the localMonitor and then try to call the method from the Pool class. The second thread will synchronize on the pool instance, and then try to synchronize on the localMonitor. For itself, this code is "valid". This would actually be fine. Unless the method from the Pool class is synchronized as well. Then, the threads will run into a deadlock. Such a situation can be avoided by using a dedicated syncObject. Illustrated here again, as a runnable example: Just change the object to be synchronized on by switching the commented lines to see the difference. class Pool { private final Object syncObject = new Object(); public void releaseObject(Object o) { //synchronized (syncObject) // &lt;----------- This will work synchronized (this) // // &lt;----------- This will cause a deadlock { System.out.println("Modify pool"); } } } class SimpleSynchronizeExample { public static void main(String[] args) { SimpleSynchronizeExample s = new SimpleSynchronizeExample(); s.start(); } private final Object localMonitor = new Object(); private final Pool pool = new Pool(); void methodA() { synchronized (localMonitor) { try { Thread.sleep(100); } catch (Exception e) {} pool.releaseObject(null); } } void methodB() { synchronized (pool) { try { Thread.sleep(100); } catch (Exception e) {} synchronized (localMonitor) { System.out.println("Performing some work..."); } } } private void start() { Thread tA = new Thre…
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24448460
type: Answer

http://stackoverflow.com/q/24587342
tagged with: javafx-8
has answer: http://stackoverflow.com/a/35223708
tagged with: javafx-2
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24600297
tagged with: java
tagged with: javafx
has title: How to animate LinearGradient on JavaFX?
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/38102033
has body: I am trying to animate the text fill of a Label on JavaFX (Using JavaFX 8). My goal is to make the First color of the gradient to change from yellow to red every half second. I have tried this: Timeline timeline = new Timeline(); timeline.setCycleCount(Animation.INDEFINITE); timeline.setAutoReverse(true); LinearGradient fill1 = new LinearGradient(50,50,200,200,false, CycleMethod.NO_CYCLE, new Stop(0.1f, Color.YELLOW), new Stop(1.0f, Color.BLACK)); LinearGradient fill2 = new LinearGradient(50,50,200,200,false, CycleMethod.NO_CYCLE, new Stop(0.1f, Color.RED), new Stop(1.0f, Color.BLACK)); KeyValue keyValue1 = new KeyValue(labelInstrucoes.textFillProperty(), fill1, Interpolator.EASE_OUT); KeyValue keyValue2 = new KeyValue(labelInstrucoes.textFillProperty(), fill2, Interpolator.EASE_OUT); KeyFrame keyframe1 = new KeyFrame(Duration.millis(0), keyValue1); KeyFrame keyframe2 = new KeyFrame(Duration.millis(500), keyValue2); timeline.getKeyFrames().addAll(keyframe1, keyframe2); timeline.play(); But it didn't work. However, if instead of LinearGradient i use a simple color, like this: KeyValue keyValue1 = new KeyValue(labelInstrucoes.textFillProperty(), Color.YELLOW, Interpolator.EASE_OUT); KeyValue keyValue2 = new KeyValue(labelInstrucoes.textFillProperty(), Color.RED, Interpolator.EASE_OUT); It works. So, how to animate the gradient?
downvote count: 0
score: 4
favorite count: 0

http://stackoverflow.com/comment/37995187
type: Comment
comment on: http://stackoverflow.com/a/24487137
score: 0
type: AnswerComment
has text: Will have to check.would do tomorrow from offive. On mobile right now.

http://stackoverflow.com/comment/37831875
has text: You can do this with ArrayList by having an ArrayList of ArrayList of ArrayList and in that case the number of dimensions can be dynamic, but the question as written about arrays (not ArrayList) is such that you cannot do it.
comment on: http://stackoverflow.com/a/24448432
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24570249
has body: I have training data set that exists in arff file and I have testing data set that exists in mysql data base (1) and I have another data (2) also exists in mysql How can I do the Testing process in java with weka on data base (1) and then How can I do the expectation from data base (2) according to the testing process result
score: 0
has title: Testing process and expectation with weka for data that exist in my sql
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24621149
type: Question
tagged with: weka
answer count: 1
accepted answer: http://stackoverflow.com/a/24621149

http://stackoverflow.com/a/24460752
type: Answer
answers question: http://stackoverflow.com/q/24460480
has comment: http://stackoverflow.com/comment/37854665
accepted answer of: http://stackoverflow.com/q/24460480
has comment: http://stackoverflow.com/comment/37854687
downvote count: 1
upvote count: 5
score: 4
has body: public static List&lt;List&lt;Integer&gt;&gt; listPermutations(List&lt;Integer&gt; list) { if (list.size() == 0) { List&lt;List&lt;Integer&gt;&gt; result = new ArrayList&lt;List&lt;Integer&gt;&gt;(); result.add(new ArrayList&lt;Integer&gt;()); return result; } List&lt;List&lt;Integer&gt;&gt; returnMe = new ArrayList&lt;List&lt;Integer&gt;&gt;(); Integer firstElement = list.remove(0); List&lt;List&lt;Integer&gt;&gt; recursiveReturn = listPermutations(list); for (List&lt;Integer&gt; li : recursiveReturn) { for (int index = 0; index &lt;= li.size(); index++) { List&lt;Integer&gt; temp = new ArrayList&lt;Integer&gt;(li); temp.add(index, firstElement); returnMe.add(temp); } } return returnMe; } To test this I used: public static void main(String[] args) throws Exception { List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(); intList.add(1); intList.add(2); intList.add(3); List&lt;List&lt;Integer&gt;&gt; myLists = listPermutations(intList); for (List&lt;Integer&gt; al : myLists) { String appender = ""; for (Integer i : al) { System.out.print(appender + i); appender = " "; } System.out.println(); } } Which gave me the output: 1 2 3 2 1 3 2 3 1 1 3 2 3 1 2 3 2 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37980027
type: AnswerComment
has text: Not working and my eclipse does not respond anymore.
type: Comment
comment on: http://stackoverflow.com/a/24448709
score: 4

http://stackoverflow.com/a/24646601
score: 1
has comment: http://stackoverflow.com/comment/38210968
has body: There is no general way to find out the structure/commands/file system layout of a smartcard. This is typically application dependent. There exist some standards for certain ID cards (like ICAO 9303 for machine readable travel documents) but there is no global standard for national IDs. Therefore, I suggest that you try to get the ID specifications from your government.
accepted answer of: http://stackoverflow.com/q/24563081
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24563081
type: Answer
upvote count: 1

http://stackoverflow.com/q/24571268
has comment: http://stackoverflow.com/comment/38061519
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38060643
type: UnansweredQuestion
has title: store data from java class file into a variable in jsp
has comment: http://stackoverflow.com/comment/38068345
answer count: 0
tagged with: jsp
has body: I am developing an e-commerce college project where i have added the selected items in the cart using a java class file in which the calculation of total purchase is also done in a local variable , now i want the value of this variable (total purchase) in my jsp file. what are the possible ways for this? I have tried to create a session in my java class file, but failed because it does not rechognise what is request. any other possible ways? Javascript? Please help.. Below is some piece of code ShoppingCart.java public class ShoppingCart { public void display(JspWriter out) { try{ java.text.DecimalFormat currency = new java.text.DecimalFormat("Rs #,###,##0.00"); out.println(" "); double total = 0; for(int i = 0; i < itemlist.size(); i++) { Item item = (Item)itemlist.get(i); out.println(" "+ item.name+" "+ " "+ currency.format(item.price*item.quantity)+" "); total += item.price*item.quantity; } out.println(" Total purchase "); out.println(" "+currency.format(total)+" "); out.println(" "); } catch(IOException ex) { System.err.println(ex.toString()); } } } Order.jsp <% session.setMaxInactiveInterval(1800); String action = request.getParameter("action"); if(action.equals("show")){ try{ synchronized(session) { ShoppingCart cart = (ShoppingCart)session.getAttribute("Cart"); if(cart == null) { cart = new ShoppingCart(); session.setAttribute("Cart", cart); } cart.display(out); } } catch(Exception ex){ out.println(ex.toString()); } } %> calling order.jsp from **front.jsp front.jsp
type: Question
has comment: http://stackoverflow.com/comment/38063380
has comment: http://stackoverflow.com/comment/38060569
has comment: http://stackoverflow.com/comment/38060609
has comment: http://stackoverflow.com/comment/38065975

http://stackoverflow.com/q/24504193
tagged with: android-sdcard
has comment: http://stackoverflow.com/comment/37943808
has comment: http://stackoverflow.com/comment/37936709
has comment: http://stackoverflow.com/comment/37955483
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37939492
has comment: http://stackoverflow.com/comment/37955876
has comment: http://stackoverflow.com/comment/37937856
answer count: 0
has comment: http://stackoverflow.com/comment/37940322
tagged with: java
has comment: http://stackoverflow.com/comment/37945783
has comment: http://stackoverflow.com/comment/37949835
has comment: http://stackoverflow.com/comment/37945616
type: Question
tagged with: sd-card
has body: How to update the file system of SD-card? Windows explorer (and the other programs which open file system) crashes. It shows all files new and deleted. The method below just updates existing files: MediaScannerConnection.scanFile (this, new String[] {file.toString()}, null, null); As I understood below method works just for Android &lt; 4.4 version: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); How to update deleted files and folders? EDITED: CODE EXAMPLE (creating and removing file): //i'm createing the file: //in works properly! File file = new File(dir, "filename.pos"); os = new DataOutputStream(new FileOutputStream(file)); os.writeLong(versionOfPOSFile); os.close(); MediaScannerConnection.scanFile (context, new String[] {file.toString()}, null, null); //this code deletes a file: //it doesn't work! //files are not updated in Windows. File path = /*some folder path*/ File[] c = path.listFiles(); for (File file : c){ file.delete(); //even I add this code: MediaScannerConnection.scanFile(context, new String[] {file.toString()}, null, null); } }
has comment: http://stackoverflow.com/comment/37950405
has comment: http://stackoverflow.com/comment/37942084
has title: Windows doesn't refresh files on Android device SD card after removing them
has comment: http://stackoverflow.com/comment/37936301
score: 0
has comment: http://stackoverflow.com/comment/37938320
has comment: http://stackoverflow.com/comment/37943598
has comment: http://stackoverflow.com/comment/37936847
has comment: http://stackoverflow.com/comment/37944085
linked to: http://stackoverflow.com/q/8379690

http://stackoverflow.com/comment/38077381
type: QuestionComment
has text: In that case they are indeed safe :)
comment on: http://stackoverflow.com/q/24579683
score: 0
type: Comment

http://stackoverflow.com/q/24564310
accepted answer: http://stackoverflow.com/a/24564366
has answer: http://stackoverflow.com/a/24564427
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24564427
tagged with: android-intent
type: AnsweredQuestion
has body: I'm trying to create a menu with buttons that will launch an activity class given the respective button id (i.e. Home1 button, Home2 button): public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.menu_home1: launchActivity("Home1"); break; case R.id.menu_home2: launchActivity("Home2"); break; } return super.onOptionsItemSelected(item); } public void launchActivity(String activityName) { Intent intent = new Intent(this, activityName + ".class"); startActivity(intent); } However, I get "Cannot resolve constructor" when trying to construct an intent. How can I write the intent constructor to dynamically construct the new activity parameter?
upvote count: 2
tagged with: java
has title: How to concat Java string with .class in Intent constructor?
has answer: http://stackoverflow.com/a/24564366
type: Question
answer count: 2
tagged with: concatenation
has comment: http://stackoverflow.com/comment/38047759
score: 2
downvote count: 0

http://stackoverflow.com/comment/37959334
comment on: http://stackoverflow.com/q/24515909
type: Comment
has text: Any suggestions on how to preserve the generics funcionality and get rid of array creation?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/38854202
has text: @Antimony: you are right, there *are* such features and that’s what the question was about. But `goto` is not such a feature.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24575518
type: Comment

http://stackoverflow.com/comment/37862327
type: QuestionComment
has text: @DavidPostill They're *supposed* to be unique. Reusing MAC addresses breaks networking equipment. This is still a bad use for them, but relying on them to distinguish machines for other purposes is reasonable.
score: 2
comment on: http://stackoverflow.com/q/24464403
type: Comment

http://stackoverflow.com/comment/38043469
has text: why are you using `null` layout? Will it work on different resolution on different Operating system.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24561999

http://stackoverflow.com/q/24507668
has body: How can I find which column in which table cause the SQLIntegrityConstraintViolationException ? when I catch this exception, only message (as plain text) and SQLState exists. but I cant find table name and column separated for generating user friendly message
answer count: 2
tagged with: jdbc
has answer: http://stackoverflow.com/a/36082593
favorite count: 0
upvote count: 2
tagged with: exception
type: UnansweredQuestion
has title: How to find column and table name when SQLIntegrityConstraintViolationException thrown
has answer: http://stackoverflow.com/a/24508131
score: 1
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/37828725
comment on: http://stackoverflow.com/a/24445768
has text: Can you add some of your code here so we can analyze it first? Also, some stacktrace would help.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24473155
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37878038
has comment: http://stackoverflow.com/comment/37877987
downvote count: 0
has body: Never use ++i or i++ inside a loop unless you really want to skip one of the array (or similar) elements over which you are iterating. This if(arr[i]==arr[++i]){ is not the same as if(arr[i]==arr[i+1]){ That said, never use ++i or i++ within an expression where also i occurs. Later Another problem you'll soon see is that the array for holding the duplicates is too long. For this, a List is more appropriate. Why it does not work The additional increment makes the loop skip every other element, so the pair of adjacent values 40 is never compared.
answers question: http://stackoverflow.com/q/24473089
type: Answer

http://stackoverflow.com/comment/38081869
score: 3
has text: General tip on `exec`. Read (and implement) *all* the recommendations of [When Runtime.exec() won't](http://www.javaworld.com/jw-12-2000/jw-1229-traps.html). That might solve the problem. If not, it should provide more information as to the reason it failed. 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. BTW - The progress might be indicated in the output stream of the running `Process`.
comment on: http://stackoverflow.com/q/24582774
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37911174
comment on: http://stackoverflow.com/q/24490663
has text: @popgalop Are you sure that the rt.jar of your JRE is in your classpath?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38014202
has text: How do you _start_ a thread?
score: 0
comment on: http://stackoverflow.com/q/24546444
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24557308
linked to: http://stackoverflow.com/q/11074836
linked to: http://stackoverflow.com/q/24560360
type: Question
has answer: http://stackoverflow.com/a/30494185
answer count: 2
tagged with: javascript
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24705514
linked to: http://stackoverflow.com/q/5677559
tagged with: d3.js
type: UnansweredQuestion
tagged with: jsdom
has comment: http://stackoverflow.com/comment/44121295
has title: Launch jsdom from Rhino on Java
downvote count: 0
has body: I'm following up on this answer: I managed to run simple JavaScript code from Rhino Engine on Java. But when it comes to D3.js, for example: var svg = d3.select("body").append("svg") as you can see d3 requires DOM to be available on first place. So, for that reason JSDOM is supposed to be the solution. But JSDOM happens to be depended on requirejs From RequireJs site: The r.js file allows you to run the optimizer as well as run modules in Node, Rhino or xpcshell. Then my Java Rhino code look like this: FileReader fr1 = new FileReader("lib/r.js"); FileReader fr2 = new FileReader("lib/jsdom.js"); engine.eval(fr1); engine.eval(fr2); But for now I end up having an error like this: ReferenceError: "arguments" is not defined. Then I found this nice answer: Then my code look like this: cx.evaluateReader(sharedScope, new FileReader("lib/r.js"), "require", 1, null); cx.evaluateReader(sharedScope, new FileReader("lib/loader.js"), "loader", 1, null); cx.evaluateReader(sharedScope, new FileReader("lib/jsdom.js"), "loader", 1, null); Error: Module name "fs" has not been loaded yet That basically means that jsdom.js itself is referencing to: var fs = require('fs'); var path = require('path'); var URL = require('url'); So, it seems I just need to download all of them. But fs - is about File System. That means that it depends on NodeJs native implementation. Which is not good for my attempt to be on plain java & plain js side. Update: For now I'm doing my research in this direction: https://github.com/nodyn/jvm-npm http://nodyn.io/ The question is: How can I load JSDOM to Rhino to let D3.js to generate my SVG? Once more: Java Rhino -> D3.JS -> JSDOME -> RequireJS -> FS => SVG ? "Or" : How Mozilla Rhino can use nodejs "fs" module? I know I can use PhantomJS, but I'm looking or something that is Java-sticky. More lightweight, with no external processe launching involved.
tagged with: rhino
score: 1
tagged with: java

http://stackoverflow.com/a/31997509
answers question: http://stackoverflow.com/q/24553930
type: Answer
upvote count: 9
downvote count: 0
has body: First make sure you have installed jdk and jre, both are installed with the java software development kit. The installation folder is typically C:\Program Files\Java. Now go to Computer > Properties > Advanced system settings in the advanced tab click on Environment Variables In System variables find the variable named Path, in the value of Path you will find a java path like C:\ProgramData\Oracle\Java\javapath, just change it to C:\Program Files\Java\jdk1.x.x_x\bin. Hope that helps.
score: 9

http://stackoverflow.com/comment/37952714
has text: Target doesn't connect to me I have connect to Target and use proper localPort otherwise Target will reject me. It's not request-reply communication at all.
comment on: http://stackoverflow.com/a/24512756
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40053085
comment on: http://stackoverflow.com/q/24443725
type: Comment
has text: added a bounty - see if we can get it figured out...
type: QuestionComment
score: 1

http://stackoverflow.com/q/24453376
score: 4
possible better answer: http://stackoverflow.com/a/24453553
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/36745542
tagged with: java
has title: Spring doesn't resolve classpath: in the file declaration in xml
tagged with: classpath
has answer: http://stackoverflow.com/a/24453641
type: Question
upvote count: 4
tagged with: saml-2.0
downvote count: 0
has body: I have the problem with resolve spring's "classpath:" feature. I a have my file in the next path: src/main/java/resources/FederationMetadata.xml Also, I have a bean: classpath:FederationMetadata.xml <property name="parserPool" ref="parserPool"/> So my problem is that application fails with the next exception: D:\myFolder\myProject\classpath:FederationMetadata.xml does not exist As I understand Spring doesn't resolve file location. I tried with classpath*:, and it didn't help. In another project I have the same settings (with "classpath:") and it works fine. What it can be?
has comment: http://stackoverflow.com/comment/37878923
answer count: 3
has answer: http://stackoverflow.com/a/36745542
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24453553
favorite count: 0

http://stackoverflow.com/q/24427466
type: Question
accepted answer: http://stackoverflow.com/a/24428382
tagged with: enums
has comment: http://stackoverflow.com/comment/37793842
answer count: 3
has comment: http://stackoverflow.com/comment/37793960
has body: This might look similar to a few other questions but so far I have not found a solution.. I am using reflection to parse my JSONs into different classes and it saves me a lot of effort from writing class-specific parsing code, all the ints, longs, strings, and Calendars etc are easy to deal with, but now I find myself in an hell of Enum specific castings something like: else if (field.getType().isAssignableFrom(TransactionType.class)){ field.set(representation, TransactionType.fromInt(Integer.parseInt(value, 10))); } the problem is that enums are stored as integers in the JSON, and I can not find a generic way to parse or cast those integers back to enums when I don't know what enum it specifically is, and I have quite a few enums so 70% of my parsing code are now dedicated to checking enum types... is there a way that, given only field.getType().isEnum() == true, parse the int value to the enum type of that field the enum type is declared as: public static enum TransactionType{ cashback(0),deposit(1),withdraw(2),invitation(3); public int code; TransactionType(int code){ this.code = code; } private final static TransactionType[] map = TransactionType.values(); public static TransactionType fromInt(int n){ return map[n]; } } the JSON can be a bit complicated, but enum related fields has formats as: {transactionType: 1, someOtherEnumType: 0}
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/24428205
has comment: http://stackoverflow.com/comment/37794037
tagged with: parsing
has title: Converting int to Enum in Java reflection
has answer: http://stackoverflow.com/a/24428010
has answer: http://stackoverflow.com/a/24428382
possible better answer: http://stackoverflow.com/a/24428010
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/24530584
answers question: http://stackoverflow.com/q/24530519
type: Answer
has body: You insert the same object reference each time and afterwards change the contents - but the object references still point to the same person. Solution: Create a new object for each iteration. for (int i = 0; i &lt; 5; i++) { Person person = new Person(); person.prename = "Klaus"; person.surname = String.valueOf(i); persons.add(person) System.out.println(person.prename + ". " + person.surname); }
score: 2
upvote count: 2
downvote count: 0

http://stackoverflow.com/comment/38042732
type: Comment
has text: I will try to rework your code based on what I think you want to achieve.
comment on: http://stackoverflow.com/a/24561536
score: 0
type: AnswerComment

http://stackoverflow.com/q/24519595
tagged with: java
has answer: http://stackoverflow.com/a/24519711
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37967765
tagged with: deserialization
has comment: http://stackoverflow.com/comment/37964032
tagged with: serialversionuid
has title: Java: serialize / deserialize failed because of `ClassNotFoundException`
score: 0
accepted answer: http://stackoverflow.com/a/24519636
possible better answer: http://stackoverflow.com/a/24519711
has body: I have a Pilot class, and an instance of that class: bobThePilot. I serialize bobThePilot to a String and copy that to my my hard disk. Then I create a new project and recreate the Pilot class (exactly identical as before).... And then I create newBobThePilot in this new project by de-serializing the String which I got from my disk. But it fails. Everybody said it was because of something named serialVersionUID. Is it possible to do that (serialize and deserialize in different classes (although exactly identical class)? If so, how? Thanks. Morals: add serialVersionUID attribute to our serialized class Example: private static final long serialVersionUID = 1L; implements serializable to all classes which related to our serialized class
tagged with: serialization
has answer: http://stackoverflow.com/a/24519636
has comment: http://stackoverflow.com/comment/37964092
has comment: http://stackoverflow.com/comment/37965955
type: AnsweredQuestion

http://stackoverflow.com/comment/38063477
has text: File file = new File(inputFile); and WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings); are giving error of declaration
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24571297

http://stackoverflow.com/a/24483174
type: Answer
has body: Looks like a NullPointerException. A null pointer exception on a line of the form A.B.C means that something on the left-hand side of a dot is null. This in your case seem to be appearing in line 28 of MainActivity. Seem like it can not find the view by id. Either your Id is mispelled. Please check it.
accepted answer of: http://stackoverflow.com/q/24482624
answers question: http://stackoverflow.com/q/24482624
has comment: http://stackoverflow.com/comment/37898436
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/24552089
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24552042
has body: You are not creating object of array - System.out.println(array667(new int[]{6, 6, 2, 6}));
answers question: http://stackoverflow.com/q/24552042

http://stackoverflow.com/comment/38061439
comment on: http://stackoverflow.com/q/24571155
has text: Be sure only `sqldjbc4.jar` in your classpath and use url `jdbc:sqlserver://localhost; databaseName=Lando`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24447782
has comment: http://stackoverflow.com/comment/37843565
downvote count: 0
score: 37
has body: The equals() and hashCode() methods prove to be very important, when objects implementing these two methods are added to collections. If implemented incorrectly it might screw up your life. equals() : This method checks if some other object passed to it as an argument is equal the object in which this method is invoked. It is easy to implement the equals() method incorrectly, if you do not understand the contract. Before overriding this method, following “properties” need to keep in mind the following Reflexive: o1.equals(o1) - which means an Object (e.g. o1) should be equal to itself Symmetric: o1.equals(o2) if and only o2.equals(o1) Transitive: o1.equals(o2) &amp;&amp; o2.equals(o3) implies that o1.equals(o3) as well Consistent: o1.equals(o2) returns the same as long as o1 and o2 are unmodified null comparison : !o1.equals(null) - which means that any instantiable object is not equal to null. So if you pass a null as an argument to your object o1, then it should return false. Hash code value: o1.equals(o2) implies o1.hashCode() == o2.hashCode(). This is very important. If you define an equals() method then you must define a hashCode() method as well. Also it means that if you have two objects that are equal then they must have the same hashCode, however the reverse is not true From Java source code /* * @param obj the reference object with which to compare. * @return {@code true} if this object is the same as the obj * argument; {@code false} otherwise. * @see #hashCode() * @see java.util.HashMap */ public boolean equals(Object obj) { return (this == obj); } hashCode(): This method returns a hashCode() value as an Integer and is supported for the benefit of hashing based java.util.Collection classes like Hashtable, HashMap, HashSet, etc. If a class overrides the equals() method, it must implement the hashCode() method as well. Before overriding this method, you need to keep in mind: Whenever hashCode() method is invoked on the same object more than once during an …
answers question: http://stackoverflow.com/q/24446763
has comment: http://stackoverflow.com/comment/37843473
has comment: http://stackoverflow.com/comment/37835280
type: Answer
upvote count: 37

http://stackoverflow.com/comment/37857215
type: Comment
comment on: http://stackoverflow.com/a/24462022
type: AnswerComment
has text: i am too new to this, this is amazing, if(timer2!=null){ timer2.cancel(); i am not sure what (timer2!=null) means, it means? if timer2 is exists, timer2 need to be chanceled?
score: 0

http://stackoverflow.com/comment/37817274
has text: See http://stackoverflow.com/questions/9810445/listmapstring-string-vs-list-extends-mapstring-string
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24440078

http://stackoverflow.com/comment/38074310
score: 0
comment on: http://stackoverflow.com/a/24449707
has text: Sorry, I would not solve this problem in java, but Clojure with clojure.data.csv, the solution would be something like (sort-by #(nth % 7) (filter #(= (nth % 3) 803) (csv/read-csv in-file) as at https://github.com/clojure/data.csv
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24569637
has comment: http://stackoverflow.com/comment/38058233
has comment: http://stackoverflow.com/comment/38058425
type: Answer
has body: If there is only one instance of this match in single line then use if instead of while (m1.find()) loop or break the loop once match is found. Sample code: while ( (line = r.readLine()) != null ) { String g11 = null; Matcher m1 = patt1.matcher( line ); if( m1.find() ) { g11=m1.group(3); } if(g11 != null){ System.out.println(g11+"HI1"); //Line2 } }
answers question: http://stackoverflow.com/q/24569304
score: 0

http://stackoverflow.com/a/24565461
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24565397
downvote count: 0
has body: This is a case of misuse of float, rather than a bug. The float type has limited precision, 24 bits for normal numbers, equivalent to a bit over 7 decimal digits. Your long values are all the same in the most significant 12 decimal digits, so they all convert to the same float. Suppressing the most significant 32 bits could have bad effects if there were a carry into them during your time interval. System.nanoTime() has no absolute significance. Only relative values and differences are meaningful. I suggest subtracting the first nanoTime result from each nanoTime result in long, before converting to double or float for subsequent calculations.
type: Answer

http://stackoverflow.com/a/24485041
score: 0
answers question: http://stackoverflow.com/q/24484582
has body: You can use @JsonDeserialize and @JsonSerialize annotations. Implement appropriate classes that convert String into List and vise versa. So in your class there will be List, and comma separated string in the json.
type: Answer

http://stackoverflow.com/q/24434676
type: Question
tagged with: tree-traversal
has title: Embedding a JavaScript snippet in a Java class method
has answer: http://stackoverflow.com/a/24434986
tagged with: javascript
possible better answer: http://stackoverflow.com/a/24434763
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/37806742
has answer: http://stackoverflow.com/a/24434763
has answer: http://stackoverflow.com/a/24434824
favorite count: 0
has comment: http://stackoverflow.com/comment/37806950
type: AnsweredQuestion
score: 3
has body: I have a java program that opens, reads, and write multiple files. it also contains complex logic formatting. Now I wrote on jsfiddle an easy javascript here to do some tree traversals and parsing for me, and it is much easier than implement in Java. My challenge now is how can i “embed” this Javascript script into my Java method. I’m primarily a Java coder. The pseudocode for the Java method is something like this: &lt;Java method begins……&gt; String input = “ABC” //its more complex than ABC String o1= null; //JavaScript script begins, //Javascript evaluates the Java string input //Javascript output is assigned to Java o1 o1 = output; //Javascript script ends //maniputate and process Java string o1 - which is not null &lt;Java method ends&gt;
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24434986
linked to: http://stackoverflow.com/q/7487908

http://stackoverflow.com/a/24452603
has body: You problem is that you are not invoking the super constructor Person2. Your constructor in Student is trying to invoke a the default constructor (with no arguments) of Person2, which doesn't exist. You only have one constructor in Person2, and should call that constructor from the constructor of Student: public Student(String name, int year_of_birth, boolean isEmployed, boolean isStudying, int age) { super(name, year_of_birth, isEmployed, isStudying, age); } This also means you don't need to repeat all of that initialisation code twice. You also shouldn't be repeating all the methods in Student that are in Person2. If you take them out, Student will inherit them anyway. That's the whole point in extending the class in the first place. You should only override a method like that if you don't want the inherited behaviour, but want some Student specific behaviour instead.
type: Answer
accepted answer of: http://stackoverflow.com/q/24452506
has comment: http://stackoverflow.com/comment/37841011
answers question: http://stackoverflow.com/q/24452506
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/37839379

http://stackoverflow.com/a/24545347
answers question: http://stackoverflow.com/q/24541673
type: Answer
upvote count: 10
downvote count: 1
score: 9
accepted answer of: http://stackoverflow.com/q/24541673
has comment: http://stackoverflow.com/comment/38039478
has comment: http://stackoverflow.com/comment/38037045
has comment: http://stackoverflow.com/comment/56974469
has body: You can configure the object mapper to include your publicView.class and exclude other fields as follows: Disable the MapperFeature.DEFAULT_VIEW_INCLUSION mapper feature. Enable the view for serialization via the ObjectMapper#getSerializationConfig().withView() method. See this page for reference. Here is an example: public class JacksonView1 { public static class publicView{} public static class User { public User(Long id, String showName, List&lt;String&gt; callableQueues) { this.id = id; this.showName = showName; this.callableQueues = callableQueues; } @JsonView(publicView.class) public final Long id; public final String showName; @JsonView(publicView.class) public final List&lt;String&gt; callableQueues; } public static void main(String[] args) { User user = new User(123l, "name", Arrays.asList("a", "b")); ObjectMapper mapper = new ObjectMapper(); mapper.disable(MapperFeature.DEFAULT_VIEW_INCLUSION); mapper.setConfig(mapper.getSerializationConfig() .withView(publicView.class)); System.out.println(mapper.convertValue(user, JsonNode.class)); } } Output: {"id":123,"callableQueues":["a","b"]}
type: AcceptedAnswer

http://stackoverflow.com/q/24449406
tagged with: java
type: Question
tagged with: ubuntu
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/37833373
has title: eclipse is not starting in ubuntu and it is stuck
has comment: http://stackoverflow.com/comment/37833421
type: UnansweredQuestion
has body: I have installed eclipse using the command sudo apt-get install eclipse, then i have added Java EE plugin by following the steps given in this link: https://askubuntu.com/questions/81341/install-eclipse-ide-for-java-ee-dev-via-apt-get-is-it-possible I created a project in eclipse and it worked for 2 days without any issues. Suddenly today wen I am trying to start the eclipse I am getting the screen to select a workspace, when I selected my workspace then the eclipse is showing in dull color and it is not starting even after waiting for a long time. I am using eclipse 3.8 version. Below are details from my eclipse.ini file --launcher.XXMaxPermSize 1024m --launcher.defaultAction openFile -vmargs -Xms1024m -Xmx2048m I have set the heap memory minimum as 1GB and maximium as 2GB but still I am facing same issue. If I try to select a different workspace then the eclipse is loading fine. Please help me how can I solve this issue.
answer count: 0

http://stackoverflow.com/comment/37847492
type: QuestionComment
type: Comment
has text: I've done this once. I couldn't get AUTOSTUDY to work, so I tried STUDY. I also put my Java code at the end of my program under `__DATA__`. You can take a look at my question, and see [how I ended up doing this](http://stackoverflow.com/questions/4197693/attempting-to-inline-java-into-perl-via-the-inlinejava-module) to get this to work. Maybe it'll give you some ideas.
comment on: http://stackoverflow.com/q/24456605
score: 0

http://stackoverflow.com/q/24549514
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24549831
has body: I'm trying to start up Jetty with Spring MVC that contains jsp and @Controller. After start jetty I've got every time WARN if I try to call any pages. For example ttp://localhost:8080/getMessageStats/ No mapping found for HTTP request with URI [/resources/css/bootstrap.min.css] in DispatcherServlet with name 'org.springframework.web.servlet.DispatcherServlet-57ad85ed' No mapping found for HTTP request with URI [/resources/js/bootstrap.min.js] in DispatcherServlet with name 'org.springframework.web.servlet.DispatcherServlet-57ad85ed' web.xml <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 contextConfigLocation /WEB-INF/mvc-dispatcher-servlet.xml mvc-dispatcher /cloud/* org.springframework.web.context.ContextLoaderListener 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://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="net.cloud.web.statistics"/> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=".jsp"/> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:annotation-driven /> WebServer.class public class WebServer { private static final Logger log = LoggerFact…
has answer: http://stackoverflow.com/a/24549831
upvote count: 1
tagged with: spring
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/24550630
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38020013
type: Question
has title: Page not found. Spring MVC + Jetty
tagged with: jsp
answer count: 2
has answer: http://stackoverflow.com/a/24550630

http://stackoverflow.com/comment/38053826
type: Comment
comment on: http://stackoverflow.com/a/24523534
has text: Thanks for the above info, I'm able to see parameters when explicitly running testng.xml file
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37827613
score: 0
has text: Does RandomizedQueue iterator return an instance of RandomIterator? Where do you pass `N` in the RandomIterator. It looks like you initialize the RandomIterator with values, however, if you enqueue after initializing it, nothing is there to begin with, so *nothing* will be shuffled
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24445963

http://stackoverflow.com/q/24501153
has title: How to run Checkstyle, Findbugs, or PMD programmatically on file *content*
tagged with: atlassian-plugin-sdk
tagged with: pmd
has answer: http://stackoverflow.com/a/24523172
answer count: 2
downvote count: 0
tagged with: findbugs
favorite count: 0
type: UnansweredQuestion
has body: I'm writing a utility which checks Atlassian Stash pull requests for modified files - the goal is to run each Java file through Checkstyle (or Findbugs, or PMD), and then have the plugin comment on each line with problems. To accomplish this, the plugin must run the contents of each modified Java file in the request through Checkstyle (or other code style enforcement utility). The Atlassian Stash API makes it quite easy to get the contents of modified files, but it doesn't appear possible to run those contents through Checkstyle programmatically - the only way to do it would be to save a temp file on disk and run the Checkstyle jar against it by calling a Runtime.getRuntime().exec(...) command. Are there any simplified Checkstyle-like utilities which can be run programmatically using a Java API? I essentially need something that can do something like this: String contentsOfJavaFile = ; //stuff List&lt;Problem&gt; problems = CheckstyleOrSomethingElse.analyze(contentsOfJavaFile); for(Problem p : problems) { // p.getLine(); // p.getDescription(); // add comment to Stash }
upvote count: 6
tagged with: checkstyle
tagged with: java
score: 6
has answer: http://stackoverflow.com/a/24518515
has comment: http://stackoverflow.com/comment/37962548
has comment: http://stackoverflow.com/comment/37966630
type: Question

http://stackoverflow.com/comment/37990828
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24533068
type: Comment
has text: I moved the code to question.I am not aggragating the nested messages as root message. I use many splitters in my code to just enrich the response and for other purposes.So, ultimately, in my code, the number of splitters is not equal to the number of aggregators. I just want to combine the split messageo of the first splitter. Of course, the split messages are modified in the middle till they reach the aggregator. But I am expecting all of them coming as one list of messages.For eg: Assume first splitter yielded 2 messages. Then aggregator should receive those two messages as single list.

http://stackoverflow.com/q/24536338
has answer: http://stackoverflow.com/a/27964737
has title: Hibernate OGM OneToMany self reference
score: 1
tagged with: java
upvote count: 1
tagged with: hibernate-ogm
type: Question
tagged with: mongodb
answer count: 1
downvote count: 0
favorite count: 0
has body: I am using Hibernate OGM with MongoDB and have an Entity like the following : @Entity public class Card implements Serializable, Comparable&lt;Card&gt; { private static Logger logger = LoggerFactory.getLogger(Card.class); @Id @GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") private String id; ... @OneToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) private Card cardRef; @OneToOne(mappedBy = "cardRef") private Card cardParent; // pinning : represents the owner's card @ManyToOne private Card cardPinOrigin; // List of the cards that have pinned the current @OneToMany(mappedBy = "cardPinOrigin") private List&lt;Card&gt; cardsPinned = new ArrayList&lt;&gt;(); ... } When I store cards through update a card with a card in the 'cardsPinned' list, it is stored in the database : 'Parent' card { "_id" : "39d83887-e466-45c5-a5e8-1dfd5c22ed8a", "cardPinOrigin" : [ { "id" : "478f6f83-161f-44dc-86c4-844f73084ffb" } ], .... } and 'Child' card { "_id" : "478f6f83-161f-44dc-86c4-844f73084ffb", "cardPinOrigin_id" : "39d83887-e466-45c5-a5e8-1dfd5c22ed8a", ... } My problem is that when I get data from the database, the List of pinned cards (cardsPinned java List) is always empty. Does someone know why ? Thanks in advance for your answers.
type: UnansweredQuestion

http://stackoverflow.com/q/24432812
has title: Java- adding a new row to a JTable in GUI
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37803661
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37803873
has comment: http://stackoverflow.com/comment/37804956
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/37804025
score: 0
has answer: http://stackoverflow.com/a/24433235
answer count: 1
has body: I have a simple Java GUI which is displaying an empty table and a few buttons. I am now trying to add a listener to one of the buttons that will add a new empty row (with editable cells) to the table in the GUI. I am using the following code to try and do this: JButton addBtn = new JButton("Add"); addBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println("'Add' button pressed. "); DefaultTableModel model = (DefaultTableModel)jEntityFilterTable.getModel(); model.addRow(new Object[]{"Site", "Application", "Entity"}); System.out.println("--- ActionListener added to 'addBtn' ---"); } }); However, when I click the button, I am getting a java.lang.ArrayIndexOutOfBoundsException. It says that this is occurring on the following line: model.addRow(new Object[]{"Site", "Application", "Entity"}); I am not sure why I'm getting this exception... I've created a new Object[] array, and given it three elements... but I'm not trying to access those elements (or any elements that don't exist)... Can anyone point out what I'm doing wrong here?

http://stackoverflow.com/q/24491437
type: Question
has title: This piece of Android code keeps crashing. I need assistance?
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/24491876
has comment: http://stackoverflow.com/comment/37912858
favorite count: 0
has comment: http://stackoverflow.com/comment/37912706
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/37912780
has comment: http://stackoverflow.com/comment/37913603
has comment: http://stackoverflow.com/comment/37912679
has comment: http://stackoverflow.com/comment/37912526
upvote count: 0
has comment: http://stackoverflow.com/comment/37912726
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24491606
has answer: http://stackoverflow.com/a/24491587
linked to: http://stackoverflow.com/q/12122624
has answer: http://stackoverflow.com/a/24491639
has answer: http://stackoverflow.com/a/24491637
tagged with: java
has comment: http://stackoverflow.com/comment/37912646
has comment: http://stackoverflow.com/comment/37912772
tagged with: eclipse
has body: This is the code I did. But it did not work. Please help? The app itself lets the user enter his/her name on the EditText, he clicks on the button and the TextView will say like for example his name is Sam. "Your name is Sam". package com.example.myfirstandroidapp; import java.text.Format.Field; import java.util.EventListener; import javax.security.auth.PrivateCredentialPermission; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.os.Build; import android.provider.ContactsContract.CommonDataKinds.Event; public class MainActivity extends ActionBarActivity { EditText nameTextBox; TextView nameTextView; Button nameButton; @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(); } nameTextBox = (EditText)findViewById(R.id.nameTextBox); nameTextView = (TextView)findViewById(R.id.nameTextView); nameButton = (Button)findViewById(R.id.nameButton); nameButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Clicker(); } }); } public void Clicker() { if (nameTextBox.getText().toString() != "") { nameTextView.setText("Your name is " + nameTextBox.getText().toString()); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean on…
has comment: http://stackoverflow.com/comment/37913346

http://stackoverflow.com/q/24540124
has answer: http://stackoverflow.com/a/32139367
tagged with: java
has title: Separated websocket for each connected client
type: Question
has comment: http://stackoverflow.com/comment/38024608
has answer: http://stackoverflow.com/a/24540472
has body: I am planing to develop JavaScript client application that will connect to Java server using websocket. Server should handle many connected clients. After some reading I found out websocket single thread. This is not good if I want to run databases query that can block everything for a while. What I am thinking about is to opening separated websocket for each JavaScript client. One socket is listening for new connection and when connection is established creates some unique id. After that opens new websocket and send id to client using listener socket. When client received id close first socket and connect to new one. What do you think, is it good solution? Maybe I am missing something?
tagged with: websocket
downvote count: 0
tagged with: javascript
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/38002490
has answer: http://stackoverflow.com/a/24540811
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: network-programming

apache
tag name: apache
tags question: http://stackoverflow.com/q/24512144
tags question: http://stackoverflow.com/q/24575639
tags question: http://stackoverflow.com/q/24578243
tags question: http://stackoverflow.com/q/24427847
tags question: http://stackoverflow.com/q/24493230
tags question: http://stackoverflow.com/q/24507406
tags question: http://stackoverflow.com/q/24519531
tags question: http://stackoverflow.com/q/24554158
tags question: http://stackoverflow.com/q/24458350
tags question: http://stackoverflow.com/q/24536559
tags question: http://stackoverflow.com/q/24440283
tags question: http://stackoverflow.com/q/24428341
tags question: http://stackoverflow.com/q/24535926
tags question: http://stackoverflow.com/q/24512121
tags question: http://stackoverflow.com/q/24570588
type: Tag
tags question: http://stackoverflow.com/q/24444875
tags question: http://stackoverflow.com/q/24503575

http://stackoverflow.com/a/24459106
type: Answer
has comment: http://stackoverflow.com/comment/37859099
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24453125
downvote count: 0
has comment: http://stackoverflow.com/comment/60515376
has body: Do this: Textfield&lt;String&gt; tf1 = new TextField&lt;String&gt;("tf1"); tf1.setConvertEmptyInputStringToNull(false); form.add(tf1); The value from the textfield is now an empty string

http://stackoverflow.com/q/24486685
has comment: http://stackoverflow.com/comment/37906613
type: Question
has title: java.sql.SQLException: Closed Connection java JDBC
upvote count: 1
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24486706
has comment: http://stackoverflow.com/comment/37903641
has comment: http://stackoverflow.com/comment/37903675
type: UnansweredQuestion
has body: I am getting the Error in Production as per below. Can any one give some input to eliminate this error. java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:147) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:209) at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3550) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3396) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3460) at com.IBS.trade.order.netPortfolio.getClientPortfolioDetails(netPortfolio.java:556) at core.ClientThreadInteractive.getNetPortFolioData(ClientThreadInteractive.java:14403) at core.ClientThreadInteractive.netPortfolioSingle(ClientThreadInteractive.java:14370) at core.ClientThreadInteractive.run(ClientThreadInteractive.java:1895)
has answer: http://stackoverflow.com/a/24487923
has answer: http://stackoverflow.com/a/62257655
tagged with: jdbc
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/38039952
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24560138
has text: Of course, it might make more sense to define it as `compareTo(Employee o)` (so that you don't need to do `instanceof`), unless you must conform to a superclass or interface definition of the method.

http://stackoverflow.com/q/24555728
tagged with: java
has comment: http://stackoverflow.com/comment/38031164
has answer: http://stackoverflow.com/a/24555812
tagged with: eclipse
linked to: http://stackoverflow.com/q/5241388
has title: Executable Jar Exceptions
type: Question
downvote count: 0
tagged with: executable-jar
has comment: http://stackoverflow.com/comment/38031511
tagged with: exception
accepted answer: http://stackoverflow.com/a/24555812
answer count: 1
score: 1
favorite count: 0
upvote count: 1
linked to: http://stackoverflow.com/q/2083211
type: AnsweredQuestion
has body: I have not been able to find a clear answer on Google. What happens if an unhandled exception is thrown during runtime by an executable jar file? Will it open CMD? Also, would (exception_name).printStackTrace() do the same? I would test these things, but I do not know how to create an executable .jar. So a short explanation on how to create one in Eclipse would also be appreciated. (Easy to lookup and found)

http://stackoverflow.com/a/24474096
downvote count: 0
answers question: http://stackoverflow.com/q/24473136
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24473136
type: AcceptedAnswer
has body: In order to access your external service via HTTP, you have to write a client. CQ provides commons-httpclient bundle and you may use it to access the service. Documentation for the library can be found here. I don't know if the service expects that the file will be send using PUT or POST, but httpclient provides all these methods. All you have to do is to provide appropriate InputStream. Adapt your resource to Rendition and use getStream() method to get the InputStream. When you'll get the modified asset from the webservice, you need to replace the original one: // rendition = ...; // original rendition object created as above // newInputStream = ...; // new asset received from your webservice Asset asset = rendition.getAsset(); asset.addRendition("original", newInputStream, rendition.getMimeType());
type: Answer
score: 2

http://stackoverflow.com/a/24638840
type: Answer
answers question: http://stackoverflow.com/q/24493230
has body: You anchor your pattern to the beginning of the string (the URI path), but the start of the pattern does not match the '/' character that will always start the URI path. This pattern would probably work better: ^/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ Since you are using the NC option for case-insensitive matching, you should be able to reduce that to: ^/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/?$ You could even consider simplifying it to this (in which case NC will no longer be relevant): ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ That will pick out each path segment regardless of the characters in it, leaving validation of the parameters to your application. In any case, you may need to use the PT (passthrough) option to get AJP to claim the rewritten URL (but test, because it's more efficient to not passthrough).
score: 0
has comment: http://stackoverflow.com/comment/38190710

http://stackoverflow.com/comment/38072614
comment on: http://stackoverflow.com/a/24496472
type: AnswerComment
score: 0
type: Comment
has text: Yes. And that's looking like a seroius question. Can you think something else than the conventional ways? I'm looking for it.

http://stackoverflow.com/comment/37919297
type: Comment
has text: you need to add the tag for the Server side processing language.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24495102

http://stackoverflow.com/q/24564011
tagged with: performance
tagged with: java
downvote count: 1
type: Question
answer count: 2
has title: Calculating objects without generating too much garbage
has comment: http://stackoverflow.com/comment/38047322
has answer: http://stackoverflow.com/a/24565432
has answer: http://stackoverflow.com/a/24564162
score: 0
has comment: http://stackoverflow.com/comment/38047400
favorite count: 0
has body: At the moment I'm developing a game for Android. For this all my objects have a Vec3 position. This is an excerpt from the class: public class Vec3 { public float x, y, z; public Vec3(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } public Vec3 add(Vec3 v) { return new Vec3(this.x + v.x, this.y - v.y, this.z + v.z); } public Vec3 sub(Vec3 v) { return new Vec3(this.x - v.x, this.y - v.y, this.z - v.z); } } Now let's say I want to run this code where a, b and c are vectors from the Vec3 class: a.add(b).sub(c); If I run this code with many different vectors it comes to lags in my game because sometimes when the vectors are not needed anymore the garbage collector will remove them all at the same time. I thought that I can solve the problem with a variable pool but here is the problem.. I do not exactly know when the vector is not used anymore in my game so I do not know where I have to check the vector in. Another problem is that I generate a lot of vector objects at the add and sub method. I want to calculate the vectors without to change them itself thats why I return a new Vec3 every time. Let's say I run this code: a.add(b).add(b).add(b).add(b).add(b).sub(c); With that I generate six new vector objects but if you think about that I only need one to calculate the vectors and to store the result without to change the original vectors. This is also a problem which I can't solve with a variable pool. Do you have any ideas how I can solve this problems in an efficient way?
type: UnansweredQuestion
tagged with: garbage-collection
upvote count: 1

http://stackoverflow.com/a/24576810
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24575507
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24575507
has body: It might be related to this JIRA Issue "Performance issues with SerializableTypeWrapper on Java 1.7.0_51", which was fixed in 4.0.1.
type: AcceptedAnswer

http://stackoverflow.com/a/24527755
type: Answer
answers question: http://stackoverflow.com/q/24527232
has body: In your sample the first method is IMHO better. But if you need some concatenation operations on debugging the second variant is preferrable. Here is an example: if( debugger.DEBUG ) debugger.print_unchecked( "Or this method 2" + oldValue + "//" + newValue); In this case compiler can avoid unnecessary string concatenation and invoking of toString() methods. Here is my test: public class DebuggerTest { static final int ITER_NUM = 5000000; public static class Debug { // setting public final static boolean DEBUG = false; private final List&lt;String&gt; collector = new ArrayList&lt;String&gt;(ITER_NUM); void print_checked( String s ) { if( DEBUG ) collector.add(s); } void print_unchecked( String s ) { collector.add(s); } } public static void main(String[] args) { Debug debug = new Debug(); long time = System.currentTimeMillis(); for (int i = 0; i &lt; ITER_NUM; i++) { debug.print_checked("Debug message " + i); } System.out.println("First: " + (System.currentTimeMillis() - time)); debug = new Debug(); time = System.currentTimeMillis(); for (int i = 0; i &lt; ITER_NUM; i++) { if (Debug.DEBUG) debug.print_unchecked("Debug message " + i); } System.out.println("Second: " + (System.currentTimeMillis() - time)); } } Result: First: 339 Second: 2
score: 0

http://stackoverflow.com/comment/38136510
type: Comment
comment on: http://stackoverflow.com/a/24554778
has text: Check the doc on the cassandra.yaml. Under the section for "memtable settings" you'll see that you can increase the number of memtable_flush_writers, which is useful "If you have a large Java heap size and many data directories, you can increase the value for better flush performance.": http://www.datastax.com/documentation/cassandra/2.0/cassandra/configuration/configCassandra_yaml_r.html?scroll=reference_ds_qfg_n1r_1k__PerformanceTuningProps
score: 0
type: AnswerComment

http://stackoverflow.com/q/24460712
has comment: http://stackoverflow.com/comment/37854587
has answer: http://stackoverflow.com/a/24460745
tagged with: types
answer count: 5
tagged with: input
has comment: http://stackoverflow.com/comment/37854872
has body: So, I'm very new to Java (just started class last week), and I'm trying to write a class to manipulate prime numbers. I'm pretty good with python, but have no idea what I'm doing here apparently. When I try to use the isPrime method I get the error: "cannot invoke isPrime() on the primitive type int." Any help? As near as I can tell, the method should take an int and assign it to the method variable p. Do I have something backwards? Thanks for your help! public class Prime { private int prime; public static void main(String[] args) { int seventeen = 17; int five = 5; int twentyFour = 24; System.out.println(twentyFour.isPrime()); System.out.println(seventeen.isPrime()); System.out.println(five.isPrime()); } public Prime(int p) { prime = p; } public boolean isPrime(int p){ int i=0; if(p==1 || p==0) return false; for(i=2; i&lt;=p; i++) { if(p%i == 0) return false; } return true; } public int getPrime(){ prime++; while(!prime.isPrime()){ prime++; } return prime; } public void reset(){ prime = 1; } }
has title: Trouble with method taking the correct type
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37854661
tagged with: methods
has answer: http://stackoverflow.com/a/24460767
has answer: http://stackoverflow.com/a/24460766
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24460789
has answer: http://stackoverflow.com/a/24460802

jdeveloper
tags question: http://stackoverflow.com/q/24453449
tags question: http://stackoverflow.com/q/24503219
type: Tag
tag name: jdeveloper
tags question: http://stackoverflow.com/q/24510120
tags question: http://stackoverflow.com/q/24530366

http://stackoverflow.com/a/24483265
has comment: http://stackoverflow.com/comment/37897783
score: 0
answers question: http://stackoverflow.com/q/24483176
type: Answer
has comment: http://stackoverflow.com/comment/37897834
has body: Whether you have Object ref = new String("object of type string"); or String ref = new String("still object of type string"); the object referenced will be of type String. Doing Object obj = (Object) new String("still a string"); does not change that the referenced object is a String. In your case, you'll probably need a conversion strategy to convert between types.

http://stackoverflow.com/comment/37930181
score: 0
type: Comment
has text: Sub imaging is also faster, but will still come down to how the image is been used.
type: QuestionComment
comment on: http://stackoverflow.com/q/24500899

http://stackoverflow.com/a/24583425
type: Answer
has comment: http://stackoverflow.com/comment/38082995
upvote count: 1
has body: First, String line = ""; Creates a new line variable with the value of empty string, you could also use, String line; // or = null; Because, while((line = reader.readLine()) != null) { System.out.println(line); } Begins a while loop replacing the String referred to by line with a new line obtained by calling readLine() from reader). Next, if that String is null the loop body would not run (if it isn't the loop body does). Finally, I added a loop body. In this case to print the line to the console, which again only prints while line is not null.
answers question: http://stackoverflow.com/q/24583384
downvote count: 0
score: 1

http://stackoverflow.com/comment/37923435
has text: Oh, yes, my bad. I'm having some difficulty analyzing your requirements. Could you perhaps edit your question with example inputs and what the desired output is for each of them?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24497204

http://stackoverflow.com/comment/38787895
score: 0
type: Comment
type: QuestionComment
has text: @PeGiannOS Hmmm.. CPU is average but GPU might be the problem. Have you tried combining JavaFX with OpenGL yet? Swing is no longer developed.
comment on: http://stackoverflow.com/q/24445840

http://stackoverflow.com/a/24475054
type: AcceptedAnswer
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24469230
accepted answer of: http://stackoverflow.com/q/24469230
has body: Before doing that programmatically you'd better try to build your UI in the layout.xml and only then do that things programmatically. There should be relative layout in your layout.xml. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout ... Your edittext should be inside relative layout in order to apply RelativeLayout.LayoutParams to it. And your code will look like that: RelativeLayout PO = (RelativeLayout)RV .findViewById(R.id.RL1); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams ((int) LayoutParams.WRAP_CONTENT, (int) LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.CENTER_VERTICAL); ET.setLayoutParams(params); Also you may found helpful the last answer in the following link: http://www.coderanch.com/t/505316/Android/Mobile/put-layout-middle-screen

http://stackoverflow.com/q/24493656
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24494835
tagged with: java
has comment: http://stackoverflow.com/comment/37916936
has comment: http://stackoverflow.com/comment/37917114
has comment: http://stackoverflow.com/comment/37917024
type: Question
has comment: http://stackoverflow.com/comment/37916680
upvote count: 0
score: -2
tagged with: jsp
answer count: 3
has answer: http://stackoverflow.com/a/24497940
has answer: http://stackoverflow.com/a/24497387
has title: Code not executed after if condition on JSP page
favorite count: 0
has body: I have written the following code on my JSP. After System.out.println("------------------------medicine-------144444444444-----"); line my next sop is not coming.So what is wrong?Please help. <% System.out.println("------------------------medicine-------144444444444-----"); if (padetaillist6.get(a).getBph() != null && !padetaillist6.get(a).getBph().isEmpty()) { %> BP <input type="text" name="txtbph" id="txtbph" placeholder="High Bp" class="form-control" style="color: black" value="<%=padetaillist6.get(a).getBph()%>"> / <input type="text" name="txtlbp" id="txtlbp" placeholder="Low Bp" class="form-control" style="color: black" value="<%=padetaillist6.get(a).getLbp()%>"> <% } %> <% System.out.println("------------------------medicine-------155555555-----"); if (!padetaillist6.get(a).getRr().equals("")) { %> RR <input type="text" name="txtrr" id="txtrr" placeholder="RR" style="color: black" class="form-control" value="<%=padetaillist6.get(a).getRr()%>"> <% } %>

http://stackoverflow.com/q/24538586
has comment: http://stackoverflow.com/comment/38000052
answer count: 1
has comment: http://stackoverflow.com/comment/37999660
has comment: http://stackoverflow.com/comment/38000104
has comment: http://stackoverflow.com/comment/37999556
has comment: http://stackoverflow.com/comment/37999513
has comment: http://stackoverflow.com/comment/38000342
has comment: http://stackoverflow.com/comment/37999518
has comment: http://stackoverflow.com/comment/38000293
has comment: http://stackoverflow.com/comment/37999550
has answer: http://stackoverflow.com/a/24538742
has comment: http://stackoverflow.com/comment/37999638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38000007
has comment: http://stackoverflow.com/comment/37999863
has comment: http://stackoverflow.com/comment/37999407
has body: This question is specifically geared towards the Java language, but I would not mind feedback about this being a general concept if so. I would like to know which operation might be faster, or if there is no difference between assigning a variable a value and performing tests for values. For this issue we could have a large series of Boolean values that will have many requests for changes. I would like to know if testing for the need to change a value would be considered a waste when weighed against the speed of simply changing the value during every request. public static void main(String[] args){ Boolean array[] = new Boolean[veryLargeValue]; for(int i = 0; i &lt; array.length; i++) { array[i] = randomTrueFalseAssignment; } for(int i = 400; i &lt; array.length - 400; i++) { testAndChange(array, i); } for(int i = 400; i &lt; array.length - 400; i++) { justChange(array, i); } } This could be the testAndChange method public static void testAndChange(Boolean[] pArray, int ind) { if(pArray) pArray[ind] = false; } This could be the justChange method public static void justChange(Boolean[] pArray, int ind) { pArray[ind] = false; } If we were to end up with the very rare case that every value within the range supplied to the methods were false, would there be a point where one method would eventually become slower than the other? Is there a best practice for issues similar to this? Edit: I wanted to add this to help clarify this question a bit more. I realize that the data type can be factored into the answer as larger or more efficient datatypes can be utilized. I am more focused on the task itself. Is the task of a test "if(aConditionalTest)" is slower, faster, or indeterminable without additional informaiton (such as data type) than the task of an assignment "x=avalue".
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37999455
has title: Performance difference between assignment and conditional test
has comment: http://stackoverflow.com/comment/38000203
type: Question
has comment: http://stackoverflow.com/comment/37999921
has comment: http://stackoverflow.com/comment/38000842
accepted answer: http://stackoverflow.com/a/24538742
has comment: http://stackoverflow.com/comment/37999557

http://stackoverflow.com/a/39637752
answers question: http://stackoverflow.com/q/24547673
has body: If you would like a serializable optional, consider instead using guava's optional which is serializable.
type: Answer
downvote count: 1
score: 14
upvote count: 15

http://stackoverflow.com/comment/38050289
type: QuestionComment
comment on: http://stackoverflow.com/q/24565525
has text: What is center aligned? Also if you just want to print the array why did u use the separate printArray function? instead of the function call u could just print the values right ? i.e Replacing printArray(array); with System.out.print(array[x][y]);
score: 0
type: Comment

http://stackoverflow.com/comment/38015407
score: 0
type: AnswerComment
type: Comment
has text: Why _id is null in group statement??
comment on: http://stackoverflow.com/a/24545823

date
tags question: http://stackoverflow.com/q/24446229
tags question: http://stackoverflow.com/q/24452905
tags question: http://stackoverflow.com/q/24527611
tag name: date
tags question: http://stackoverflow.com/q/24574179
tags question: http://stackoverflow.com/q/24513674
tags question: http://stackoverflow.com/q/24514510
tags question: http://stackoverflow.com/q/24451419
tags question: http://stackoverflow.com/q/24463542
tags question: http://stackoverflow.com/q/24562875
tags question: http://stackoverflow.com/q/24554241
tags question: http://stackoverflow.com/q/24522096
tags question: http://stackoverflow.com/q/24558448
tags question: http://stackoverflow.com/q/24433907
tags question: http://stackoverflow.com/q/24449097
tags question: http://stackoverflow.com/q/24452107
tags question: http://stackoverflow.com/q/24583576
tags question: http://stackoverflow.com/q/24558080
type: Tag
tags question: http://stackoverflow.com/q/24535526
tags question: http://stackoverflow.com/q/24483172
tags question: http://stackoverflow.com/q/24566831
tags question: http://stackoverflow.com/q/24475172
tags question: http://stackoverflow.com/q/24432639
tags question: http://stackoverflow.com/q/24540443
tags question: http://stackoverflow.com/q/24486788
tags question: http://stackoverflow.com/q/24537602
tags question: http://stackoverflow.com/q/24490442
tags question: http://stackoverflow.com/q/24559836
tags question: http://stackoverflow.com/q/24446524

http://stackoverflow.com/comment/37970636
type: Comment
type: QuestionComment
has text: i get the value for the Log.d(cn.getName). it just crashed when it reach setText line.
comment on: http://stackoverflow.com/q/24523179
score: 0

http://stackoverflow.com/q/24527739
type: Question
upvote count: 0
score: -2
tagged with: jsp
has answer: http://stackoverflow.com/a/24527796
has answer: http://stackoverflow.com/a/24528094
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24528223
has comment: http://stackoverflow.com/comment/37979484
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37978917
tagged with: java
has body: How to convert an array into String in JSP. Here, I am using the code : String str = a.toString(); after this, I have to print that String too but if I try the output shows like ASCII values. Can you please help me?
has comment: http://stackoverflow.com/comment/37979171
has title: Conversion of Array to Strings

http://stackoverflow.com/comment/37907941
has text: yup saw that one.. uses the google maps utility library .. wanna know how to achieve something like the default map using that library or any other thats available
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24489083
score: 0

http://stackoverflow.com/q/24553418
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/24556212
type: Question
score: 0
has comment: http://stackoverflow.com/comment/38027566
answer count: 1
has body: can you please suggest me, how can i call inside of first AsyncCallback after calling on Success, the second AsyncCyllback? i use gwt rpc and load my data into ui, and after calling this first AsyncCallback on Success method i must call another AsyncCallback that execute the next part of the first AsyncCallback and load data from db into ui: void show(int last) { AsyncCallback&lt;List&lt;C&gt;&gt; callback = new AsyncCallback&lt;List&lt;C&gt;&gt;() { public void onFailure(Throwable caught) { } public void onSuccess(List&lt;C&gt; result) { panelCharts.clear(); for (C c : result) { first = new Chart() .setType(Series.Type.SPLINE) .setSizeToMatchContainer() .setLegend( new Legend() .setLayout(Legend.Layout.VERTICAL) .setAlign(Legend.Align.RIGHT) .setVerticalAlign( Legend.VerticalAlign.TOP) .setX(-10).setY(100) .setBorderWidth(0)) .setZoomType(Chart.ZoomType.X_AND_Y); first.setStyleName("chart"); Series series = first .createSeries() .setName("Summer") .setPoints( new Number[] { 7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6 }); first.setCredits(new Credits().setEnabled(false)); first.addSeries(series); first.setChartTitleText(c.getName()); AsyncCallback&lt;List&lt;M&gt;&gt; callbackA = new AsyncCallback&lt;List&lt;M&gt;&gt;() { public void onFailure(Throwable caught) { } public void onSuccess(List&lt;M&gt; result) { for (M m : result) { Series serie = firstChart.createSeries().setName( m.getDName()); first.addSeries(serie); } } }; rpcService.getKList(ID, callbackA); panelCharts.add(first); } } }; rpcService.getList(last, callback); }
has comment: http://stackoverflow.com/comment/38027187
has comment: http://stackoverflow.com/comment/38027744
has title: Call callback inside another one
type: UnansweredQuestion

http://stackoverflow.com/comment/37934196
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24503173
has text: search in google and stackoverflow and ask questions. It may be duplicate.see below link... http://stackoverflow.com/questions/8950854/auto-start-application-after-boot-completed-in-android

http://stackoverflow.com/q/24570899
has answer: http://stackoverflow.com/a/24571004
tagged with: eclipse
downvote count: 0
has answer: http://stackoverflow.com/a/24570991
accepted answer: http://stackoverflow.com/a/24570991
favorite count: 0
has title: How to increase Permgen size in eclipse
has answer: http://stackoverflow.com/a/24583003
possible better answer: http://stackoverflow.com/a/24571004
answer count: 4
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/62621351
type: Question
type: AnsweredQuestion
score: 3
has body: I got frequently perm gen error . how to increase Permgen size in eclipse. what is the way to increase Permgen space in eclipse.

http://stackoverflow.com/q/24521832
has comment: http://stackoverflow.com/comment/37968114
score: 0
tagged with: joptionpane
has title: Java JOptionPane.showInputDialog with constructor
has answer: http://stackoverflow.com/a/24542971
tagged with: constructor
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24523500
tagged with: arrays
has comment: http://stackoverflow.com/comment/37968254
has body: First post, I hope I don't seem to n00bish. I am in a Java class and am stuck with a problem. The requirement is to make a class (Contact) which has getters and a constructor for name, email and phoneNumber. Then a test class (TestContact) which has a while loop that keeps prompting the user because the hit OK and didn't type anything, hit Enter or the name is over 21 characters. Also, the three variables I need (name, email and phone number) are to be entered in the same input box (parsed by the whitespace between). I can't seem to figure out how to get it working. I have many bugs. Firstly, I'm not sure how I can setup the array and then split it with the whitespace then use that array to set my variable &amp; getters (hope that makes sense?). Also, the program keeps crashing because of NullPointerException in the array and array index out of bounds exception. Contact class: public class Contact { //Initiating variables private String name; private String phoneNumber; private String eMail; //Constructor public Contact() { this.name = getName(); this.phoneNumber = getPhoneNumber(); this.eMail = getEMail(); } //Getter for name variable public String getName() { return name; } //Getter for phoneNumber variable public String getPhoneNumber() { return phoneNumber; } //Getter for eMail variable public String getEMail() { return eMail; } } TestContact class: public class testContact { public static void main(String[] args) { Contact myContact = new Contact(); String userInput; String noUserInput; userInput = JOptionPane.showInputDialog("Please enter your First and Last Name, Phone Number, &amp; E-mail: "); do { String[] phrases = userInput.split(" "); String name = phrases[0] + " " + phrases[1]; String phoneNumber = phrases[2]; String eMail = phrases[3]; if (!userInput.equals("")) { if (name.length() &gt; 21) { String userInput = JOptionPane.showInputDialog("I'm sorry but your name is too long.\nPlease enter your First and Last Name, Phone Number, &amp; E-mail: "); Strin…

http://stackoverflow.com/q/24449987
has body: I have a common library that is shared among different project. As the library is constantly extended (at least for now), it should just be picked up from eclipse workspace during build. I'm trying to use the maven-dependency-plugin to copy all dependencies in a /lib folder next to the runnable jar. But it does not work: my.domain project-commons maven-dependency-plugin 2.8 copy-dependencies package copy-dependencies ${project.build.directory}/lib/ true [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies (copy-dependencies) on project mydomain: Artifact has not been packaged yet. When used on reactor artifact, copy should be executed after packaging: see MDEP-187. -> [Help 1] The error ocures when maven tries to copy the commons project that is open in the workspace. Did I miss anything?
type: UnansweredQuestion
tagged with: maven
upvote count: 4
downvote count: 0
has title: How to create runnable jar with dependencies in extra folder on mutimodule project?
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
tagged with: jar
has answer: http://stackoverflow.com/a/25656535
score: 4
favorite count: 0

zxing
tags question: http://stackoverflow.com/q/24533233
tag name: zxing
type: Tag
tags question: http://stackoverflow.com/q/24586109

http://stackoverflow.com/comment/37936807
type: AnswerComment
comment on: http://stackoverflow.com/a/24504480
has text: @SamuelGarcía The only way to get a better understanding of the problem is to debug it. You could add logging/printing just before and just after this line to see the values as well.
score: 0
type: Comment

http://stackoverflow.com/q/24471561
tagged with: decision-tree
favorite count: 0
has body: I'm trying to implement simple demo for decision tree classifier using java and apache spark 1.0.0 version. I base on http://spark.apache.org/docs/1.0.0/mllib-decision-tree.html. So far I've wrote code listed below. in line with following code I get error: org.apache.spark.mllib.tree.impurity.Impurity impurity = new org.apache.spark.mllib.tree.impurity.Entropy(); Type mismatch: cannot convert from Entropy to Impurity. It's strange for me, while class Entropy implements Impurity interface: https://spark.apache.org/docs/1.0.0/api/java/org/apache/spark/mllib/tree/impurity/Entropy.html I'm looking answer for question why I can't make this assignment? package decisionTree; import java.util.regex.Pattern; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.Function; import org.apache.spark.mllib.linalg.Vectors; import org.apache.spark.mllib.regression.LabeledPoint; import org.apache.spark.mllib.tree.DecisionTree; import org.apache.spark.mllib.tree.configuration.Algo; import org.apache.spark.mllib.tree.configuration.Strategy; import org.apache.spark.mllib.tree.impurity.Gini; import org.apache.spark.mllib.tree.impurity.Impurity; import scala.Enumeration.Value; public final class DecisionTreeDemo { static class ParsePoint implements Function&lt;String, LabeledPoint&gt; { private static final Pattern COMMA = Pattern.compile(","); private static final Pattern SPACE = Pattern.compile(" "); @Override public LabeledPoint call(String line) { String[] parts = COMMA.split(line); double y = Double.parseDouble(parts[0]); String[] tok = SPACE.split(parts[1]); double[] x = new double[tok.length]; for (int i = 0; i &lt; tok.length; ++i) { x[i] = Double.parseDouble(tok[i]); } return new LabeledPoint(y, Vectors.dense(x)); } } public static void main(String[] args) throws Exception { if (args.length &lt; 1) { System.err.println("Usage:DecisionTreeDemo &lt;file&gt;"); System.exit(1); } JavaSparkContext ctx = n…
accepted answer: http://stackoverflow.com/a/25307903
has title: Decision tree implementation issue in apache spark with java
upvote count: 6
type: AnsweredQuestion
tagged with: bigdata
score: 6
tagged with: machine-learning
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25307903
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/37882489
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37938775
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24454468
has text: I wanted to iterate over the values in two hashtables, compare them, and remove those values in table 1 that appear also in table 2. I've solved this as follows:

http://stackoverflow.com/q/24524698
downvote count: 0
has comment: http://stackoverflow.com/comment/37973819
has answer: http://stackoverflow.com/a/24524897
favorite count: 0
has title: no display in JTextArea inspite of using setText function
possible better answer: http://stackoverflow.com/a/24524894
has comment: http://stackoverflow.com/comment/37973421
has comment: http://stackoverflow.com/comment/37973391
has answer: http://stackoverflow.com/a/24524894
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37973492
score: 1
tagged with: mouselistener
tagged with: java
accepted answer: http://stackoverflow.com/a/24524897
upvote count: 1
tagged with: swing
has body: Here,is something I wanted to show for the use of MouseEvents of one class in another ...by creating an object of the former class... import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.lang.*; public class MyPagalpanti extends JPanel implements MouseListener {Point a,b; boolean drawLin,drawOvl,drawOvl2; MyPagalpanti(){a=new Point(0,0);b=new Point(0,0);drawLin=false;drawOvl=false,drawOvl2=false;;setSize(300,300);addMouseListener(this);} public void mouseClicked(MouseEvent m) {if(!drawOvl){a=new Point(m.getX(),m.getY());drawOvl=true;drawOvl2=false;} else {b=new Point(m.getX(),m.getY());drawOvl=true;drawOvl2=true;repaint();}//record("clicked",m);} } public void mouseEntered(MouseEvent m) { } public void mousePressed(MouseEvent m) {a=new Point(m.getX(),m.getY());repaint();} public void mouseReleased(MouseEvent m) {b=new Point(m.getX(),m.getY());} public void mouseExited(MouseEvent m) {} public void paintComponent(Graphics g) {if(drawLin){g.setColor(Color.yellow);g.drawLine((int)a.getX(),(int)a.getY(),(int)b.getX(),(int)b.getY());}//d=0;} else if(drawOvl&amp;&amp;drawOvl2){g.setColor(Color.red);int width=(int)Math.abs(b.getX()-a.getX()); int h=(int)Math.abs(b.getY()-a.getY()); g.drawOval((int)a.getX(),(int)a.getY(),width,h); }} } the class in which an object of MyPagalpanti is formed: import java.awt.*; import javax.swing.*; import java.awt.event.*; //import java.swing.JPanel.*; public class Mithu extends JFrame// implements MouseListener {JTextArea jta1,jta2; Mithu(String title) { super(title); MyPagalpanti p1=new MyPagalpanti(); jta1=new JTextArea(); jta2=new JTextArea(); p1.setOpaque(true); jta1.setEditable(false); jta2.setEditable(false); setForeground(Color.blue); p1.setPreferredSize(new Dimension(600,600)); p1.setLayout(new GridLayout(3,1,0,0)); getContentPane().add(p1); pack(); setVisible(true); } void record(String s,MouseEvent e) {jta1.setText(jta1.getText()+"\n"+s+""+e.toString());} public void mouseClicked(MouseEvent m) {record("clic…
linked to: http://stackoverflow.com/q/11376252
has comment: http://stackoverflow.com/comment/37973343
type: Question
tagged with: jtextarea
linked to: http://stackoverflow.com/q/11369171
has comment: http://stackoverflow.com/comment/37973668
has answer: http://stackoverflow.com/a/24524782
linked to: http://stackoverflow.com/q/7229226
answer count: 3

http://stackoverflow.com/q/24438906
type: Question
has answer: http://stackoverflow.com/a/24444171
downvote count: 0
answer count: 1
tagged with: jms
favorite count: 0
type: UnansweredQuestion
has body: I'm new to JMS and would appreciate your help. Everything I read about JMS gives me the impression that the object that "holds a transaction" is a session object, meaning that when we "session.commit()", everything that has happened since last commit is settled. My question regards, how to handle the patter where I want to "transact messages", not the session. Imagine that you want to receive a large number of trades in a very concurrent scenario, and upon receiving any individual message and processing you'd like to "message.commit()". How can we implement this scenario ? Would I have to keep creating QueueSessions for every message that I wanted to dequeue ? Isn't there too much overhead ? Thanks in advance
has title: JMS and "transactional messages"
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38311583
type: QuestionComment
has text: @Rogério I'm afraid I can't see that - Amazon must have made it available in your area but not mine. However, I did mention in my last comment that there are a small number of cases where it's necessary to stub and verify. The thing is that this is very rare - a kind of last resort, and certainly well worth having to code explicitly. So I really wouldn't expect the Mockito team ever to provide a feature that will "stub and verify" in a single method call; which is what the OP is looking for.
score: 0
comment on: http://stackoverflow.com/q/24527391
type: Comment

http://stackoverflow.com/a/24522580
has comment: http://stackoverflow.com/comment/37990236
type: AcceptedAnswer
has body: Fragments, they are a way to define parts of the user interface. They are similar to activities, they have their own lifecycle. They are also closely tied to the life cycle of their parent activity. You can add them statically by declaring them in your xml manifest and in your layout file -or- you can add them dynamically in runtime by creating them as java objects and xml layout files and then add them using the FragmentManager class. check out the Documentation on the android developer website https://developer.android.com/guide/components/fragments.html also, check out some tutorials on youtube, I like these ones especially: https://www.youtube.com/watch?v=6GyGtCMoR_U&amp;list=PLonJJ3BVjZW4lMlpHgL7UNQSGMERcDzHo Good Luck!
type: Answer
accepted answer of: http://stackoverflow.com/q/24522049
answers question: http://stackoverflow.com/q/24522049
score: 0

http://stackoverflow.com/comment/38019956
type: QuestionComment
has text: thanks @suninsky we made this change: @ManyToMany(fetch=FetchType.LAZY) @JoinTable(name="profile_has_profile_option_element", catalog="fairtime", joinColumns = { @JoinColumn(name="profile_profile_id", nullable=false, updatable=false) }, inverseJoinColumns = { @JoinColumn(name="profile_option_element_profile_option_element_id", nullable=false, updatable=false), @JoinColumn(name="profile_option_element_profile_option_id", nullable=false, updatable=false)}) This seems to work can you verify this change
score: 0
comment on: http://stackoverflow.com/q/24548613
type: Comment

http://stackoverflow.com/comment/37913638
type: Comment
comment on: http://stackoverflow.com/a/24491123
has text: Yes, I got it working just before you posted again. Will try out your solution too. Thanks for the help
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37820802
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24442237
has text: Have you tried profiling your code to see where it slows down?

bitmapfactory
tags question: http://stackoverflow.com/q/24448599
tag name: bitmapfactory
type: Tag

http://stackoverflow.com/comment/37849074
score: 0
type: AnswerComment
has text: its not just 'proguard' . I installed ADT 23 and CLI ant build type 'debug' broken with 'missing zipalign'... Cannot run program "/usr/local/src/android-sdk-linux/tools/zipalign": error=2, No such file or directory
type: Comment
comment on: http://stackoverflow.com/a/24455640

http://stackoverflow.com/comment/37869538
score: 0
type: QuestionComment
has text: @QueryLars You should add that as the answer.
type: Comment
comment on: http://stackoverflow.com/q/24468339

http://stackoverflow.com/a/24560232
answers question: http://stackoverflow.com/q/24548266
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has body: First of all don't name your object fields with single lower case letter (e.g. sArray). Change names to something different (e.g. strArray). In this way you don't need to guess what getters/setters names should be. Second, the correct syntax for the includeProperties attribute of struts2-json-plugin for arrays is ^array\[\d+\]. So if your fields are strArray and intArray the configuration should be something like that: true ^strArray\[\d+\],^intArray\[\d+\],value
score: 2
accepted answer of: http://stackoverflow.com/q/24548266

http://stackoverflow.com/comment/37963406
has text: What language/tool are you using here?
score: 1
comment on: http://stackoverflow.com/q/24519259
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24579062
score: 1
answers question: http://stackoverflow.com/q/24579020
upvote count: 1
has body: You seem to be missing an else statement. if(s.equals("NO")) //corresponding string { s = "YES"; } else if(s.equals("YES")) //same corresponding string { s = "NO"; } or if you want to shorten things a bit: s = s.equalsIgnoreCase("NO") ? "YES" : "NO";
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37957143
score: 3
has text: please check [The use of multiple JFrames good bad practice](http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice/9554657#9554657) and also to [Layout Managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html) especialy to [Card Layout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html)
comment on: http://stackoverflow.com/q/24515976
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24479116
score: 2
answers question: http://stackoverflow.com/q/24479069
accepted answer of: http://stackoverflow.com/q/24479069
type: AcceptedAnswer
has body: It sounds like you originally just wrote the Product objects to an ObjectOutputStream, rather than a Map&lt;Integer, Product&gt;. If that's the case, you need something like: Map&lt;Integer, Product&gt; products = new TreeMap&lt;&gt;(); try (ObjectInputStream input = new ObjectInputStream(new FileInputStream(file))) { while (true) { Product product = (Product) input.readObject(); products.put(product.getCode(), product); // Or whatever } } catch (EOFException e) { // Just finish? Kinda nasty... } Of course, that will throw an exception when it reaches the end of the stream - you might want to think about how you're going to detect that cleanly rather than just handling the exception.
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/a/24459643
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24459586
upvote count: 1
has body: A database has a lock file explorecalifornia.lck that prevents communication. You should delete lock file and restart the database. This may happens from time to time when you accidentally shutdown the database or system. See the syntax of the command used from the command line to invoke shutdown. There's also an option how to shutdown server in Java.
type: Answer
has comment: http://stackoverflow.com/comment/37853482

http://stackoverflow.com/q/24458961
accepted answer: http://stackoverflow.com/a/24459084
has comment: http://stackoverflow.com/comment/37854062
has title: Can a stream be created from an object that has only exposed the "readNext" portion of an iterator?
upvote count: 7
tagged with: java-8
type: AnsweredQuestion
score: 7
tagged with: java
has body: I trying to read from a csv file, but due to its size, without loading it all into memory first. The library I found for reading csv is opencsv, which works really well, but only exposes two methods: readAll() and readNext() readAll is out, as I don't want it all in memory at the same time, so I'd like to use lazily read from the file via readNext. And ideally, i'd like to wrap up that reading via a stream. The closest I've gotten was giving the readnext method to a Stream.generate construct, Stream csvDataStream = Stream.generate(csvReader::readNext); but this obviously has the massive draw back of throwing an error once the iterator underlying csvReader is exhausted. I don't really want to wrap my entire program in a try/catch block because I'm using the language wrong. Is there a way to create a stream from something that only exposes a next method?
has answer: http://stackoverflow.com/a/24459084
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24459776
has answer: http://stackoverflow.com/a/24459776
favorite count: 0

http://stackoverflow.com/q/24540339
answer count: 0
tagged with: controls
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38003158
has title: If a Group control is made invisible does the Container inside it also becomes invisible?
type: Question
has comment: http://stackoverflow.com/comment/38003178
score: 0
tagged with: swt
has comment: http://stackoverflow.com/comment/38003100
has comment: http://stackoverflow.com/comment/38003885
has body: I have a Group Control which contains a Container control which in turn has Text controls. Initially I have this Group hidden and so all the controls inside is hidden. But when I set the group as visible, none of the controls inside it becomes visible. So i was thinking whether my understanding that if we set a control as invisible all the control will be hidden and vice-versa, is correct? Edit: Group grp= new Group(container, SWT.NONE); grp.setText("XYZ"); grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); Conatiner cnt = new Container(grp, SWT.NONE); cnt.setLayout(new GridLayout(4,true)); cnt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
tagged with: java
has comment: http://stackoverflow.com/comment/38003067
has comment: http://stackoverflow.com/comment/38003940

http://stackoverflow.com/a/24498676
score: 3
upvote count: 3
has body: It's a Java "feature" for letting users know that it is a Java Applet window. http://www.oracle.com/technetwork/articles/javase/appletwarning-135102.html#6u12 The link also shows how to change the positioning of the warning sign. Even my signed applets show this warning sign. I found that my signed applet warning sign disappears if you set the applet to use all-permissions (instead of sandbox). But that's not exactly recommended. To change the applet to use all-permissions, edit the jar's MANIFEST.MF to have the line Permissions: all-permissions instead of sandbox.
accepted answer of: http://stackoverflow.com/q/24498599
answers question: http://stackoverflow.com/q/24498599
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37926098
type: Answer

http://stackoverflow.com/q/24521928
has title: Enum equals() and ==
has answer: http://stackoverflow.com/a/24521950
type: UnansweredQuestion
upvote count: 7
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/24521946
has answer: http://stackoverflow.com/a/24521951
tagged with: java
linked to: http://stackoverflow.com/q/1750435
duplicate of: http://stackoverflow.com/q/1750435
has answer: http://stackoverflow.com/a/24521933
downvote count: 0
score: 7
has body: enum Drill{ ATTENTION("Attention!"), AT_EASE("At Ease"); private String str; private Drill(String str){ this.str = str; } public String toString(){ return str; } } public class EnumExample { public static void main(String[] args) { Drill d1= Drill.valueOf("ATTENTION"); Drill d2= Drill.valueOf("ATTENTION"); **System.out.println(d1.equals(d2));//TRUE System.out.println(d1==d2);//TRUE** System.out.println(Drill.ATTENTION.equals(Drill.valueOf("ATTENTION"))); System.out.println(Drill.ATTENTION.equals(Drill.AT_EASE));//FALSE System.out.println(Drill.ATTENTION==Drill.valueOf("ATTENTION"));//TRUE System.out.println(Drill.ATTENTION==Drill.AT_EASE);//FALSE } } Enum behaviour while using == and equals() seems to be same. According to my knowledge, == just check references. Therefore d1 == d2 should be FALSE. Can anyone explain this behavior why is is TRUE?
has answer: http://stackoverflow.com/a/24521971
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/37973707
type: Comment
has text: So to connect to another server, you need to make a request.
comment on: http://stackoverflow.com/a/24524799
type: AnswerComment
score: 0

http://stackoverflow.com/q/24578726
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38087027
type: Question
tagged with: mongodb
has body: Consider the follow the sample aggregate query to find if a field exists or not: db.coll.aggregate({"$project":{"exists":{ "$cond" : [ {"$eq": ["$fieldName", undefined] } , "true" , "false" ]}}}) This aggregate works as expected in mongo shell. But using null in the place of undefined didn't work in mongo shell(why?), as below: db.coll.aggregate({"$project":{"exists":{ "$cond" : [ {"$eq": ["$fieldName", null] } , "true" , "false" ]}}}) I want to use this operation through java driver. But I dont know how to convert this to java driver as it doesn't have undefined. Using null in the place of undefined didn't work in java too.. Why is it designed this way?
has title: MongoDB, How to give 'undefined' in java driver? (null didn't work)
downvote count: 0
has comment: http://stackoverflow.com/comment/38076180
favorite count: 0
type: UnansweredQuestion
tagged with: aggregation-framework
score: 3
answer count: 0
has comment: http://stackoverflow.com/comment/38083045

http://stackoverflow.com/q/24468497
type: Question
has body: I'm new at Android...I was looking at source code of popular open source android apps like android mail,calendar... and noticed that in each class,service,file... always passing the Context parameter and the class initialise it to his local instance of Context, it almost appears in every class, many times. My question is why those classes are need to get it as a parameter of their constructor or method while they can get it alone with those methods? 1. getApplicationContext() 2. getContext() 3. getBaseContext() They can set it in the start and use it...why so many methods in one class getting it? do they get other Context then those that they can get using on of the 3 methods above? For example, I saw the Service is a subclass of a Context class, so he can basically use this keyword and not wait for it from the caller.
linked to: http://stackoverflow.com/q/7298731
score: 0
tagged with: android-context
type: UnansweredQuestion
tagged with: android
has title: Why passing Context every time when it's possible to get it using different methods
has comment: http://stackoverflow.com/comment/37869270
has comment: http://stackoverflow.com/comment/37869324
answer count: 0
has comment: http://stackoverflow.com/comment/37869194
has comment: http://stackoverflow.com/comment/37869391
has comment: http://stackoverflow.com/comment/37871082
has comment: http://stackoverflow.com/comment/37873025
tagged with: java

http://stackoverflow.com/q/24492365
type: Question
tagged with: testing
score: 0
answer count: 1
tagged with: junit
has body: Below is DBMetaData class dependent on TableData : import javax.sql.DataSource; import java.util.HashMap; import java.util.Map; public class DBMetaData { private DataSource dataSource; private Map&lt;String, TableData&gt; tables; private static final String[] TYPES = {"TABLE", "VIEW"}; public DBMetaData(DataSource dataSource) { this.dataSource = dataSource; this.tables = new HashMap&lt;String, TableData&gt;(); } ....... } public class TableData { private String name; private Map&lt;String, ColumnData&gt; columns = new HashMap&lt;String, ColumnData&gt;(); private String catalog; private String schema; TableData(ResultSet rs, DatabaseMetaData meta) throws SQLException { catalog = rs.getString("TABLE_CAT"); schema = rs.getString("TABLE_SCHEM"); name = rs.getString("TABLE_NAME"); initColumns(meta); } ....... } How to write test case of these class as both of them is not having a parameter-less Constructor. As per my understanding : Either I have to write a parameter-less constructor,or Test by using Reflection. I am not able to understand what should i use from the above two approach. Which one is better architecturally and as per oops Concept ? Is there any other possibility than above two ? Is there any reference or resource to write test cases by refactoring such type of codes ?
has comment: http://stackoverflow.com/comment/37914477
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37914300
has comment: http://stackoverflow.com/comment/37914584
tagged with: unit-testing
has answer: http://stackoverflow.com/a/24495644
has title: Correct Approach for Testing class having no default contructor?
has comment: http://stackoverflow.com/comment/37914490
tagged with: refactoring
tagged with: java

http://stackoverflow.com/a/24579574
has comment: http://stackoverflow.com/comment/38076541
answers question: http://stackoverflow.com/q/24579492
score: 4
has comment: http://stackoverflow.com/comment/38076782
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/38077753
type: Answer
has body: As the comment already says, DefaultTableModel#setRowCount is the way to go. private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { int confirm = JOptionPane.showConfirmDialog(null, "clear ?", "end session", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.YES_OPTION) { ((DefaultTableModel) Main_Menu.jTable3.getModel()).setRowCount(0); } }

http://stackoverflow.com/comment/37923249
type: Comment
comment on: http://stackoverflow.com/a/24496443
score: 0
type: AnswerComment
has text: I didn't find anything yet but could I get back to you later? I am going to learn how to use KHRdebug and then try it since my card supports it.

http://stackoverflow.com/comment/37979898
has text: @user3607296 http://www.tutorialspoint.com/sqlite/sqlite_order_by.htm
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24528204
score: 1

http://stackoverflow.com/q/24576945
has comment: http://stackoverflow.com/comment/38070942
type: Question
has body: I have a generic component (a simple java package). I convert it into a jar and give it to my clients. My client can use this jar for any of his applications. Will it be possible to identify who calls my component. That's in my component, will I be able to identify who created an instance of me? Sorry, If I put this is a vague manner. Given a object I could find the className associated to it using(getClass()) . But I am not sure, if my requirement is ever possible.
has answer: http://stackoverflow.com/a/24576988
has comment: http://stackoverflow.com/comment/38070885
upvote count: 2
answer count: 2
tagged with: javabeans
linked to: http://stackoverflow.com/q/1069066
has answer: http://stackoverflow.com/a/24576979
favorite count: 0
accepted answer: http://stackoverflow.com/a/24576979
has comment: http://stackoverflow.com/comment/38070967
has comment: http://stackoverflow.com/comment/38071040
possible better answer: http://stackoverflow.com/a/24576988
has title: Find which class created me
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38070915

http://stackoverflow.com/q/24475851
favorite count: 0
has comment: http://stackoverflow.com/comment/37911141
type: Question
tagged with: android
has body: I found a strange behavior of Calendar class in Android. When I need to sort some list of events by time, I construct a Comparator like this: @Override public int compare(Event lhs, Event rhs) { return lhs.getUserTime().compareTo(rhs.getUserTime()); } where getUserTime is a Calendar instance. The strange thing is that this method always returns 0 even if Dates wrapped in Calendars are explicitly different. Extracting Dates from Calendars solves the problem: @Override public int compare(Event lhs, Event rhs) { return lhs.getUserTime().getTime().compareTo(rhs.getUserTime().getTime()); } But I don't understand where the problem comes from in the first place.
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37883203
has title: Android Calendar.compareTo returns 0 for different times
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37883101
answer count: 0
downvote count: 0
score: 1

http://stackoverflow.com/comment/38033849
type: Comment
comment on: http://stackoverflow.com/a/24542150
has text: As a side note: Eclipse Lunar, with full Java 8 support was released last week.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24520842
tagged with: intellij-idea
downvote count: 0
score: 10
tagged with: tomcat
has answer: http://stackoverflow.com/a/25581440
answer count: 3
tagged with: classnotfoundexception
has title: IntelliJ 13 Tomcat Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
favorite count: 0
possible better answer: http://stackoverflow.com/a/26884382
has answer: http://stackoverflow.com/a/36861092
has answer: http://stackoverflow.com/a/26884382
has body: I'm attempting to run a Java/Spring/Hibernate/Ivy application using IntelliJ 13 and its built in Tomcat deployment plugin. I'm using Tomcat 8.0.9, but I've also attempted this using Tomcat 6.0.39. I'm creating an artifact when I attempt to spin up Tomcat; a exploded war to be more specific. I'm using Ivy to resolve my dependencies and this is because it's a legacy app that doesn't use Maven. Stupid, I know. When attempting to run this application from inside of IntelliJ using any version of Tomcat I recieve the following messages in my 'Server' log: C:\dev\apache-tomcat-6.0.39\apache-tomcat-6.0.39\bin\catalina.bat run [2014-07-01 05:33:09,056] Artifact Kiosk:war exploded: Server is not connected. Deploy is not available. Using CATALINA_BASE: "C:\Users\{username}\.IntelliJIdea13\system\tomcat\Unnamed_Kiosk_4" Using CATALINA_HOME: "C:\dev\apache-tomcat-6.0.39\apache-tomcat-6.0.39" Using CATALINA_TMPDIR: "C:\dev\apache-tomcat-6.0.39\apache-tomcat-6.0.39\temp" Using JRE_HOME: "C:\apps\Java\jdk1.7.0_51" Using CLASSPATH: "C:\dev\apache-tomcat-6.0.39\apache-tomcat-6.0.39\bin\bootstrap.jar" Connected to the target VM, address: '127.0.0.1:57131', transport: 'socket' Jul 01, 2014 5:33:09 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\apps\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\Java\jdk1.7.0_51\bin;C:\Apps\TortoiseSVN\bin;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\dev\apache-tomcat-6.0.39\apache-tomcat-6.0.39;C:\dev\apache-maven-3.2.1-bin\apache-maven-3.2.1\bin;C:\dev\SlikSvn\bin;.;;.;;. Jul 01, 2014 5:33:09 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Jul 01, 2014 …
accepted answer: http://stackoverflow.com/a/25581440
type: AnsweredQuestion
tagged with: java
upvote count: 10
tagged with: classpath
type: Question

http://stackoverflow.com/q/24444639
answer count: 3
tagged with: android
has body: I'm trying to launch a test app with Eclipse on Android Wear, but when i create a new projet, a part of Android Wear is not here. I get messages like : WatchActivity cannot be resolved to a type (java file) error: No resource identifier found for attribute 'roundLayout' in package (xml file) error: No resource identifier found for attribute 'rectLayout' in package (xml file) I've installed all SDK, and update to ADT 23.
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24457606
has answer: http://stackoverflow.com/a/24759357
tagged with: wear-os
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24759357
possible better answer: http://stackoverflow.com/a/24457606
tagged with: java
has answer: http://stackoverflow.com/a/24494763
tagged with: eclipse
type: Question
downvote count: 0
has title: i can't test the android wear sdk
has comment: http://stackoverflow.com/comment/37827909

http://stackoverflow.com/comment/80961243
type: AnswerComment
comment on: http://stackoverflow.com/a/33662173
type: Comment
has text: IIRC we were using the Oracle JDK, so OpenJDK's implementation might be different
score: 0

http://stackoverflow.com/a/24559104
type: Answer
has comment: http://stackoverflow.com/comment/38037797
downvote count: 0
has comment: http://stackoverflow.com/comment/38038165
has comment: http://stackoverflow.com/comment/38037754
score: 2
answers question: http://stackoverflow.com/q/24559066
upvote count: 2
has comment: http://stackoverflow.com/comment/38038048
has body: You just have to add a print statement (ie. System.out.println("Good");) after your loop. *NOTE: I changed the class name from date to Date, which is proper Java convention for naming a Class. Please change your file from date.java to Date.java when you use this code (if you copy and paste it, that is) to prevent compilation issues. Class name and filename must match up, case-sensitive), in Java if I recall correctly. import java.util.Scanner; public class Date{ public static void main (String args []){ int x; Scanner in = new Scanner (System.in); System.out.print("Enter a date "); x = in.nextInt(); while (x &lt; 1520 || x &gt; 3999) { System.out.println ("Invalid Gregorian Calendar date."); System.out.print ("Please Input a valid Gregorian Calendar date: "); x = in.nextInt(); } System.out.println("Good"); } }

timepicker
tags question: http://stackoverflow.com/q/24498569
type: Tag
tag name: timepicker

http://stackoverflow.com/a/24516577
score: 2
upvote count: 2
has body: TCP/IP does not drop the packet. The congestion control algorithms inside the TCP implementation take care of retransmission. Assuming that there is a steady stream of data being sent, the receiver will acknowledge which sequence numbers it received back to the sender. The sender can use the acknowledgements to infer which packets need to be resent. The sender holds packets until they have been acknowledged. As an application, unless the TCP implementation provides mechanisms to receive notification of congestion, the best it can do is establish a timeout for when the transaction can complete. If the timeout occurs before the transaction completes, the application can declare the network to be too congested for the application to succeed.
answers question: http://stackoverflow.com/q/24516418
downvote count: 0
type: Answer

http://stackoverflow.com/a/24447090
type: Answer
has comment: http://stackoverflow.com/comment/37897780
upvote count: 1
downvote count: 1
has body: The message is quite clear: There is somewhere an union object where no value is set. Exactly one value must be set for Thrift unions. Thrift union example, see your *.thrift file: union Foo { 1: string bar 2: bool baz } This is the condition that raised the error: public void write(TProtocol oprot, TUnion struct) throws TException { if (struct.getSetField() == null || struct.getFieldValue() == null) { throw new TProtocolException("Cannot write a TUnion with no set value!"); } // ... more code ... } Can't tell what object it is from your given code, you are too deep in the stack. Look at the code that calls writeObject(), then walk upwards. At some place in your code some data are not set as they should, or the value is set to a null value - which is illegal with Thrift. If you do need an indicator for null values fopr your use case, consider an extra boolean flag.
has comment: http://stackoverflow.com/comment/37830641
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38278709
accepted answer of: http://stackoverflow.com/q/24445671
has comment: http://stackoverflow.com/comment/37897760
has comment: http://stackoverflow.com/comment/38255299
answers question: http://stackoverflow.com/q/24445671

http://stackoverflow.com/a/53998243
answers question: http://stackoverflow.com/q/24449562
type: Answer
has body: So you want to call your readFile(file) method for every file in your directory. You can use the File.listFiles() method to get the list of files in a directory: File f = new File("your/directory"); File[] files = f.listFiles(); Then you can loop through the files (continuing previous example): for (File file : files) { System.out.println(readFile(file.toString())); } By the way, you should use a StringBuilder to append the strings so you won't have to make a new object every time a new line is read.
score: 0

http://stackoverflow.com/a/24486131
has comment: http://stackoverflow.com/comment/37972474
score: 0
has comment: http://stackoverflow.com/comment/37924471
type: Answer
has comment: http://stackoverflow.com/comment/37906284
has comment: http://stackoverflow.com/comment/37964592
has comment: http://stackoverflow.com/comment/37935065
answers question: http://stackoverflow.com/q/24485178
has body: Try giving fully qualified name for android:name, android:name The name of the class that implements the activity, a subclass of Activity. The attribute value should be a fully qualified class name (such as, "com.example.project.ExtracurricularActivity"). However, as a shorthand, if the first character of the name is a period (for example, ".ExtracurricularActivity"), it is appended to the package name specified in the element. Once you publish your application, you should not change this name (unless you've set android:exported="false"). There is no default. The name must be specified. More at Android Developer Docs. Also consider to read the 7 things you should know about Android Manifest xml file.
has comment: http://stackoverflow.com/comment/37974959

http://stackoverflow.com/comment/37829966
comment on: http://stackoverflow.com/q/24447233
has text: @ElliottFrisch See https://gist.github.com/jeffbrown/bebdb7f2282667fd1eca
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24446792
downvote count: 0
answer count: 1
tagged with: action
has title: h:commandButton not invoked when nested into own component extending UIData
favorite count: 0
has body: I have seen the answer by BalusC and the solution with changing the scope, but I tried it and I think there is yet another problem that seems not really solvable using JSF2. I have created a custom component that extends UIData. This custom component displays a table with rows of the data, it is called PagingDataTable. It cotains PagingDataColumns that can then be clicked and the sort ordering is changed etc... This works fine, but as soon as I add a h:CommandButton inside a PagingDataColum, the action of the button is not invoked. Let me explain this: It works when using a nested f:ajax element But it does not work when just defining an action in the h:CommandButton without nesting In this special case I don't want to use Ajax for it. I debugged it and I found out a mismatch in the Mojarra implementation of the ButtonRenderer class (method wasClicked). Inside this method, it is checked whether the button was clicked, and this check is done according to the ID (actually the name, but this is the ID). But UIData components have two different IDs: ID with rowIndex when the rowIndex exists, e.g. while rendering ID without rowIndex when the rowIndex does not exist, e.g. when the user clicks the button So the wasClicked() tries to find the ID without rowIndex in the parameter map, to no avail, and because of this, the action method is not invoked. IMHO this is a bug in the ButtonRenderer.wasClicked() method, which would need to have additional logic to be able to understand that an ID without rowId is not an exact match in the parameter map with an ID with rowId. Did I miss anything here? IMHO this has nothing to do with the scope of the underlying data, because the rowId is not there in any case, independent of the scope. But I tried it with SessionScoped, and the same thing is happening. I also download version 2.1.28 of Mojarra: the same thing is happening. Mojarra 2.2.X seems not work easily with my Glasssfish server version, so I could not try it with the newest ver…
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jsf-2
tagged with: commandbutton
has answer: http://stackoverflow.com/a/24452153

http://stackoverflow.com/q/24587822
has answer: http://stackoverflow.com/a/24587849
score: 0
tagged with: java
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/24587891
tagged with: thread-safety
has body: I have an ArrayList which I add items to, within a broadcastreceiver callback. However the arraylist will eventually be attached to an adapter and then I wish to display the contents of the array to the screen. The array contains peer information from a P2P app I'm working on so it will be subject to change frequently as devices drop in and out of connection/range. So basically the arraylist will be read and written to frequently. I come from a c++ background so I would normally use a lock to protect my arraylist, when accessing it, but I'm unsure what I should use in java/android. Any Advice please.
answer count: 3
has title: In Android when should I use a lock and when should I use synchronized? Is there a difference?
has answer: http://stackoverflow.com/a/24587889
tagged with: locks
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/5784119
has comment: http://stackoverflow.com/comment/38092046

http://stackoverflow.com/q/24475618
has title: synchronized method for an object containing other objects
tagged with: synchronized
has body: If I write a class that "extends Thread" and for each object instance for that class there is object variable of another class. for example: public class MyClass extends Thread{ private int num; private MyClass2 obj; public MyClass(int num, MyClass2 obj){ this.num = num; this.obj = obj; } inside that class I write synchronized method that uses method of MyClass2. for example: public synchronized int doSomething(){ obj.someMethod(); } My questions are: 1)when I call method in class MyClass2 from the synchronized method, it will still be synchronized and atomic, or that when it goes out for other not synchronized method it will continue with others threads? 2)If it will stop being synchronized... and I want it to be synchronized, do I need to make "someMethod" in class "MyClass2" also be synchronized? 3)If I declare two different objects of class "MyClass" but both of them have the same "MyClass2" object, they will be synchronized if invoking the doSomething method or not?
has answer: http://stackoverflow.com/a/24475660
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24477837

http://stackoverflow.com/a/26701352
has comment: http://stackoverflow.com/comment/55927834
has comment: http://stackoverflow.com/comment/65101378
score: 73
upvote count: 76
has comment: http://stackoverflow.com/comment/51115663
has comment: http://stackoverflow.com/comment/53053870
has comment: http://stackoverflow.com/comment/65065084
has comment: http://stackoverflow.com/comment/51803318
answers question: http://stackoverflow.com/q/24471109
has comment: http://stackoverflow.com/comment/51114666
has comment: http://stackoverflow.com/comment/65101204
has comment: http://stackoverflow.com/comment/78320740
type: Answer
has body: This is what worked for me. Attach the OnClickListener to the onBindView. I don't really know if this will impact the performance, but it seems to work fine with little code. public void onBindViewHolder(ViewHolder holder, final int position) { holder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(context, "Recycle Click" + position, Toast.LENGTH_SHORT).show(); } }); }
has comment: http://stackoverflow.com/comment/61218592
downvote count: 3

http://stackoverflow.com/q/24532424
tagged with: android
has answer: http://stackoverflow.com/a/24548138
accepted answer: http://stackoverflow.com/a/24548138
has comment: http://stackoverflow.com/comment/37990285
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/2955458
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/70984030
has comment: http://stackoverflow.com/comment/38015276
has body: I use the Android JavaMail-API to send E-Mails. Everything works as intended, but right now I'm testing some things when I have a bad internet connection. I do this by disabling WIFI and then click on the Send E-mail Button. In my SendMail-method I have the following: try{ if(javaMailAPI.send()){ // Do something on success } else{ // Do something on fail } } catch(UnknownHostException ex){ // Do something when I have no Internet Connection } catch(Exception ex){ // Do something else when I have an other Exception } So, when I test this above when I have my WIFI disconnected, this is what I expect: UnknownHostException is catched because we have no Internet Connection, code inside that catch is used. What is the result instead: Exception is catched with the following error Stacktrace: 07-02 15:00:47.699: W/System.err(6680): javax.mail.MessagingException: Unknown SMTP host: smtp.gmail.com; 07-02 15:00:47.699: W/System.err(6680): nested exception is: 07-02 15:00:47.699: W/System.err(6680): java.net.UnknownHostException: Host is unresolved: smtp.gmail.com 07-02 15:00:47.699: W/System.err(6680): at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1389) 07-02 15:00:47.709: W/System.err(6680): at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412) 07-02 15:00:47.709: W/System.err(6680): at javax.mail.Service.connect(Service.java:310) 07-02 15:00:47.709: W/System.err(6680): at javax.mail.Service.connect(Service.java:169) 07-02 15:00:47.709: W/System.err(6680): at javax.mail.Service.connect(Service.java:118) 07-02 15:00:47.709: W/System.err(6680): at javax.mail.Transport.send0(Transport.java:188) 07-02 15:00:47.709: W/System.err(6680): at javax.mail.Transport.send(Transport.java:118) 07-02 15:00:47.719: W/System.err(6680): at external_software.JavaMailAPI.send(JavaMailAPI.java:118) 07-02 15:00:47.719: W/System.err(6680): at controllers.EMailSender.SendEmails(EMailSender.java:58) 07-02 15:00:47.719: W/System.err(6680): at activities.ChecklistR…
tagged with: jakarta-mail
upvote count: 1
answer count: 1
tagged with: nested
has title: Android JavaMail API - Want to catch UnknownHostException
favorite count: 0
tagged with: exception

http://stackoverflow.com/comment/55540217
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26826692
score: 0
has text: I figured out the view is a topmost `Layout` for a `list_item.xml`. How can I know on which exactly `view` a click was?

http://stackoverflow.com/comment/37799959
comment on: http://stackoverflow.com/a/24431031
score: 0
type: Comment
has text: receivePaymentArray.get(paramInt).get(Const.TAG_PAYEE_ID) looks like an array of arrays? can you show us your arrayList data model?
type: AnswerComment

http://stackoverflow.com/q/24430304
tagged with: mapsforge
score: 2
tagged with: java
type: Question
has body: How do I change my circle overlay to an image instead? Here's my code MainActivity extends MapActivity code for Circle Overlay: ListOverlay listOverlay = new ListOverlay(); List&lt;OverlayItem&gt; overlayItems = listOverlay.getOverlayItems(); Cursor campgroundList = campgroundDB.getCampgrounds(); if(campgroundList != null) { while(campgroundList.moveToNext()) { GeoPoint campgroundLocation = new GeoPoint(campgroundList.getDouble(campgroundList.getColumnIndex("latitude")),campgroundList.getDouble(campgroundList.getColumnIndex("longitude"))); //if(shouldShowCampground(campgroundLocation)) { Circle circle = showCampground(campgroundLocation); //overlayItems.setMarker(defaultMarker); overlayItems.add(circle); //} } } mapView.getOverlays().add(listOverlay); private static Circle showCampground(GeoPoint location) { Paint paintFill = new Paint(Paint.ANTI_ALIAS_FLAG); paintFill.setStyle(Paint.Style.FILL); paintFill.setColor(Color.MAGENTA); paintFill.setAlpha(64); Paint paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); paintStroke.setStyle(Paint.Style.STROKE); paintStroke.setColor(Color.MAGENTA); paintStroke.setAlpha(128); paintStroke.setStrokeWidth(3); return new Circle(location, 200, paintFill, paintStroke); }
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
upvote count: 2
has title: Mapsforge image overlay android
type: UnansweredQuestion

http://stackoverflow.com/a/24523176
has body: So the basic idea is to simply flip/mirror the Graphics context by scaling one of the axis by a negative value (-1). This can be accomplished by simply using Graphics#scale, for example, to flip the graphics horizontally, you would simply use graphics.scale(-1, 1); You would need to translate the Graphics by the width of the viewable area as well using Graphics#translate to reposition the image within the viewable area. Everything painted after this will be affected by the change. Because of this, you should be taking snapshots of the Graphics context before every significant change, just make sure you dispose of it when you're done... Here is a (rather pathetic animation wise) example...Basically, when you press the left or right arrows, a flag is flipped and the scene repainted. Depending on the flag, the Graphics context is flipped/mirrored... import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class AnimateCharacter { public static void main(String[] args) { new AnimateCharacter(); } public AnimateCharacter() { 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.setDefaultCloseOperat…
type: Answer
answers question: http://stackoverflow.com/q/24522458
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/a/31490598
upvote count: 1
answers question: http://stackoverflow.com/q/24471109
type: Answer
downvote count: 0
score: 1
has body: Here is my code snippet: v.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int newPosition = MainActivity.mRecyclerView.getChildAdapterPosition(v); Intent cardViewIntent = new Intent(c, MainActivityCards.class); cardViewIntent.putExtra("Position", newPosition); c.startActivity(cardViewIntent); } }); v is View from onCreateViewHolder c is Context

http://stackoverflow.com/comment/37832255
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24444757
has text: @user274910 try this again! copy and paste it

http://stackoverflow.com/a/24446515
score: 0
has body: This is your browser behaving according to the spec, not Liferay-related at all: If you look at the Action URL, it contains a questionmark and some parameters. Upon sending the form, they will be eliminated, replaced by the parameters in your input fields. Instead of going through the reasoning and linking the spec, find several answers and explanations within this related stackoverflow question There are also workarounds based on javascript. However, as processAction might actually change your state, it's a good idea to have it on POST actions typically. But now that you know the reason, you should be able to work around.
answers question: http://stackoverflow.com/q/24439697
type: Answer

http://stackoverflow.com/comment/38073367
score: 0
type: QuestionComment
type: Comment
has text: And also what is your question? The title mentions the name of unsupported algorithm, the body provides the list of supported algorithm and the one in the title is not among them. And then you ask something inconsistent about not wanting to provide a JRE with the application.
comment on: http://stackoverflow.com/q/24578141

http://stackoverflow.com/comment/38011229
type: AnswerComment
has text: Thanks for the help. I have modified my code as per solution on your blog but I am still getting the same error. modified code is: `QName qName = new QName("http://www.w3.org/2001/XMLSchema", obj.toString());` `JAXBElement<T> e = createJAXBElement(qName, obj.getClass(), obj);` `jc = JAXBContext.newInstance(e.getValue().getClass());` `Marshaller m = jc.createMarshaller();` `source = new JAXBSource(jc, m.getClass());` `Schema schema = schemaInjector.getSchema();` `Validator validator = schema.newValidator();` `validator.validate(source);` _Please advice_
type: Comment
comment on: http://stackoverflow.com/a/24520105
score: 1

http://stackoverflow.com/comment/37832032
score: 0
comment on: http://stackoverflow.com/q/24447897
type: QuestionComment
type: Comment
has text: But did you check the *type* of the `Throwable`? It could be a subclass of a JRE class which is allowed to be loaded by a different `ClassLoader`. Or, check the entire hierarchy like `for(Class<?> c=throwable.getClass(); c!=null; c=c.getSuperclass()) System.out.println(c+" loaded by "+c.getClassLoader());`. Maybe it sheds some light on it.

http://stackoverflow.com/comment/38029209
comment on: http://stackoverflow.com/a/24547212
score: 0
type: AnswerComment
has text: Thanks for your answer. I found your answer really helpful. What if I have another screen that use the same background as this? Do i need a seperate Factory or just stick with one factory. For example I have MenuObjectFactory that produce the above actors and I have another factory "OptionObjectFactory" that produce the same ground, sky and some distinct actor such as volumeSlider?
type: Comment

http://stackoverflow.com/comment/37916096
type: AnswerComment
type: Comment
has text: WOW that works but when I want to run another command it throws an IOException because the stream is closed. Do you know how to fix this?
comment on: http://stackoverflow.com/a/24491299
score: 0

http://stackoverflow.com/q/24508300
type: Question
upvote count: 0
has body: while getting values in the form the bindFromRequest().get() it returns only null value.I got all the String type is null and integr as zer0. Here is my code for controller and model packages and how I can resolve this error: enter code here In controller: public static Result getShow(){ Register register=Form.form(Register.class).bindFromRequest().get(); register.save(); System.out.println(register); return ok("@Required annotation kicked in.."+register); } In Models: package models; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="register") public class Register { //private static final long serialVersionUID = 1L; private String firstname; private String lastname; @Id private String displayname; private String date; private String email; private String password; private String confirm_password; private String gender; private int phone_no; private String address; private int zipcode; public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String getDisplayname() { return displayname; } public void setDisplayname(String displayname) { this.displayname = displayname; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getConfirm_password() { return confirm_password; } public void setConfirm_password(String confirm_password) { this.confirm_password = confirm_password; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public int getPhone_no() { return phone_no; } public void…
tagged with: playframework
has title: while getting values in the form it returns null value
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24508474
score: -3
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/38029009
comment on: http://stackoverflow.com/q/24553785
has text: Have you made sure to publish your views to production setting? Couchbase defaults to production mode so will look there for the views and not in the development section.
score: 0
type: Comment
type: QuestionComment

size
type: Tag
tags question: http://stackoverflow.com/q/24583305
tag name: size
tags question: http://stackoverflow.com/q/24516641
tags question: http://stackoverflow.com/q/24542664

http://stackoverflow.com/a/24464369
upvote count: 1
answers question: http://stackoverflow.com/q/24463140
has comment: http://stackoverflow.com/comment/37868800
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37869556
has body: Specifying the charset did not fix the issue for me. This post is comment-like as I have not fully discovered the issue, but I am making an attempt at explaining the why portion of the question with what I have found thus far. I found another post with the same problem as a secondary resource. In both cases, the first line of the files ends with ASCII character 13 carriage return which I would have thought should be picked up by the Scanner as a line separator. As a sanity check, I performed a BufferedReader readLine() and it works fine. Digging deeper, I cloned the source of Scanner and wound up on readInput line 849 : n = source.read(buf);. After determining the type of source was sun.nio.cs.StreamDecoder, I cloned the class and investigated readImpl. In both cases, line 324 int n = readBytes(); reads the entire file into the buffer hitting the continue and coming back around to line 316 CoderResult cr = decoder.decode(bb, cb, eof); At this point cr is wrapping a MalformedInputException which gets consumed by Scanner catch (IOException ioe). Since I was able to reproduce this issue in my cloned source, I printed the stacktrace: java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:281) at javaapplication1.StreamDecoder.implRead(StreamDecoder.java:349) at javaapplication1.StreamDecoder.read(StreamDecoder.java:188) at java.io.Reader.read(Reader.java:100) at javaapplication1.MyScanner.readInput(MyScanner.java:844) at javaapplication1.MyScanner.findWithinHorizon(MyScanner.java:1789) at javaapplication1.MyScanner.nextLine(MyScanner.java:1629) The decoder at runtime is sun.nio.cs.UTF_8. I've stopped digging at this point as it is way into the AM hours, I may edit in further findings. The main question now is why the final single character of input kills the decoder.

http://stackoverflow.com/a/24503208
type: Answer
has body: Your code is almost correct. Just keep in mind that String.charAt() returns a char not an int. Because of that, you should check for 'number' instead. Thus, 8 becomes '8' and 9 becomes '9'.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24503053
score: 0
accepted answer of: http://stackoverflow.com/q/24503053

http://stackoverflow.com/comment/37909257
type: Comment
has text: In galssfish... we have security-role-mapping , can u please guide how to configure mapping of user roles to groups.....
comment on: http://stackoverflow.com/a/24484258
type: AnswerComment
score: 0

http://stackoverflow.com/q/24467612
type: Question
has comment: http://stackoverflow.com/comment/37875249
accepted answer: http://stackoverflow.com/a/24471491
score: 3
tagged with: javacard
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/37992240
has comment: http://stackoverflow.com/comment/37868060
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24499438
has answer: http://stackoverflow.com/a/24471491
has answer: http://stackoverflow.com/a/24499438
tagged with: ecdsa
type: AnsweredQuestion
upvote count: 3
has title: ECDSA Signature in Javacard
has body: I'm implementing the signing code using ECDSA in Javacard. My code outputs 0x0003(NO_SUCH_ALGORITHM) in exception part which means this card does not support the algorithm. I don't understand that because my vendor told me that it supports ECC. I concluded I don't know how to sign with ECDSA and I want to know that. Here is my full source code package MyECDSA; import javacard.framework.*; import javacard.security.*; import javacardx.crypto.*; public class MyECDSA extends Applet{ private byte[] PLAINTEXT ; private ECPrivateKey objECDSAPriKey=null; // Object for ECDSA Private Key private ECPublicKey objECDSAPubKey=null; // Object for ECDSA Public Key private KeyPair objECDSAKeyPair=null; // Object for ECDSA Key Pair private Signature objECDSASign=null; // Object for ECDSA Signature final static short BAS = 0; public static void install(byte[] bArray, short bOffset, byte bLength){ new MyECDSA(bArray, bOffset, bLength); } private MyECDSA(byte bArray[], short bOffset, byte bLength){ PLAINTEXT = new byte[0x100] ; // Data file Util.arrayFillNonAtomic(PLAINTEXT, BAS, (short)0x100, (byte)0); register(); } //====================================================================================== public void process(APDU apdu){ byte buf[] = apdu.getBuffer(); switch(buf[1]) { //-------------------------------------------------------- case (byte)0xA4: break; case (byte)0x46: // Create ECDSA Keys and Pair try { // &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Here is the problem &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; objECDSAKeyPair = new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_192); //objECDSAKeyPair = new KeyPair(KeyPair.ALG_EC_F2M, KeyBuilder.LENGTH_EC_F2M_193); } catch(CryptoException c) { short reason = c.getReason(); ISOException.throwIt(reason); } ISOException.throwIt((short)0x9999); // for check // Generate Key pair objECDSAKeyPair.genKeyPair(); // Create Signature Object objECDSASign = Signature.getInstance(Signat…
has comment: http://stackoverflow.com/comment/38055430

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24519455
tags question: http://stackoverflow.com/q/24482624
tags question: http://stackoverflow.com/q/24473102
tags question: http://stackoverflow.com/q/24439760
tags question: http://stackoverflow.com/q/24499783
tags question: http://stackoverflow.com/q/24535475
tags question: http://stackoverflow.com/q/24523279
tags question: http://stackoverflow.com/q/24564470
tags question: http://stackoverflow.com/q/24576081
tags question: http://stackoverflow.com/q/24524823
tags question: http://stackoverflow.com/q/24450103
tags question: http://stackoverflow.com/q/24525498
type: Tag
tags question: http://stackoverflow.com/q/24537122
tags question: http://stackoverflow.com/q/24473479
tags question: http://stackoverflow.com/q/24523994
tags question: http://stackoverflow.com/q/24503545
tags question: http://stackoverflow.com/q/24458759
tags question: http://stackoverflow.com/q/24484611
tags question: http://stackoverflow.com/q/24554709
tags question: http://stackoverflow.com/q/24548854
tags question: http://stackoverflow.com/q/24544229
tags question: http://stackoverflow.com/q/24533769
tags question: http://stackoverflow.com/q/24551650
tags question: http://stackoverflow.com/q/24527473
tags question: http://stackoverflow.com/q/24559973
tags question: http://stackoverflow.com/q/24500473
tags question: http://stackoverflow.com/q/24529416
tags question: http://stackoverflow.com/q/24476410
tags question: http://stackoverflow.com/q/24565960
tags question: http://stackoverflow.com/q/24445549
tags question: http://stackoverflow.com/q/24453376
tags question: http://stackoverflow.com/q/24449297
tags question: http://stackoverflow.com/q/24444564
tags question: http://stackoverflow.com/q/24534675
tags question: http://stackoverflow.com/q/24522377
tags question: http://stackoverflow.com/q/24453579
tags question: http://stackoverflow.com/q/24519172
tags question: http://stackoverflow.com/q/24551962
tags question: http://stackoverflow.com/q/24509146
tags question: http://stackoverflow.com/q/24504612
tags question: http://stackoverflow.com/q/24517087
tags question: http://stackoverflow.com/q/24446849
tags question: http://stackoverflow.com/q/24483573
tags question: http://stackoverflow.com/q/24458993
tags question: http://stackoverflow.com/q/24450973
tags question: http://stackoverflow.com/q/24487922
tags question: http://stackoverflow.com/q/24483936
tags question: http://stackoverflow.com/q/24437184
tags question: http://stackoverflow.com/q/24457780
tags question: http://stackoverflow.com/q/24564677
tags question: http://stackoverflow.com/q/24521446
tags question: http://stackoverflow.com/q/24574036
tags question: http://stackoverflow.com/q/24445855
tags question: http://stackoverflow.com/q/24506321
tags question: http://stackoverflow.com/q/24451430
tags question: http://stackoverflow.com/q/24533385
tags question: http://stackoverflow.com/q/24467423
tags question: http://stackoverflow.com/q/24551495
tags question: http://stackoverflow.com/q/24505945
tag name: xml
tags question: http://stackoverflow.com/q/24573282
tags question: http://stackoverflow.com/q/24489242
tags question: http://stackoverflow.com/q/24520991
tags question: http://stackoverflow.com/q/24574778
tags question: http://stackoverflow.com/q/24473308
tags question: http://stackoverflow.com/q/24517327
tags question: http://stackoverflow.com/q/24465706
tags question: http://stackoverflow.com/q/24458873
tags question: http://stackoverflow.com/q/24485012
tags question: http://stackoverflow.com/q/24524060
tags question: http://stackoverflow.com/q/24529829
tags question: http://stackoverflow.com/q/24524331
tags question: http://stackoverflow.com/q/24462668
tags question: http://stackoverflow.com/q/24441096
tags question: http://stackoverflow.com/q/24555996
tags question: http://stackoverflow.com/q/24565020
tags question: http://stackoverflow.com/q/24536375
tags question: http://stackoverflow.com/q/24481101
tags question: http://stackoverflow.com/q/24563731

http://stackoverflow.com/a/29792490
upvote count: 1
answers question: http://stackoverflow.com/q/24529771
score: 1
has body: The data files are no longer supplied as part of the installation. You need to download the WordNet version for your platform and then pass it to the constructor, as documented here.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/38049135
comment on: http://stackoverflow.com/a/24564640
type: AnswerComment
score: 0
type: Comment
has text: It seems it is the case, removed precedence talk.

http://stackoverflow.com/a/24448536
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37831956
score: 2
has body: Because if you use this, then another thread trying to execute another method will have to wait, whereas if you use an object as lock, you only restrict this critical section.
downvote count: 0
answers question: http://stackoverflow.com/q/24448460

http://stackoverflow.com/a/24636380
type: Answer
accepted answer of: http://stackoverflow.com/q/24548106
answers question: http://stackoverflow.com/q/24548106
type: AcceptedAnswer
score: 0
has body: Well actually as I couldn't find anything close to what i've described so I've wrote it myself and published on github https://github.com/vach/valida, I'll publish it on maven central repo as soon as my domain is ready. For now those who might want to try it now : download and extract this to your local repo add dependency to pom.xml com.vach valida 1.0-SNAPSHOT make sure aspectj weaving is enabled

http://stackoverflow.com/comment/38122032
type: AnswerComment
score: 0
type: Comment
has text: thanks for the reply. I had already included required jar. please chceck here https://drive.google.com/file/d/0B1JsFHtBqxS8VnRGdFNaU2RlWkU/edit?usp=sharing , right click and open in new tab.
comment on: http://stackoverflow.com/a/24585413

http://stackoverflow.com/q/24490554
favorite count: 0
has body: Can we have any optimise way to run video.Below mention is my code.This code help in run the youtube video. if (YouTubeIntents.canResolvePlayVideoIntent(activity)){ //Getting ID of YouTube video out of URL List&lt;NameValuePair&gt; params = null; try { params = URLEncodedUtils.parse(new URI(sourceUrl), "UTF-8"); } catch (URISyntaxException e) { e.printStackTrace(); } String videoID = params.get(0).getValue(); Log.v(TAG, "YouTube Video ID:" + videoID); // createPlayVideoIntentWithOptions only works for first // video playback. Update to use stand-alone player api instead. Intent intent = YouTubeStandalonePlayer.createVideoIntent( activity, g.kGoogleAPIKey, videoID, 0, true, false); activity.startActivity(intent); Log.i(TAG, "Video Playing in YouTube App...."); } else { Log.v(TAG, "YouTube generic intent"); activity.startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(sourceUrl))); Log.i(TAG, "Video Playing in whatever user selected...."); }
type: UnansweredQuestion
tagged with: android
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37911231
has answer: http://stackoverflow.com/a/24490903
tagged with: java
has title: Optimise Way to run youtube video on android
score: 0
answer count: 1

http://stackoverflow.com/comment/38034494
score: 0
has text: @user3801896 I extended the answer accordingly
type: Comment
comment on: http://stackoverflow.com/a/24556135
type: AnswerComment

http://stackoverflow.com/comment/37927202
has text: @PiotrKolaczkowski Given that cluster is not serializable, it needs to be instantiated in the lambda as that code will be executed by each worker on a distributed Spark system. The case you mention would only work on local mode. Re: cassandra-spark: You are certainly close to the source. I was in the announcement this morning on the Spark Summit. Will be looking into it ASAP.
comment on: http://stackoverflow.com/a/24471624
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24476680
tagged with: android-studio
score: 2
type: AnsweredQuestion
tagged with: asynchttpclient
tagged with: java
has title: Cannot Resolve Symbol 'execute', android studio 8.0 beta
accepted answer: http://stackoverflow.com/a/24476765
type: Question
has comment: http://stackoverflow.com/comment/37884703
answer count: 1
downvote count: 0
has body: I know many people have issues like mine, but the answers I found didn't seem to work. import android.os.AsyncTask; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; 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 java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; /** * Created by DJ on 6/29/2014. */ public class RetrieveTask extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... values){ String result; try{ ArrayList&lt;NameValuePair&gt; nvp = new ArrayList&lt;NameValuePair&gt;(); HttpClient httpc = new DefaultHttpClient(); HttpPost httpp = new HttpPost("http://" + values[0] + "/AndroidConnection/Select.php"); httpp.setEntity(new UrlEncodedFormEntity(nvp)); HttpResponse httpr = new httpc.execute(httpp); HttpEntity httpe = httpr.getEntity(); InputStream is = httpe.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(is, "iso-8859-1"),8); StringBuilder sb = new StringBuilder(); String line = null; while((line = br.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); } catch(Exception e){ return e.getMessage(); } return result; } } ` As you can see in this code, I used the HttpClient.execute command, but Android studio refers to .execute command as an error: cannot resolve symbol 'execute'. I have already tried Invalidating Cache and restart. I also turned on Maven's auto import check box. OS: win7 32-bit JDK: jdk7(Java EE) Android Studio: 8.0 beta
favorite count: 0
has answer: http://stackoverflow.com/a/24476765
upvote count: 2
tagged with: android
tagged with: maven

http://stackoverflow.com/comment/38055143
type: Comment
has text: -vm and /Library... must also be on separate lines
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24567284

http://stackoverflow.com/comment/37918080
type: AnswerComment
type: Comment
score: 0
has text: I'm absolutely aware that it's bad, really bad thing to do - there is dozen of possibilities why something can go wrong and sending 200 is just not right- but, well, a customer is always right and I can't do nothing about it.
comment on: http://stackoverflow.com/a/24493955

http://stackoverflow.com/comment/102338290
type: AnswerComment
has text: Simple, efficient and without resorting to subclassing - this should be the accepted answer!
type: Comment
comment on: http://stackoverflow.com/a/50210328
score: 1

http://stackoverflow.com/a/24481520
score: 0
has body: PrintWriter swallows exceptions, and you aren't calling checkError() to see if one happened. Try it with a BufferedWriter. You'll have to use something other than printf() of course.
type: Answer
answers question: http://stackoverflow.com/q/24480450

google-plus
tags question: http://stackoverflow.com/q/24455175
tag name: google-plus
type: Tag

http://stackoverflow.com/q/24535526
tagged with: date
accepted answer: http://stackoverflow.com/a/24536049
score: 0
possible better answer: http://stackoverflow.com/a/24537567
linked to: http://stackoverflow.com/q/7702697
has answer: http://stackoverflow.com/a/24536049
has body: So I want to create a subclass of JSpinner so that I can hide all the configuration. The problem is when I put this object on JFrame, I get UI not found error. I can't find out what I missed.. public class Time extends JSpinner { public Time() { super(); SpinnerDateModel SpinnerModel = new SpinnerDateModel(); this.setModel(SpinnerModel); JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(this, "hh:mm a"); this.setEditor(dateEditor); } }
has title: creating a subclass of JSpinner error
has answer: http://stackoverflow.com/a/24537567
tagged with: swing
type: AnsweredQuestion
tagged with: jspinner
tagged with: java
has comment: http://stackoverflow.com/comment/37993868
type: Question
answer count: 2

http://stackoverflow.com/comment/59880429
type: Comment
comment on: http://stackoverflow.com/a/24429638
score: 1
type: AnswerComment
has text: Hi @user3833732. When you register your device to receive push notifications, you will receive one token to identify that phone. Whenever you start a game you should store the tokens of the players that are playing the chess game. Whenever one player makes a move, you should notify your ASP.net app and the ASP.net should be in charge of sending the notification to the player identified by token2.

http://stackoverflow.com/comment/37929426
type: QuestionComment
comment on: http://stackoverflow.com/q/24499692
has text: I doubt it. I'm not loading classes though.
score: 0
type: Comment

libgdx
tags question: http://stackoverflow.com/q/24544148
tags question: http://stackoverflow.com/q/24463122
tags question: http://stackoverflow.com/q/24575163
tags question: http://stackoverflow.com/q/24473181
tag name: libgdx
tags question: http://stackoverflow.com/q/24481230
tags question: http://stackoverflow.com/q/24431088
tags question: http://stackoverflow.com/q/24461745
tags question: http://stackoverflow.com/q/24540894
tags question: http://stackoverflow.com/q/24467014
tags question: http://stackoverflow.com/q/24547012
tags question: http://stackoverflow.com/q/24514873
tags question: http://stackoverflow.com/q/24542005
tags question: http://stackoverflow.com/q/24544720
tags question: http://stackoverflow.com/q/24434570
tags question: http://stackoverflow.com/q/24501268
type: Tag
tags question: http://stackoverflow.com/q/24526027
tags question: http://stackoverflow.com/q/24474988
tags question: http://stackoverflow.com/q/24485318
tags question: http://stackoverflow.com/q/24463768
tags question: http://stackoverflow.com/q/24581661
tags question: http://stackoverflow.com/q/24471475
tags question: http://stackoverflow.com/q/24520609
tags question: http://stackoverflow.com/q/24587792
tags question: http://stackoverflow.com/q/24496426
tags question: http://stackoverflow.com/q/24517318
tags question: http://stackoverflow.com/q/24544244
tags question: http://stackoverflow.com/q/24469381
tags question: http://stackoverflow.com/q/24559964
tags question: http://stackoverflow.com/q/24549555
tags question: http://stackoverflow.com/q/24583794
tags question: http://stackoverflow.com/q/24456978
tags question: http://stackoverflow.com/q/24483654
tags question: http://stackoverflow.com/q/24470640
tags question: http://stackoverflow.com/q/24557268
tags question: http://stackoverflow.com/q/24485261
tags question: http://stackoverflow.com/q/24487045

http://stackoverflow.com/q/24473313
tagged with: selenium
upvote count: 1
has body: So I'm pretty new to Selenium and I'm writing my first program with it. I'm trying to click a radio button that is on a table row. Here is the html code for the row. &lt;tbody&gt; &lt;tr id="headerrow"&gt; &lt;td&gt;&lt;/td&gt; &lt;td align="center"&gt;Name&lt;/td&gt; &lt;td align="left"&gt;Account&lt;/td&gt; &lt;td align="center"&gt;Status&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td align="center"&gt;CW&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td align="center"&gt;Last Hit&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td align="right"&gt;IP&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="1" bgcolor="#000000" colspan="10"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="10" colspan="10"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="userrow_1"&gt; &lt;td&gt;&lt;input type="radio" name="id" value="1764" onclick="set_it('1');"&gt;&lt;/td&gt; &lt;td&gt;John Doe&lt;/td&gt; &lt;td&gt;jdoe&lt;/td&gt; &lt;td align="center" bgcolor="#CCFFCC"&gt;Active&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td align="center" bgcolor="ccffcc"&gt;Yes&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td align="center" nowrap=""&gt;Offline - 12/12/12&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;td align="right"&gt;192.168.1.1&lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; I need to be able to click the button with only the value variable. Thanks for any help.
type: Question
has comment: http://stackoverflow.com/comment/37878444
has answer: http://stackoverflow.com/a/24473932
has comment: http://stackoverflow.com/comment/37878329
has title: Selenium Java Click Radio Button That is in a Table Row
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24473932
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/38015442
type: Comment
type: QuestionComment
has text: First, read [this](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java). Then use request attributes and EL.
comment on: http://stackoverflow.com/q/24547145
score: 1

http://stackoverflow.com/a/24442215
downvote count: 0
has comment: http://stackoverflow.com/comment/37821566
type: Answer
score: 8
has body: For adt , help -> Install new Software -> https://dl-ssl.google.com/android/eclipse/ -> don't select everything (it worked that way for me) i selected everything except Native development tools(i guess you don't need them if you debelop in java) and it's working well for me .
upvote count: 8
has comment: http://stackoverflow.com/comment/37821506
answers question: http://stackoverflow.com/q/24431005

http://stackoverflow.com/q/24523481
has title: How to manage AndroidMenifest xml in Android
favorite count: 0
score: 0
tagged with: android
downvote count: 1
linked to: http://stackoverflow.com/q/8779929
possible better answer: http://stackoverflow.com/a/24523616
has answer: http://stackoverflow.com/a/24523616
duplicate of: http://stackoverflow.com/q/8779929
accepted answer: http://stackoverflow.com/a/24523551
has comment: http://stackoverflow.com/comment/37971138
has comment: http://stackoverflow.com/comment/37971344
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24523551
type: Question
has body: I have Activity 'A' , 'B' , 'C', 'D', 'E' .The main activity is 'A', as defined in the AndroidManifest XML file, is started when the application is started. After that i have to call another activity 'B' then 'C' ,'D' And after 'D' i have to call 'E'.But when i start my app always start the main Activity 'A'.But I,m trying to call only once Activity 'A' when start the app first time and after that when i start the app second time i want to call Activity 'B'.How to manage this in Android. Here is my AndroidMenifest xml file <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/38041522
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24560753
score: 2
has text: I don't think that `units` in the subclass has been initialiased at the time that the base class constructor is running. Incidentally, it's a REALLY bad idea to have two fields of the same name - one in the base class and one in the subclass. It leads to confusing bugs like this one.

http://stackoverflow.com/a/24459618
type: Answer
accepted answer of: http://stackoverflow.com/q/24459349
upvote count: 3
has comment: http://stackoverflow.com/comment/37859988
has comment: http://stackoverflow.com/comment/37865100
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24459349
has body: Here is a little example: JSONArray array = new JSONArray(); JSONObject obj1 = new JSONObject(); obj1.put("key", "value"); array.put(obj1); JSONObject obj2 = new JSONObject(); obj2.put("key2", "value2"); array.put(obj2); That would look like: [ { "key": "value" }, { "key2": "value2" } ] If you want to get information about your JSONObjects in your JSONArray just iterate over them: for (int i = 0; i < array.length(); i++) { JSONObject object = (JSONObject) array.get(i); object.get("event_id"); object.get("event_title"); }

task
type: Tag
tags question: http://stackoverflow.com/q/24578517
tag name: task

http://stackoverflow.com/comment/37830927
score: 0
comment on: http://stackoverflow.com/q/24442295
has text: Thanks! Santosh Joshi That was it.... I forget to put controller and i expect to find the template without controller mapping.
type: Comment
type: QuestionComment

jpa
tags question: http://stackoverflow.com/q/24584608
tags question: http://stackoverflow.com/q/24563533
tags question: http://stackoverflow.com/q/24561691
tags question: http://stackoverflow.com/q/24512100
tags question: http://stackoverflow.com/q/24581056
tags question: http://stackoverflow.com/q/24436067
tags question: http://stackoverflow.com/q/24474774
tags question: http://stackoverflow.com/q/24558092
tags question: http://stackoverflow.com/q/24582047
tags question: http://stackoverflow.com/q/24454907
tags question: http://stackoverflow.com/q/24430048
tags question: http://stackoverflow.com/q/24434931
tags question: http://stackoverflow.com/q/24584411
tags question: http://stackoverflow.com/q/24432987
tags question: http://stackoverflow.com/q/24454682
tags question: http://stackoverflow.com/q/24560085
tags question: http://stackoverflow.com/q/24567553
tags question: http://stackoverflow.com/q/24445721
tags question: http://stackoverflow.com/q/24499620
tags question: http://stackoverflow.com/q/24442335
tags question: http://stackoverflow.com/q/24427798
tags question: http://stackoverflow.com/q/24438953
tags question: http://stackoverflow.com/q/24520602
tags question: http://stackoverflow.com/q/24586910
tags question: http://stackoverflow.com/q/24518386
tags question: http://stackoverflow.com/q/24427827
tags question: http://stackoverflow.com/q/24517120
tags question: http://stackoverflow.com/q/24580527
tags question: http://stackoverflow.com/q/24551623
tags question: http://stackoverflow.com/q/24461804
tags question: http://stackoverflow.com/q/24485365
tags question: http://stackoverflow.com/q/24441411
tags question: http://stackoverflow.com/q/24565641
tags question: http://stackoverflow.com/q/24485070
tags question: http://stackoverflow.com/q/24481429
tags question: http://stackoverflow.com/q/24572705
tags question: http://stackoverflow.com/q/24576157
tags question: http://stackoverflow.com/q/24491029
tags question: http://stackoverflow.com/q/24539038
tags question: http://stackoverflow.com/q/24487661
tags question: http://stackoverflow.com/q/24548613
type: Tag
tags question: http://stackoverflow.com/q/24526216
tags question: http://stackoverflow.com/q/24536278
tags question: http://stackoverflow.com/q/24556877
tags question: http://stackoverflow.com/q/24533811
tags question: http://stackoverflow.com/q/24480328
tags question: http://stackoverflow.com/q/24453858
tags question: http://stackoverflow.com/q/24434738
tags question: http://stackoverflow.com/q/24498483
tags question: http://stackoverflow.com/q/24494964
tags question: http://stackoverflow.com/q/24482763
tags question: http://stackoverflow.com/q/24568095
tags question: http://stackoverflow.com/q/24552319
tags question: http://stackoverflow.com/q/24446731
tags question: http://stackoverflow.com/q/24563385
tags question: http://stackoverflow.com/q/24522090
tags question: http://stackoverflow.com/q/24529473
tags question: http://stackoverflow.com/q/24524662
tags question: http://stackoverflow.com/q/24536804
tags question: http://stackoverflow.com/q/24481848
tags question: http://stackoverflow.com/q/24466759
tag name: jpa
tags question: http://stackoverflow.com/q/24579374
tags question: http://stackoverflow.com/q/24488455
tags question: http://stackoverflow.com/q/24543086
tags question: http://stackoverflow.com/q/24481542
tags question: http://stackoverflow.com/q/24562576
tags question: http://stackoverflow.com/q/24576100
tags question: http://stackoverflow.com/q/24528571
tags question: http://stackoverflow.com/q/24472054
tags question: http://stackoverflow.com/q/24444385
tags question: http://stackoverflow.com/q/24477018
tags question: http://stackoverflow.com/q/24491938
tags question: http://stackoverflow.com/q/24572092
tags question: http://stackoverflow.com/q/24487865
tags question: http://stackoverflow.com/q/24440820
tags question: http://stackoverflow.com/q/24569134
tags question: http://stackoverflow.com/q/24469403
tags question: http://stackoverflow.com/q/24496770

http://stackoverflow.com/a/24462523
has comment: http://stackoverflow.com/comment/37868246
has body: Try nodeList.item(i).getFirstChild().getTextContent() It will return the node and all child nodes as a string.
upvote count: 1
answers question: http://stackoverflow.com/q/24462308
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/38074958
comment on: http://stackoverflow.com/q/24577480
score: 0
type: Comment
has text: @saw303 I don't use GVM. I know that you have to copy something to make it work but I don't know what
type: QuestionComment

http://stackoverflow.com/comment/37916938
comment on: http://stackoverflow.com/q/24493315
score: 0
type: Comment
type: QuestionComment
has text: Changed and it still does not work. I moved all those glBindAttribLocation() calls before glLinkProgram(), then I removed the call to bind outcolor because I didnt use it anyways. Still 1282 all over the place. Editted question for clarity.

http://stackoverflow.com/comment/38048478
type: QuestionComment
has text: .. 3) Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead [use layout managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html), or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556). ..
score: 0
comment on: http://stackoverflow.com/q/24564731
type: Comment

http://stackoverflow.com/comment/38092296
has text: I'm sorry, it is very hard to me to understand your last sentence. What is your native language? Do you speak Russian? If yes we can continue through Google+, if not - then please rewrite the sentence with commas.
type: Comment
comment on: http://stackoverflow.com/q/24585813
score: 0
type: QuestionComment

http://stackoverflow.com/a/24480993
type: Answer
has body: In function Die apply return statement: public int Die(int sides) { this.nSides = sides; r = new Random(); return 0; // whatever you want to return } or remove int before die and make it void. public void Die(int sides) { this.nSides = sides; r = new Random(); }
score: 0
answers question: http://stackoverflow.com/q/24480959

http://stackoverflow.com/comment/37822060
comment on: http://stackoverflow.com/q/24441015
score: 2
type: Comment
type: QuestionComment
has text: Here's a question. If a `BigInteger` can't hold a value larger than an `int`, what would be the point _of_ `BigInteger`?

http://stackoverflow.com/comment/37817962
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24440617
has text: What do you see if you print out p and p.subpath(0, 1)?
type: Comment

http://stackoverflow.com/comment/37881859
score: 2
comment on: http://stackoverflow.com/q/24463906
has text: If you list the contents of your jar, like `jar tf lib/RedditLib.jar`, do you actually see those alleged classes, like `com/cd/reddit/Reddit.class`?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37834313
type: AnswerComment
score: 0
type: Comment
has text: thanks for your reply and the link, but they are using generator.generateFont, while i am using external fonts i creatd myself with Bmfont generator.
comment on: http://stackoverflow.com/a/24449359

http://stackoverflow.com/q/24553336
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24558312
has comment: http://stackoverflow.com/comment/38026580
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/38027206
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24558312
tagged with: wear-os
has title: Adding actions to an Android Wear Activity
has body: I would like to be able to have the user swipe over a screen and tap the "Open on Phone" action from within my Android Wear app, but I cannot seem to find how to make this happen. The click and what not is not the issue, I cannot figure out how to add the actions, my activity doesn't allow the user to swipe over. Any ideas on how this is accomplished? The key here is that the actions are in the Activity, not in the Notification which has plenty of documentation. For an exact example of what I want, look at the world clock app with no clocks setup. It will say swipe to add, swiping over reveals an add action inside the blue circle background. This is the behavior I'd like to see.
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/126215148
has text: Why does this happen exactly? I've tried it on my local and I'm getting the sequential runs with lambda. This is with OpenJDK11.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/71194241

http://stackoverflow.com/comment/37846458
comment on: http://stackoverflow.com/q/24456001
score: 0
type: Comment
type: QuestionComment
has text: Why you import `mockobjects-jdk1.3-j2ee1.3-0.09.jar`? Can you add complete Stacktrace plz.

http://stackoverflow.com/comment/38009377
has text: I tried similar things. The problem was always I couldn't make the TextView change
comment on: http://stackoverflow.com/a/24543483
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38296592
score: 0
comment on: http://stackoverflow.com/a/24455640
type: Comment
has text: OK, cool. Ignore Google's instructions to extract to dev path, and just throw it on root without allowing subfolder. Worked! Thanks!
type: AnswerComment

http://stackoverflow.com/comment/37950440
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24512412
has text: @inquisitiveIdiot There's no need to say it again if it's already been said - that's how SO attempts to keep the site uncluttered. OP can look at those links and see if they solve the problem. If they don't and the moderators don't believe it's a duplicate - then someone will eventually answer the "new" issue and my comments will either be ignored or deleted. However, they also might help other people who are directed here to find the right answer at those links.

http://stackoverflow.com/a/24441670
has comment: http://stackoverflow.com/comment/37819950
has body: According to the class.getResourceAsStream documentation : "The rules for searching resources associated with a given class are implemented by the defining class loader of the class. " And then for loader class we have: Any class name provided as a String parameter to methods in ClassLoader must be a binary name as defined by the Java Language Specification. Examples of valid class names include: "java.lang.String" "javax.swing.JSpinner$DefaultEditor" "java.security.KeyStore$Builder$FileBuilder$1" "java.net.URLClassLoader$3$1" Before delegation, an absolute resource name is constructed from the given resource name using this algorithm: If the name begins with a '/' ('\u002f'), then the absolute name of the resource is the portion of the name following the '/'. Otherwise, the absolute name is of the following form: modified_package_name/name Where the modified_package_name is the package name of this object with '/' substituted for '.' ('\u002e'). So you should use : source = "Package_name" + ".folder.test" //remove the ".txt" from the file FileCopyFromJAR.class.getResourceAsStream(source);
has comment: http://stackoverflow.com/comment/37820245
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24441002

http://stackoverflow.com/q/24575144
score: 0
answer count: 1
has title: Spring integration send ack using gateway
tagged with: spring
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
has answer: http://stackoverflow.com/a/24575567
linked to: http://stackoverflow.com/q/24406645
type: Question
accepted answer: http://stackoverflow.com/a/24575567
has body: I have a producers( write in CPP) that send to “spring-integration server” the binary-data. And it works correctly as : spring integration time out clients Now I have to send a reply (like an ACK) to the producer. I have read about the gateway, but actually I’m confused. My configuration is: &lt;int-ip:tcp-connection-factory id="serverTcpConFact" type="server" port="5566" using-nio="true" single-use="false" task-executor="myTaskExecutor" deserializer="serializer" serializer="serializer"/&gt; &lt;int-ip:tcp-inbound-channel-adapter id="tcpInboundAdapter" channel="tcpInbound" connection-factory="serverTcpConFact" /&gt; &lt;int:channel id="tcpInbound" /&gt; &lt;int:service-activator output-channel="tcpOutbound" input-channel="tcpInbound" ref="importService" method="handler" /&gt; &lt;bean id="importService" class="my.ImportService" /&gt; &lt;int:channel id="tcpOutbound" /&gt; &lt;int:gateway id="mygateway" service-interface="my.IpMyGatway" default-request-channel="tcpInbound" default-reply-channel="tcpOutbound" default-reply-timeout="6000"/&gt; I also have an custom serializator, the problem is that the my spring integration server doesn’t send the reply. I need that the reply executes: @Override public void serialize(MyMessage arg0, OutputStream outputStream) throws IOException { // TODO Auto-generated method stub logger.info("serialize messages"); // here I have to write my ACK ! ( .. or not?) } And then sends the message to the producer for each message. Thank you.

http://stackoverflow.com/comment/38034810
type: QuestionComment
score: 11
has text: Since only you know the *useless* words, then you should write the dictionary by yourself. That's part of your assignment/work.
comment on: http://stackoverflow.com/q/24557584
type: Comment

http://stackoverflow.com/q/24579683
type: UnansweredQuestion
tagged with: reentrantreadwritelock
has comment: http://stackoverflow.com/comment/38077216
tagged with: multithreading
upvote count: 1
has body: We're building cache stores in our app backed by memory, file, and remote services. Want to avoid explicit synchronization to keep the stores simple while using decorators for behavioral concerns like blocking. Here's a simple cache, this is just an example! import java.util.HashMap; public class SimpleCache { private HashMap&lt;String,Object&gt; store; private final BlockingCacheDecorator decorator; public SimpleCache(){ store = new HashMap&lt;String,Object&gt;(); decorator = new BlockingCacheDecorator(this); } //is NOT called directly, always uses decorator public Object get(String key){ return store.get(key); } //is NOT called directly, always uses decorator public void set(String key, Object value){ store.put(key, value); } //is NOT called directly, always uses decorator public boolean isKeyStale(String key){ return !(store.containsKey(key)); } //is NOT called directly, always uses decorator public void refreshKey(String key){ store.put(key, new Object()); } public BlockingCacheDecorator getDecorator(){ return decorator; } } getDecorator() returns a decorator providing synchronization for get() and set(), while isKeyStale() and refreshKey() allows the decorator to check if a key should be refreshed without knowing why or how. I got the idea for a synchronizing decorator from here. import java.util.concurrent.locks.ReentrantReadWriteLock; public class BlockingCacheDecorator { private SimpleCache delegate; private final ReentrantReadWriteLock lock; public BlockingCacheDecorator(SimpleCache cache){ delegate = cache; lock = new ReentrantReadWriteLock(); } public Object get(String key){ validateKey(key); lockForReading(); try{ return delegate.get(key); }finally{ readUnlocked(); } } public void setKey(String key, Object value){ lockForWriting(); try{ delegate.set(key,value); }finally{ writeUnlocked(); } } protected void validateKey(String key){ if(delegate.isKeyStale(key)){ try{ lockForWriting(); if(delegate.isKeyStale(key)) delegate.refreshKey(key); }finally{ writeUn…
has title: ReadWriteLock decorator, is this code thread safe?
has comment: http://stackoverflow.com/comment/38077335
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38076420
has comment: http://stackoverflow.com/comment/38077381
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/38077018
has answer: http://stackoverflow.com/a/24580264
has comment: http://stackoverflow.com/comment/38076926
has answer: http://stackoverflow.com/a/24580285
downvote count: 0
has comment: http://stackoverflow.com/comment/38077376
has comment: http://stackoverflow.com/comment/38077140
tagged with: synchronization
favorite count: 0
tagged with: blocking

http://stackoverflow.com/a/24565680
answers question: http://stackoverflow.com/q/24565648
has comment: http://stackoverflow.com/comment/38050532
has body: Basically in you code, due to the sleep statements (both in the Thread and by the launcher), you are effectively kicking off the threads allowing for plenty of non busy time to update. That is why it is working. If you code was really multi-threaded, the you would face synchronization issues.
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/37953194
type: Comment
has text: Thanks for your answer. Yes I could use try/catch but it seems more like a workaround than a solution. I would like to avoid the exception being thrown.
comment on: http://stackoverflow.com/a/24513745
score: 0
type: AnswerComment

http://stackoverflow.com/q/24558781
type: Question
tagged with: resources
tagged with: tile
accepted answer: http://stackoverflow.com/a/24558804
tagged with: arraylist
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24558823
has title: Resource loading into ArrayList for tile-based game. (Java)
has answer: http://stackoverflow.com/a/24558804
has body: So i'm attempting to develop a tile-based game using eclipse, and i have run into a problem on how to load the resources from the resource folder into an ArrayList. I have a file reader that can load all of the needed files into a list, but i can't use class folders for each tile type (grass, stone, etc) because an ArrayList can only store one class type. Is there a way to load all sub-classes of the tile super-class into a single ArrayList.
possible better answer: http://stackoverflow.com/a/24558823
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/84157203
type: Comment
has text: the timer javascript has to be developed in each and every jsp page?
comment on: http://stackoverflow.com/a/24580631
type: AnswerComment
score: 0

http://stackoverflow.com/q/24477929
tagged with: recursion
has answer: http://stackoverflow.com/a/24478003
tagged with: java
has body: I am suppose to write a program which calculate the number in a sequence. And Count the number of times it has been called. I don't know how to go about switching between methods either for when the ietrative/recursive radio button is selected. Can i just use an if statement in the main? I comment out some old mistakes, so just ignore the comments The method addActionListener(ActionListener) in the type Abstract Button is not applicable for the arguments (Sequence)LINE33 Syntax error on tokens, delete these tokens.LINE17-Im pretty sure i need this for the actionlistener Type mismatch: cannot convert from JTextField to double.LINE 46 Syntax error on token "double", @ expected- line 49 package sequence; import java.awt.*; import java.awt.event.*; import java.io.IOException; import javax.swing.*; public class Sequence extends JFrame implements ActionsListener{ private static final double function=0; private JTextField number=new JTextField(20),result=new JTextField(20),efficiency=new JTextField(20); private static JRadioButton iterative= new JRadioButton("Iterative");JRadioButton recursive= new JRadioButton("Recursive"); private JButton compute = new JButton("Compute"); public Sequence(){ super (“Function Efficiency”); setSize(350,250); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new GridLayout(6,2)); //add(new JLabel("Iterative Method"));add(form1); ButtonGroup group = new ButtonGroup(); group.add(iterative); group.add(recursive); //add(new JLabel("Recursive Method"));add(form2); add(new JLabel("Enter N"));add(number); add(new JLabel(""));add(compute); add(new JLabel("Result: "));add(result); add(new JLabel("Efficiency :"));add(efficiency); efficiency.setEditable(false); compute.addActionListener(this); } public void actionPerformed(ActionEvent event){ result.setText(result.getText()); efficiency.setText(number.getText()); //double efficiency=0; } private double iterativemethod (){number.getText(); if…
type: AnsweredQuestion
has title: How can i count the "count" or iteration or Calls of a method when comparing iterative and recursive methods.?
tagged with: iteration
accepted answer: http://stackoverflow.com/a/24478003
type: Question
has comment: http://stackoverflow.com/comment/37887045
score: 0
tagged with: methods
answer count: 1

http://stackoverflow.com/comment/37929606
comment on: http://stackoverflow.com/q/24500663
score: 0
type: QuestionComment
has text: Some objects support the Cloneable interface, allowing you to conveniently copy them. Otherwise you can use `someObject.getClass().newInstance()` to create an instance of the class if you don't need to provide any creation parameters.
type: Comment

http://stackoverflow.com/q/24569403
has title: Conversion to Dalvik format failed error from Eclipse when compiling on Ubuntu
score: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38057076
has comment: http://stackoverflow.com/comment/38057072
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/24570422
has answer: http://stackoverflow.com/a/24569525
type: Question
upvote count: 3
has body: Is it my code or is running Eclipse on Ubuntu linux (or any other distro variant) causing this error message to show very often? Either when trying to compile, build project, or an equivalent, the error comes from the IDE itself. I read many questions in here that asking about maybe the same case that I have, like if the error message shows up you need to restart Eclipse and the error won't appear again. Now I have one project thats using @override code like OnCreate, OnPause, OnStop and others on my script MainActivity.java. There is nothing wrong with the code, but everytime I try to run it as an android application, Eclipse shows an error like this: Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes; Why is that? Has anyone had the same problem and discovered the answer? Many thanks. Regards, Indra.
downvote count: 1
linked to: http://stackoverflow.com/q/7870265
linked to: http://stackoverflow.com/q/24527323
tagged with: java
answer count: 3
duplicate of: http://stackoverflow.com/q/7870265
has comment: http://stackoverflow.com/comment/38058543
has answer: http://stackoverflow.com/a/24570968
tagged with: eclipse

http://stackoverflow.com/q/24473089
tagged with: java
has comment: http://stackoverflow.com/comment/37877884
type: Question
has comment: http://stackoverflow.com/comment/37877929
favorite count: 0
answer count: 3
has body: I am trying to find the duplicate number in an array, but it's not working. public class FindDuplicateNumber { /** * @param args */ public static void main(String[] args) { int[] arr={10,20,30,40,40,25}; int[] duplicate=duplicateNumber(arr); for(int dup : duplicate ){ System.out.println("duplicate elements are:\t"+ dup); } } public static int[] duplicateNumber(int[] arr){ int[] duplicate = new int[arr.length]; for(int i=0;i&lt;=arr.length-1;i++){ if(arr[i]==arr[++i]){ duplicate[i]= arr[i]; } } return duplicate; } }
has title: Find the duplicate number in an array
has answer: http://stackoverflow.com/a/24473324
upvote count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/37877925
downvote count: 4
has comment: http://stackoverflow.com/comment/37877862
has answer: http://stackoverflow.com/a/24473155
has comment: http://stackoverflow.com/comment/37877915
has comment: http://stackoverflow.com/comment/37877891
has answer: http://stackoverflow.com/a/24480313

http://stackoverflow.com/a/24574413
has body: Appium does not delete cookies beyond its current domain. To delete from other cookies as well provide the domain (ex: xyz.com in below code) Set&lt;Cookie&gt; cookies = driver.manage().getCookies(); Iterator&lt;Cookie&gt; itr = cookies.iterator(); while (itr.hasNext()){ Cookie c = itr.next(); driver.executeScript("document.cookie = " + c.getName() + "=; path=/; domain=xyz.com; expires=Thu, 18 Dec 2013 12:00:00 GMT;" ); } } escape the semi colon in above string of executeScript method
type: Answer
answers question: http://stackoverflow.com/q/24506036
score: 0

http://stackoverflow.com/comment/37961010
score: 0
type: AnswerComment
has text: Just tried setting timezone utc-3 to sdf and its worst.
type: Comment
comment on: http://stackoverflow.com/a/24512843

swagger-ui
tag name: swagger-ui
type: Tag
tags question: http://stackoverflow.com/q/24557640

http://stackoverflow.com/q/24432095
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/41643378
type: UnansweredQuestion
tagged with: multithreading
has title: How to make a Arraylist thread-safe and serializeable using XMLEncoder
score: 2
downvote count: 0
tagged with: java
tagged with: xmlencoder
type: Question
has comment: http://stackoverflow.com/comment/38044762
tagged with: arraylist
upvote count: 2
has body: First off: I know there are many related posts in SO about this but one that I could find was able to help in my case. So, what I'm doing is I got a very simple parent object that may have multiple child objects. Both objects comply to the java beans specifications (no-args constructor, setter and getter for all variables). There may be multiple parents, which are saved in a repository class like this: private final Map<String, Parent> parentItems = new ConcurrentHashMap<String, Parent>(); Every time a new parent is created, a repository class saves the parent list which is build from the parentItems list like this: public List<Parent> getParents() { return new ArrayList<Parent>(parentItems.values()); } The save operation is done by saving the List into an xml file using XMLEncoder. It looks like this: public void saveParents(OutputStream os) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); XMLEncoder encoder = null; try { Thread.currentThread().setContextClassLoader(Parent.class.getClassLoader()); encoder = new XMLEncoder(os); encoder.writeObject(getParents()); encoder.flush(); } finally { if (encoder != null) { encoder.close(); } Thread.currentThread().setContextClassLoader(cl); } } This all works fine. Now I want to add some children to the parent object and just add new child objects to the child List and rerun saveParents(). Here is where my trouble begins: If I use a ArrayList within the parent to save the children, like this: private ArrayList<Child> children = new ArrayList<Child>(); Everything works. The objects will be saved within the parent in the xml file. It looks something like this: <?xml version="1.0" encoding="UTF-8"?> Child1 myid1 Child2 myid2 Parent1 myid However: we know that ArrayList is not thread-safe and I know that the parent object may be altered by multiple people. So how to fix that? Use a synchronizedList(...) - right? Something like ... private List<Child> children = Collections.synchronizedList(new ArrayList<Child>()…
answer count: 1

http://stackoverflow.com/comment/38062815
type: AnswerComment
comment on: http://stackoverflow.com/a/24570794
score: 0
type: Comment
has text: I added the new. But I don't think that is the problem: As I now get this error: No such property: inputStream

http://stackoverflow.com/comment/37820365
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24441944
has text: If it's a primary key and you check for equality, you should get one row at most. The operation shouldn't be too lengthy.

http://stackoverflow.com/comment/37913224
has text: java uses a different REGEX engine. Not the same one used in JS or Perl. So, you don't need "/"s
comment on: http://stackoverflow.com/q/24491764
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24585429
favorite count: 0
tagged with: exception
answer count: 3
has comment: http://stackoverflow.com/comment/38086863
has title: Jsp index exception when start tomcat
possible better answer: http://stackoverflow.com/a/24585485
has comment: http://stackoverflow.com/comment/38086459
has answer: http://stackoverflow.com/a/24585485
linked to: http://stackoverflow.com/q/9110148
accepted answer: http://stackoverflow.com/a/24586873
upvote count: 1
type: AnsweredQuestion
has body: I have a strange problem. Lets start with the error: SEVERE: Servlet.service() for servlet [jsp] in context with path [] threw exception [/index.jsp (line: 3, column: 1) File "/WEB-INF/jsp/includes.jsp" not found] with root cause org.apache.jasper.JasperException: /index.jsp (line: 3, column: 1) File "/WEB-INF/jsp/includes.jsp" not found at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133) at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:322) at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:357) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:467) at org.apache.jasper.compiler.Parser.parseFileDirectives(Parser.java:1779) at org.apache.jasper.compiler.Parser.parse(Parser.java:135) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242) at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:119) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:193) at org.apache.jasper.compiler.Compiler.__compile(Compiler.java:373) at org.apache.jasper.compiler.Compiler.compile(Compiler.java) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) at org.apache.jasper.servlet.JspServlet._serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305…
linked to: http://stackoverflow.com/q/24404827
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24585547
type: Question
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/24586873
tagged with: tomcat

http://stackoverflow.com/a/24435863
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24431876
downvote count: 0
has body: Yes, vaadin 7 allows you directly to do it. In vaadin 6 you have a little bit more to do, but it also works. Look here for the different solutions with vaadin 6 Is it possible to use jQuery inside of Vaadin framework?

http://stackoverflow.com/comment/37805137
score: 0
type: Comment
has text: @AndréStannek Yeah, I was trying to keep it simple, since that's not directly relevant to the question. But good point; I'll reword a bit.
type: AnswerComment
comment on: http://stackoverflow.com/a/24433802

http://stackoverflow.com/comment/37958308
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24516353
has text: still the same problem

http://stackoverflow.com/comment/38290036
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24585884
has text: @ElliottFrisch if you are using JDBC-to-ODBC bridge driver yes, there's only one statement per connection, but in JDBC you can open many in same connection. http://www.oracle.com/technetwork/java/index-138427.html#15 but JDBC-ODBC drivers are not recommended in java (in production enviroment) and rarely used (in this case kiran uses JDBC)

http://stackoverflow.com/a/24512050
upvote count: 2
answers question: http://stackoverflow.com/q/24511923
has body: You are getting the IP address as an integer value, guava has InetAddresses - String addressStr = InetAddresses.fromInteger(Integer.parseInt(ip)).getHostAddress(); Or, using only regular Java code, String addressStr = InetAddress.getByAddress(BigInteger.valueOf(Integer.parseInt(ip)) .toByteArray()).getHostAddress();
accepted answer of: http://stackoverflow.com/q/24511923
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37950560
downvote count: 0
has comment: http://stackoverflow.com/comment/37950297
type: Answer
has comment: http://stackoverflow.com/comment/37950193
score: 2

http://stackoverflow.com/comment/38012168
comment on: http://stackoverflow.com/q/24544907
type: Comment
type: QuestionComment
has text: in my app when i want to login i am getting server error and if i changed string to object it is working so... @aifasin
score: 0

java-time
tags question: http://stackoverflow.com/q/24491243
tags question: http://stackoverflow.com/q/24523627
type: Tag
tags question: http://stackoverflow.com/q/24518476
tags question: http://stackoverflow.com/q/24471102
tag name: java-time
tags question: http://stackoverflow.com/q/24491260

http://stackoverflow.com/comment/74705563
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24566563
type: AnswerComment
has text: @Tomer What version of Log4j2 are you using?

jframe
tags question: http://stackoverflow.com/q/24583305
tags question: http://stackoverflow.com/q/24539640
tags question: http://stackoverflow.com/q/24476496
tags question: http://stackoverflow.com/q/24580952
tags question: http://stackoverflow.com/q/24481472
tags question: http://stackoverflow.com/q/24446984
tag name: jframe
tags question: http://stackoverflow.com/q/24482099
tags question: http://stackoverflow.com/q/24493236
tags question: http://stackoverflow.com/q/24464471
tags question: http://stackoverflow.com/q/24564052
tags question: http://stackoverflow.com/q/24471832
tags question: http://stackoverflow.com/q/24567309
tags question: http://stackoverflow.com/q/24499977
tags question: http://stackoverflow.com/q/24443247
tags question: http://stackoverflow.com/q/24520931
tags question: http://stackoverflow.com/q/24508527
tags question: http://stackoverflow.com/q/24434229
tags question: http://stackoverflow.com/q/24515976
tags question: http://stackoverflow.com/q/24564760
tags question: http://stackoverflow.com/q/24472661
tags question: http://stackoverflow.com/q/24448031
tags question: http://stackoverflow.com/q/24566111
tags question: http://stackoverflow.com/q/24480504
tags question: http://stackoverflow.com/q/24464805
tags question: http://stackoverflow.com/q/24472566
tags question: http://stackoverflow.com/q/24561098
tags question: http://stackoverflow.com/q/24467202
tags question: http://stackoverflow.com/q/24570803
type: Tag
tags question: http://stackoverflow.com/q/24473016
tags question: http://stackoverflow.com/q/24517689

http://stackoverflow.com/q/24566653
has answer: http://stackoverflow.com/a/24582655
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38084131
linked to: http://stackoverflow.com/q/13426778
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/38052822
upvote count: 1
has comment: http://stackoverflow.com/comment/38074925
type: Question
has comment: http://stackoverflow.com/comment/38052339
tagged with: jackson
has title: Jackson annotations for easy JSON deserialization
answer count: 1
downvote count: 0
has body: I have a JSON file which looks like this: { "root": [ { "id": "abc1", "x": "x1", "y": "y1" }, { "id": "abc2", "x": "x2", "y": "y2" }, ... ] } I want to deserialize this with Jackson to an object from a class that looks like this: Class A { Map&lt;String, String&gt; x; Map&lt;String, String&gt; y; } At the end I want the maps inside the A object to look like: x = { (abc1, x1), (abc2, x2) }, y = { (abc1, y1), (abc2, y2) } Is there a way to annotate this class with Jackson so that I can do this deserialization in one line? I couldn't find a way to do that without having to change the design of class A.
favorite count: 0
has comment: http://stackoverflow.com/comment/38053207
tagged with: serialization

parallel-processing
tags question: http://stackoverflow.com/q/24485708
tags question: http://stackoverflow.com/q/24468402
tags question: http://stackoverflow.com/q/24495774
type: Tag
tag name: parallel-processing
tags question: http://stackoverflow.com/q/24503191
tags question: http://stackoverflow.com/q/24531375
tags question: http://stackoverflow.com/q/24490853

atomic
type: Tag
tags question: http://stackoverflow.com/q/24540610
tag name: atomic
tags question: http://stackoverflow.com/q/24584295

http://stackoverflow.com/comment/37876088
comment on: http://stackoverflow.com/a/24472131
has text: Isnt that a link folder? or am i confusing it with something else?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24542211
tagged with: sip
has comment: http://stackoverflow.com/comment/38007109
type: UnansweredQuestion
tagged with: python
tagged with: php
has body: I'm an intern at a telecommunications operator and my task is to create an application that enables me to send sip (session initiation protocol) requests with the header fields values that I specify. For example generate a register request with the via, from, to, contact and authentication header fields values that I supply. PS: I don't want to create a hole sip client, I just want to create register and invite messages with specific header field values. I've found this method (level7systems.co.uk/en/blog/Click+to+Call+with+PHP-SIP) to be relevant but I'm not sure if it's capable of doing what I need exactly Is this possible using php? If not what would be the best programming language to create such an application?
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38007224
type: Question
has title: how to create a SIP request with specific header fields values
score: 0

http://stackoverflow.com/comment/37814491
comment on: http://stackoverflow.com/q/24438373
type: Comment
type: QuestionComment
has text: Yep GridBagLayout is a powerful, but perhaps you only need a GridLayout or simple a FlowLayout
score: 0

geotools
type: Tag
tags question: http://stackoverflow.com/q/24472071
tag name: geotools

http://stackoverflow.com/comment/37905845
comment on: http://stackoverflow.com/a/24487926
score: 0
type: Comment
has text: Ohh okay. Wait, how come I don't have to take care of `onBackPressed`? Will it pop off the stack automatically if I press the back button without me having to implement it?
type: AnswerComment

http://stackoverflow.com/q/24496610
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37922642
type: Question
has answer: http://stackoverflow.com/a/24497135
downvote count: 0
has comment: http://stackoverflow.com/comment/37922338
has body: So I am able to upload a photo to Facebook using the code below. FacebookDialog shareDialog = createShareDialogBuilderForPhoto(activity, image).build(); uiHelper.trackPendingDialogCall(shareDialog.present()); but I would now like to have a caption along with it. Is that possible?
tagged with: sdk
tagged with: android
has comment: http://stackoverflow.com/comment/37922581
answer count: 1
score: 1
favorite count: 0
has title: Can you add a caption for a photo Using Facebook SDK
type: UnansweredQuestion
tagged with: facebook
has comment: http://stackoverflow.com/comment/37925383

http://stackoverflow.com/comment/37934890
type: QuestionComment
comment on: http://stackoverflow.com/q/24503245
has text: Can you tell me why it's showing L/AA/pom.xml? when pom is not created?
score: 0
type: Comment

http://stackoverflow.com/q/24512968
score: 0
tagged with: numberformatexception
tagged with: file-io
has answer: http://stackoverflow.com/a/24513269
answer count: 5
has comment: http://stackoverflow.com/comment/37951258
has title: Reading / Writing number in Java -- Then NumberFormatException when converting
has answer: http://stackoverflow.com/a/24513095
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24513047
has comment: http://stackoverflow.com/comment/37951421
tagged with: java
has body: I have a number I write as UTF-8 then read it back in (at a later stage). Then I convert it to a number because I use this number for arithmetics. I get a NumberFormatException but cannot see a reason. I am operating entirely in UTF-8, both ways, is that a problem? So, the first output is fine and I see my number (as a string). The second output fails with a NumberFormatException. Here is my code for writing and reading the file: static public void putContents(File aFile, String content, boolean append) { // init Writer writer = null; // make sure file exists if (!aFile.exists()) { Util.createFile(aFile.getAbsolutePath()); } // write content try { writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(aFile), "UTF-8")); writer.write(content); writer.close(); } catch (IOException e) { logger.error("Error writing content to file: " + aFile); } finally { try { // Close the writer regardless of what happens writer.close(); } catch (Exception e) { logger.error("Error while closing file: " + aFile.getAbsolutePath()); } } } static public void createFile(String filename) { // protection against accidental overwrite if (new File(filename).exists()) { logger.warn("File '" + filename + "' already exists. Nothing done."); return; } // create file with directory structure File targetFile = new File(filename); File parent = targetFile.getParentFile(); if (!parent.exists() &amp;&amp; !parent.mkdirs()) { throw new IllegalStateException("Couldn't create dir: " + parent); } try { targetFile.createNewFile(); } catch (IOException e){ logger.error("Error while creating empty file '" + filename + "': " + e.getMessage()); } } static public String getContents(File aFile) { StringBuilder contents = new StringBuilder(); try { // extract all text from this file BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(aFile), "UTF-8")); try { String line = null; //not declared within while loop while ((line = reader.readLine()) != null) { contents.…
possible better answer: http://stackoverflow.com/a/24513095
has answer: http://stackoverflow.com/a/24513198
type: Question
has answer: http://stackoverflow.com/a/24513195
accepted answer: http://stackoverflow.com/a/24513047

http://stackoverflow.com/comment/38000719
score: 0
type: Comment
type: AnswerComment
has text: Elliott, that is very true. My advice however is consistent with established best practices.
comment on: http://stackoverflow.com/a/24538231

http://stackoverflow.com/comment/37886305
type: AnswerComment
has text: How do I go about adding it?
score: 0
comment on: http://stackoverflow.com/a/24477596
type: Comment

http://stackoverflow.com/comment/38070615
has text: **plenty of free memory** means the young generation area is not having much rush all the object are doing their job and getting garbage collected
comment on: http://stackoverflow.com/a/24573549
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24457316
answers question: http://stackoverflow.com/q/24457285
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37860811
has comment: http://stackoverflow.com/comment/37848382
score: 2
has comment: http://stackoverflow.com/comment/37848352
has body: No version of Java is truly 'outdated' in the sense I think you mean. There has since been a great deal of extra functionality added to the language, but not removed. So you may not learn about some things that are now possible with the language, but nothing you learn is likely to have gone out of date except some smalls exception with regards to Java applets (which are not really relevant in Android development anyway). Android is now capable of handling Java 7 code, so it probably wouldn't be worth learning the in-and-outs of Java 8 if your learning it specifically for Android development.
upvote count: 2
has comment: http://stackoverflow.com/comment/37848449

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/24550026
tags question: http://stackoverflow.com/q/24536880

http://stackoverflow.com/a/24485686
type: Answer
score: 1
upvote count: 1
has body: Yes, when you create and assign a String value eg String s1="hello"; , it gets added in the String pool. Now if you assign the same String value to another reference like this:- String s2="hello"; The variable s2 will point to the same String object hello , present in String pool. However you can force and create a new String object for the same values like this:- String s3= new String("hello"); This will add and create new object for hello even though it is already present in the String pool. Hence it can be summarised as:- s1==s2; //return true s1==s3; //return false s2==s3; //returns false
downvote count: 0
answers question: http://stackoverflow.com/q/24485594

http://stackoverflow.com/q/24441614
type: AnsweredQuestion
tagged with: java
score: -1
downvote count: 2
has title: Does the JDK update itself?
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37819674
has answer: http://stackoverflow.com/a/24441657
accepted answer: http://stackoverflow.com/a/24441657
has comment: http://stackoverflow.com/comment/37819642
has body: Does the JDK (Java Development Kit) update itself? I have noticed that I haven't gotten an update for JDK but only Java updates.
type: Question

http://stackoverflow.com/a/46286333
downvote count: 0
answers question: http://stackoverflow.com/q/24518807
type: Answer
has body: Java applets are dead. Most browsers have removed support for them, and Java deprecated them in Java 9. You could use Java Web Start, which basically puts a button on your webpage that launches a Java .jar file. But note that you'll still have to sign your application with a paid certificate. Your users will also have to have Java installed and correctly configured. This is a pretty far cry from what most users expect (a simple application that is embedded in the page). You're probably better off packaging your sketch as a runnable executable. You can do that from the Processing editor, or there are tools out there that package it for you. Shameless self-promotion: here is a tutorial on exporting Processing sketches as executables. But your best option is to deploy as JavaScript using Processing.js or rewrite your sketch in P5.js. Then you can deploy your sketch as JavaScript and embed it directly in a webpage.
upvote count: 1
score: 1

http://stackoverflow.com/comment/37972441
type: QuestionComment
has text: No errors are detected.But the specific folder which i want to extract is getting concatenated with the output folder and the whole zip gets extracted over there.
comment on: http://stackoverflow.com/q/24523997
score: 0
type: Comment

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

http://stackoverflow.com/a/24430640
type: Answer
score: 2
has body: Try retrievedDocument.getProperty("readings").getProperty("5090");
answers question: http://stackoverflow.com/q/24430436
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24430436
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24479616
has body: I set up a FileReader, and opened a file to read, but it gives me a weird output, that I can't seem to fix: import java.io.BufferedReader; import java.io.FileReader; public class FileReading { public static void main(String [] args) throws Exception { FileReader file = new FileReader("/Users/danielpersonius/Desktop/test.rtf"); BufferedReader reader = new BufferedReader(file); String text = ""; String line = reader.readLine(); while (line != null){ // So here, we want to print until it reaches 'null' text += line; line = reader.readLine(); } System.out.println(text); } } This is my output: {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf200{\fonttbl\f0\fswiss\fcharset0 Helvetica;}{\colortbl;\red255\green255\blue255;}\margl1440\margr1440\vieww10800\viewh8400\viewkind0\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\f0\fs24 \cf0 TEST} TEST is what the rtf file says, but how do I get rid of all the other stuff I obviously don't want? I'm on an IMac with OS X Mavericks
score: 0
has comment: http://stackoverflow.com/comment/37890364
has comment: http://stackoverflow.com/comment/37890488
possible better answer: http://stackoverflow.com/a/24479681
has answer: http://stackoverflow.com/a/24479681
answer count: 3
accepted answer: http://stackoverflow.com/a/24479676
has comment: http://stackoverflow.com/comment/37890377
has answer: http://stackoverflow.com/a/24479676
tagged with: filereader
has answer: http://stackoverflow.com/a/27985620
type: AnsweredQuestion
tagged with: java
has title: java file reader weird output
type: Question

http://stackoverflow.com/q/24429009
has comment: http://stackoverflow.com/comment/37796902
linked to: http://stackoverflow.com/q/24432174
has comment: http://stackoverflow.com/comment/37795981
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37796598
has comment: http://stackoverflow.com/comment/37795864
has body: A more accurate question is Here I have this dbf database file containing several names and information of employees... and my java application reads rows from this database and prepare some papers (like work certificate...). And where i am from we use special characters in names since it's francophone country. Like for example "Hédia" or "fayçal".. The problem here is that the database contains names with special characters as mentioned, and when printing the papers in question, the characters are not supported and an empty white space is shown instead. I hope i am making myself clear. So is there a way to programmatically make the printing support these characters? I know that there's the Locale class in java but i don't know if it is possible to use it for printing purposes. I hope this problem gets solved and thank you in advance for any help. Edit: to create the table by the way i'm using a normal table constructor and to add the data to it i'm using a class that fetches the data from the database and returns an Object [], and a for method for this class since it's more than one row. Here is my printing code for a table (i also wrapped the table printable to format the header and footer): final MessageFormat headerFormat = new MessageFormat(builder.toString(), Locale.FRANCE); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(OrientationRequested.LANDSCAPE); aset.add(PrintQuality.HIGH); Bulletin.print(PrintMode.FIT_WIDTH, headerFormat, null, true, aset, true); }catch (PrinterException pe) { String s= "Une erreur est survenue lors de l'impression, vérifier que votre imprimante est connectée \n Si le problème persiste, contacter la personne qui s'occupe de votre système"; JOptionPane.showMessageDialog(Bulletin, s, "Erreur d'impression", 1); } catch(IndexOutOfBoundsException e){ JOptionPane.showMessageDialog(Bulletin, "Aucun bulletin dans la liste. Veuillez au moins ajouter une entrée.\n Pour ajouter une entrée, cliquez sur le menu \"Gére…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37798517
has title: Supporting special characters in printing
has comment: http://stackoverflow.com/comment/37800850
type: Question
has comment: http://stackoverflow.com/comment/37801144
has comment: http://stackoverflow.com/comment/37799578
has comment: http://stackoverflow.com/comment/37800703
tagged with: special-characters
score: 0
has comment: http://stackoverflow.com/comment/37798273
tagged with: printing
has comment: http://stackoverflow.com/comment/37799560
has comment: http://stackoverflow.com/comment/37799214

http://stackoverflow.com/comment/37941090
type: Comment
type: QuestionComment
score: 0
has text: I have tried this "^[a-zA-Z][a-zA-Z0-9]*" But not working
comment on: http://stackoverflow.com/q/24507095

http://stackoverflow.com/q/24563975
has comment: http://stackoverflow.com/comment/38047793
has answer: http://stackoverflow.com/a/24564400
has title: Java: why Array.length has no () but String.length() does?
linked to: http://stackoverflow.com/q/10057524
has body: Why when we get the length of an array don't we have to place () like int [] ar; System.out.println(ar.length); // no parentheses but for a String it will be String st; System.out.println(st.length());
favorite count: 0
has answer: http://stackoverflow.com/a/24564424
type: UnansweredQuestion
answer count: 4
linked to: http://stackoverflow.com/q/23730092
tagged with: java
has answer: http://stackoverflow.com/a/24564559
downvote count: 1
type: Question
score: 9
linked to: http://stackoverflow.com/q/12082196
duplicate of: http://stackoverflow.com/q/12082196
upvote count: 10
has comment: http://stackoverflow.com/comment/38047768
has answer: http://stackoverflow.com/a/24564435

http://stackoverflow.com/q/24535900
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24537653
tagged with: android-listview
has title: Adding a listview to fragment giving error
tagged with: custom-adapter
tagged with: android
possible better answer: http://stackoverflow.com/a/24536343
has body: I am trying to add custom listview to a class which extends fragment. But it is giving error at 4 places. Here is the code: TopStoriesFragment.java public class TopStoriesFragment extends Fragment { public String thehindu = "http://www.thehindu.com/news/?service=rss"; public String toi = "http://timesofindia.feedsportal.com/c/33039/f/533965/index.rss"; public String reuters = "http://feeds.reuters.com/reuters/topNews"; public String deccanherald = "http://www.deccanherald.com/rss-internal/top-stories.rss"; public String currenturl = thehindu; AlertDialog levelDialog; public String fakingnews = "http://thepuntended.wordpress.com/"; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_top_rated, container, false); feedTitle = (TextView) rootView.findViewById(R.id.feedtitle); feedDescribtion = (TextView) rootView.findViewById(R.id.feeddescribtion); startReadRss(); return rootView; } public class RssLoadingTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub displayRss(); } @Override protected void onPreExecute() { // TODO Auto-generated method stub preReadRss(); } @Override protected void onProgressUpdate(Void... values) { // TODO Auto-generated method stub // super.onProgressUpdate(values); } @Override protected Void doInBackground(Void... arg0) { // TODO Auto-generated method stub readRss(); return null; } } private RSSFeed myRssFeed = null; TextView feedTitle; TextView feedDescribtion; // TextView feedPubdate; // TextView feedLink; public class MyCustomAdapter extends ArrayAdapter&lt;RSSItem&gt; { public MyCustomAdapter(Context context, int textViewResourceId, List&lt;RSSItem&gt; list) { super(context, textViewResourceId, list); } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub // return super.getView(positio…
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/24536343
linked to: http://stackoverflow.com/q/24538957
has comment: http://stackoverflow.com/comment/37995588
type: Question
has comment: http://stackoverflow.com/comment/37995105
accepted answer: http://stackoverflow.com/a/24537653
has comment: http://stackoverflow.com/comment/37995848

http://stackoverflow.com/q/24571463
has comment: http://stackoverflow.com/comment/38064460
possible better answer: http://stackoverflow.com/a/24576295
linked to: http://stackoverflow.com/q/1532461
downvote count: 2
has comment: http://stackoverflow.com/comment/38060928
answer count: 3
tagged with: concatenation
linked to: http://stackoverflow.com/q/18453458
has answer: http://stackoverflow.com/a/24576295
linked to: http://stackoverflow.com/q/7817951
has comment: http://stackoverflow.com/comment/38079369
upvote count: 23
tagged with: string
has answer: http://stackoverflow.com/a/24577527
favorite count: 0
has title: When should you explicitly use a StringBuilder?
has comment: http://stackoverflow.com/comment/38067199
accepted answer: http://stackoverflow.com/a/24571563
type: AnsweredQuestion
has body: As I understand it, when I do String baz = "foo" + "bar" + "123" the Java compiler internally replaces the expression with a StringBuilder. However our Java teacher told us that it is good practice to always use a StringBuilder explicitly... Am I correct in assuming I will only need to explicitly use StringBuilder when concatenating inside loops as indicated in an answer to Stack Overflow question String builder vs string concatenation? Are there other cases where you should explicitly use a StringBuilder instead of + or +=?
tagged with: java
linked to: http://stackoverflow.com/q/11942368
duplicate of: http://stackoverflow.com/q/7817951
has answer: http://stackoverflow.com/a/24571563
type: Question
has comment: http://stackoverflow.com/comment/38060931
has comment: http://stackoverflow.com/comment/38067722
tagged with: stringbuilder
has comment: http://stackoverflow.com/comment/38060916
score: 21
duplicate of: http://stackoverflow.com/q/1532461

http://stackoverflow.com/q/24502050
has comment: http://stackoverflow.com/comment/37937767
type: Question
has comment: http://stackoverflow.com/comment/37943310
has title: Declaring variables at the beginning have better performance in java?
answer count: 1
favorite count: 0
has body: Is there any differences in performance between declaring variables at the beginning of code and declaring them when I need them (outside of readability arguments)? Suppose I have the following two options: Option1: public void methodA () { int amount; long id; String name; //do something } Option2: public void methodB () { int amount; //do something long id; //do something String name; //do something } In my opinion, option 2 is more aesthetic and readable and thus is my preference. Q: But I am just wondering if there exist any differences in performance related to the location of those declarations. Edit: Thanks to the input of maaartinus, I found that my benchmark examples were wrong (now deleted) and I am looking further into how to write/use benchmark code.
upvote count: 3
score: 0
has answer: http://stackoverflow.com/a/24502083
downvote count: 3
duplicate of: http://stackoverflow.com/q/8803674
linked to: http://stackoverflow.com/q/504103
has comment: http://stackoverflow.com/comment/37932198
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37944705
has comment: http://stackoverflow.com/comment/37937303
tagged with: performance
has comment: http://stackoverflow.com/comment/37943775
linked to: http://stackoverflow.com/q/8803674
tagged with: java
has comment: http://stackoverflow.com/comment/37942427

http://stackoverflow.com/q/24558019
has answer: http://stackoverflow.com/a/24558258
has comment: http://stackoverflow.com/comment/38035703
has comment: http://stackoverflow.com/comment/38035684
has title: String[] Constant Sorts Automatically? How do I keep index order?
favorite count: 0
has comment: http://stackoverflow.com/comment/38035727
has comment: http://stackoverflow.com/comment/38038286
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38038924
has comment: http://stackoverflow.com/comment/38038427
has body: I have String[] of delimiters private static final String[] LEFT_DELIMITER = { "PUT", "CALL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; When I loop through this String[] with a good old for loop the entry at index 0 is JAN and not PUT. However, if I declare the String[] within the method where I am using it String[] delim = { "PUT", "CALL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; The result at index 0 is PUT as expected. Why does one sort by calendar month and the other does not? All I want is for the array to maintain items where I put them. Is there a way to do that as a constant?
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/38035824
has comment: http://stackoverflow.com/comment/38035725
has comment: http://stackoverflow.com/comment/38035699
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/38035715
has comment: http://stackoverflow.com/comment/38036068
answer count: 1

http://stackoverflow.com/q/24583782
has answer: http://stackoverflow.com/a/24583818
has answer: http://stackoverflow.com/a/24584879
has answer: http://stackoverflow.com/a/24584028
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24583854
favorite count: 0
answer count: 9
has body: Can anyone help me to get rid of this Exception? "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10" import java.util.*; public class AscendingOrder { public static void main(String[] args) { int i, j, temp; int a[] = { 10, 5, 7, 98, 45, 34, 38, 56, 34, 93 }; for (i = 0; i &lt; a.length; i++) { for (j = i + 1; j &lt; a.length - 1; j++) { if (a[i] &gt; a[j]) { temp = a[i]; a[i] = a[j]; a[j] = temp; i++; } } } System.out.println(a[i]); } }
tagged with: windows
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24583852
has answer: http://stackoverflow.com/a/24583813
type: Question
has answer: http://stackoverflow.com/a/24583812
has answer: http://stackoverflow.com/a/24583799
has answer: http://stackoverflow.com/a/24583821

http://stackoverflow.com/comment/39724984
type: Comment
score: 0
has text: One problem is that your code adds an atomic increment (which in practice is a CAS-loop) to both the `put()` and `take()` paths. For uncontended scenarios this is going to be slower than the simpler single lock approach, and uncontended scenarios are important. For contended scenarios which would be faster would depend on the exact details of your use.
comment on: http://stackoverflow.com/a/24874433
type: AnswerComment

http://stackoverflow.com/q/24570558
has answer: http://stackoverflow.com/a/25016784
has comment: http://stackoverflow.com/comment/38177227
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/38147405
has comment: http://stackoverflow.com/comment/38137267
has comment: http://stackoverflow.com/comment/38179094
tagged with: jira
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/38175746
has answer: http://stackoverflow.com/a/24735808
has answer: http://stackoverflow.com/a/24633906
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/38137032
has title: Workflow for interim codings
has comment: http://stackoverflow.com/comment/38135224
favorite count: 0
has body: If in two components(Foo and Bar) of a software is a method signature change in Foo, we use @deprecated to blame the old method and keep compatibility between Foo and Bar. The Problem: The XML-Configuration as well as CSS,HTML,JSP ... has no such a Annotation, actually we use TODO in Eclipse as a Marker. The Probem is that its part of the Code we distribute! The Workaround: In JIRA(+svn-plugin) we blame the code-lines as comments (what is bad practice too). The Question: Is there a better Solution? Is there a Solution that can manage the impulse to delete this compatibility-only-code.
has comment: http://stackoverflow.com/comment/38181691
has comment: http://stackoverflow.com/comment/38168531
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
upvote count: 4
tagged with: css
has comment: http://stackoverflow.com/comment/38350651

http://stackoverflow.com/a/24487497
answers question: http://stackoverflow.com/q/24485594
has body: A private pool of string literals is maintained by String class. All literal strings and string-valued constant expressions are added to this pool during program start up. So all string literals with same value will point to same object. When a new string object is created(e.g. by concatenating two string objects) it does not belong to the String pool, so comparing it with another string literal will return false. Any string object can be added to String pool by invoking intern() method on that string object, now the object will point to a string literal from the pool which have same value as this object. Now any string comparison of this object with same string literal will yield true.
score: 0
type: Answer

http://stackoverflow.com/a/24501410
accepted answer of: http://stackoverflow.com/q/24501395
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: That kind of ambiguity is resolved at the caller side by using casts. In this case, you'd cast the array to (Object) first, to have it be treated as a varargs argument. e.g., to pass the array as one argument: callLater(myObj, "myMeth", (Object) new String[] {"A", "B"}); To pass two arguments: callLater(myObj, "myMeth", (Object[]) new String[] {"A", "B"}); or simply: callLater(myObj, "myMeth", "A", "B");
score: 1
has comment: http://stackoverflow.com/comment/37930934
upvote count: 1
has comment: http://stackoverflow.com/comment/37930929
answers question: http://stackoverflow.com/q/24501395
has comment: http://stackoverflow.com/comment/37930906
has comment: http://stackoverflow.com/comment/37930894

http://stackoverflow.com/a/24477581
has comment: http://stackoverflow.com/comment/37886767
score: 0
has body: As the package name is sumOfFloats i have assumed that you have a folder by the sumOfFloats in which your class file resides just place the floatNumbers.txt in that folder and try to recompile it and then execute the class
type: Answer
answers question: http://stackoverflow.com/q/24477376

http://stackoverflow.com/q/24428077
has title: How to copy method from class file in java application
has comment: http://stackoverflow.com/comment/38028972
score: 0
type: UnansweredQuestion
tagged with: jakarta-ee
has body: I am writing framework which required to store methods in database. The thing is I have written all the method in java file, now I have UI where user will select the method and when user click on save button, system needs to copy selected method from java file and save in database, the reason doing this is when running application system will call id which will be mapped with stored method in database and will execute that method to achieve goal. Is this possible? and how to copy method from java class file and store in db? Is there any other suggestion or input will be more appreciated. Thanks,
has comment: http://stackoverflow.com/comment/37795331
tagged with: java
has answer: http://stackoverflow.com/a/24428320
has comment: http://stackoverflow.com/comment/37795072
type: Question
linked to: http://stackoverflow.com/q/2946279
answer count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/38029957
has comment: http://stackoverflow.com/comment/37797571
has comment: http://stackoverflow.com/comment/37794368

http://stackoverflow.com/comment/37852885
type: Comment
type: QuestionComment
has text: Making sure ```download()``` actually triggers a download will definitely reveal your problem; it just takes some work to dig into. You tested this with a known good torrent, right? Something like a Linux distro?
comment on: http://stackoverflow.com/q/24458854
score: 0

http://stackoverflow.com/comment/38060115
has text: @Mena Yes I suppose I can easily pass it into org.json's JSONObject constructor, I should get a JSONObject out of it. I can then easily change the value of a name I want. But as I said I need to send this type of string WITH backslashes again to server, so I would have to use toString method of the JSONObject, but again it won't have the slashes. I can try replacing all " with \" but this will replace the " in values as well, which will lead to undesired results.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24570807

http://stackoverflow.com/comment/38038562
type: Comment
has text: Some of the Eclipse packages *do* come with Window Builder installed. For Luna (the latest release as 2014), The "Eclipse IDE for Java Developers" package and the "Eclipse for RCP and RAP Developers" packages already include WindowBuilder.
score: 1
comment on: http://stackoverflow.com/a/24557893
type: AnswerComment

http://stackoverflow.com/a/24434227
type: Answer
has comment: http://stackoverflow.com/comment/37857874
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24433985
score: 1
answers question: http://stackoverflow.com/q/24433985
has comment: http://stackoverflow.com/comment/37846461
has body: You can create a custom checked exception as follows: class ArrayModificationException extends Exception{ public ArrayModificationException(String message){ super(message); } } now in your "myMethod" add following: void myMethod() throws ArrayModificationException{ //code to check conditions before modifications //code to modify an array if(check fails){ throw new ArrayModificationException("cusom message"); } } where custom message would be specific message conveying the exact reason of failure. Of course the called will decide if to handle it or re-throw it. If this is one of conditions where your code should not try to recover itself you can design this as run-time exception and just throw it without throws clause for your method
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37846391

http://stackoverflow.com/comment/37997248
comment on: http://stackoverflow.com/a/24536666
type: AnswerComment
score: 0
has text: ok guys thank you for your time and for your expanations!
type: Comment

http://stackoverflow.com/comment/37852497
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24459327
has text: remove `android:background="@null"` from your layout
type: AnswerComment

http://stackoverflow.com/q/24503202
score: 0
answer count: 1
has title: What is difference between eclipse compare API?
tagged with: compare
accepted answer: http://stackoverflow.com/a/24504338
type: AnsweredQuestion
type: Question
tagged with: emf
has body: I have to create own eclipse compare editor, so I can see difference between models as I want. (Need to create customize compare editor UI.) While surfing on internet I found two different API. org.eclipse.emf.compare and org.eclipse.compare. What is difference between these two API? Which should I use to create own compare editor?
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/24504338

http://stackoverflow.com/q/24449591
answer count: 3
has comment: http://stackoverflow.com/comment/37833705
has comment: http://stackoverflow.com/comment/37833812
favorite count: 0
linked to: http://stackoverflow.com/q/7386372
has comment: http://stackoverflow.com/comment/37833731
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/37833710
tagged with: java
has answer: http://stackoverflow.com/a/24451180
has title: ArrayIndexOutOfBounds Exception for program compiled using Java
type: Question
has body: I am new to java. My code is: public class Hi { public static void main(String[] args) { System.out.print("Hi, "); System.out.print(args[2]); System.out.print(","); System.out.print(args[1]); System.out.print(", and"); System.out.print(args[0]); System.out.println("."); } } I get the following exception upon running this program: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at Hi.main(Hi.java:5) I would be glad to know why I had got this exception and how to resolve it.
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/24449969
has comment: http://stackoverflow.com/comment/37833845
has comment: http://stackoverflow.com/comment/37833816
has answer: http://stackoverflow.com/a/24449901

http://stackoverflow.com/comment/37996172
comment on: http://stackoverflow.com/q/24499042
type: Comment
type: QuestionComment
has text: @JanEglinger the error is that CheckBoxListRenderer cannot be resolved to a type. So I built the class and it displays the checkboxes but not the images. I can't seem to figure out how to display the images alongside with the checkboxes.
score: 0

http://stackoverflow.com/a/24556005
has comment: http://stackoverflow.com/comment/38032058
answers question: http://stackoverflow.com/q/24555845
score: 0
has body: Most likly XML-based bean-definition. Look for XML in your classpath that define beans. And read the docu. XML-config is very well documented. PS: Do not use ApplicationContext.getBean(...) when ever possible...
type: Answer

http://stackoverflow.com/a/24542839
answers question: http://stackoverflow.com/q/24520640
has comment: http://stackoverflow.com/comment/38044684
has comment: http://stackoverflow.com/comment/38009439
has comment: http://stackoverflow.com/comment/38042290
has comment: http://stackoverflow.com/comment/38042561
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/38042096
has comment: http://stackoverflow.com/comment/38045376
has comment: http://stackoverflow.com/comment/38045288
has body: Something like this ? public class Passing_Objects { public void main(String[] args) { int a = 5; double b = 10; Extra extra = new Extra(a, b); System.out.println("A = " + extra.getA() + ", B = " + extra.getB()); } class Extra { public int a; public double b; public Extra(int a, double b) { this.a= a; this.b= b; } public int getA(){ return a; } public double getB(){ return b; } } } Edit : To alter the values after a first initialization, you need setters. Something like these two methods in your Extra class. public void setA(int a){ this.a = a; } public void setB(double b){ this.b = b; } then in your Passing-Objects class, you can set new values by invoking the setter methods. extra.setA(20); extra.setB(20d); Hope it helps.
has comment: http://stackoverflow.com/comment/38042370
upvote count: 1
has comment: http://stackoverflow.com/comment/38043314
has comment: http://stackoverflow.com/comment/38045423
has comment: http://stackoverflow.com/comment/38044845
has comment: http://stackoverflow.com/comment/38008280
type: Answer
has comment: http://stackoverflow.com/comment/38042796

http://stackoverflow.com/q/24492795
tagged with: selenium
score: 6
upvote count: 7
downvote count: 1
has body: How to enter characters one by one in to a text field in selenium webdriver? I have used the below code but it's not working getDriver().findElement(By.id("PhoneNumber")).sendKeys(Keys.chord("9876544322")); Can anybody suggest how to resolve this?
has comment: http://stackoverflow.com/comment/37915287
tagged with: java
has answer: http://stackoverflow.com/a/35716782
type: Question
has answer: http://stackoverflow.com/a/67611469
has title: How to enter characters one by one in to a text field in selenium webdriver?
has answer: http://stackoverflow.com/a/52221612
has answer: http://stackoverflow.com/a/24522875
answer count: 7
has answer: http://stackoverflow.com/a/54879778
has answer: http://stackoverflow.com/a/71708728
favorite count: 0
tagged with: selenium-webdriver
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/78249952
has answer: http://stackoverflow.com/a/24493029

http://stackoverflow.com/comment/37940364
comment on: http://stackoverflow.com/q/24505532
score: 0
type: Comment
has text: @geoand do I also need in my `java -cp C:/user/hsqldb-2.3.2/hsqldb-2.3.2/hsqldb/lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing -user sa -url jdbc:hsqldb:database/testDB` double `--` ?
type: QuestionComment

http://stackoverflow.com/comment/38072854
type: Comment
has text: Actually java 7 does not support it but as you said java 8 does thanx mate for letting me know.I'm updating it
comment on: http://stackoverflow.com/a/24577570
type: AnswerComment
score: 0

http://stackoverflow.com/a/24530343
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: It seems to me like you do not have understood the concept of the SharedPreferences and key/value pairs in general. SharedPreferences can be used to store a value, associated with a key of free choice. Example: String key = "key"; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Context); Editor e = prefs.edit(); e.putString(key, "stringtosave"); e.commit(); This means, that the value "stringtosave" is now stored in the SharedPreferences, associated with the key "key". When retrieving the value, you need to provide the key again. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Context); String retrieved = prefs.getString(key); // retrieved will then contain "stringtosave" What you are doing in your Toast message is showing the keys associated with the values you saved. Those keys will never change and obviously always have the same value. If you want to show the actual saved value in the Toast message, you need to retrieve it from the SharedPreferences or use the value that you just stored (e.g. "num1String").
answers question: http://stackoverflow.com/q/24530164

http://stackoverflow.com/q/24473260
has answer: http://stackoverflow.com/a/24473283
has answer: http://stackoverflow.com/a/24473595
accepted answer: http://stackoverflow.com/a/24473287
has answer: http://stackoverflow.com/a/24473363
has title: Separating the interface from an implementation in Java
downvote count: 2
has comment: http://stackoverflow.com/comment/37878205
has answer: http://stackoverflow.com/a/24473287
has comment: http://stackoverflow.com/comment/37878221
has answer: http://stackoverflow.com/a/24473281
favorite count: 0
answer count: 5
has body: How can you separate the interface from an implementation in Java? In C/C++, this can be done by creating 2 files a .c and .h file with the same file name. How can you do this in Java?
possible better answer: http://stackoverflow.com/a/24473281
upvote count: 4
score: 2
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/24582655
has body: Ideally, X and Y would be separated into two objects with IDs. If it is at all possible to restructure your JSON or Java object to better fit your needs you would be following best practice and your code would be easier to follow--I understand that's not always an option. One thing you can do is create a custom class that mimics the structure of the objects inside of your array. Then you can annotate a constructor and pass in a list of this custom object. Something like this: public class A { private Map&lt;String, String&gt; x; private Map&lt;String, String&gt; y; @JsonCreator public A(@JsonProperty("root") List&lt;Entity&gt; entities) { for (Entity entity : entities) { x.put(entity.getId, entity.getX()); y.put(entity.getId, entity.getY()); } } public static class Entity { private String id; private String x; private String y; public String getId() { return id; } public String setId(String id) { this.id = id; } public String getX() { return x; } public String setX(String x) { this.x = x; } public String getY() { return y; } public String setY(String y) { this.y = y; } } } I'm not sure what you mean by "deserialize in one line". If your looking for an easier alternative, the only other thing that could satisfy your requirements is a custom deserializer, which is more complicated.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24566653
type: Answer
score: 1

http://stackoverflow.com/a/24584028
has body: Hey As per your code when you try to print System.out.println(a[i]); it will throw exception. You should focus on value of i. When your loop is terminate the value of i = Length of array + 1. So i recommend you should print System.out.println(a[i-1]); You can learn more about exception handling from here http://java2all.com/technology/core-java/exception-handling/introduction and learn about thread from here http://java2all.com/technology/core-java/multithreading
score: -1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24583782
upvote count: 0

http://stackoverflow.com/comment/38015085
type: Comment
score: 0
type: AnswerComment
has text: It *is* possible, no question about it. I don't know of any server that does it, but I can imagine a Tomcat valve that does it in association with a custom HTTPS connector, or access to its KeyManager somehow. I don't see why the client would object, as long as both certificates passed hostname verification at the HTTPS level. SSL certainly wouldn't care as long as both certificates were trusted. @Bruno You would need such functionality if you were an ISP and wanted to provide a Tomcat with multi-hosting.
comment on: http://stackoverflow.com/a/24538227

http://stackoverflow.com/q/24495611
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24496047
has comment: http://stackoverflow.com/comment/37922565
tagged with: css
has comment: http://stackoverflow.com/comment/37920560
type: UnansweredQuestion
tagged with: java
tagged with: tomcat7
has title: Debugging a very difficult-to-reproduce Java web app issue (frontend)
type: Question
tagged with: nginx
tagged with: internet-explorer-11
has body: I have a Java web app that deploys as a WAR to Tomcat 7.0.41 (myapp.war). I noticed that when I deploy the WAR to a Tomcat that lives in one part of our network, the web pages display perfectly fine. However, and this only happens in IE 11, if I take the exact same WAR and deploy it to the exact same version/Chef-configured-instance of a Tomcat server that lives in another part of our network, the page stylings look way different and completely wrong. Again, this is specific to IE11 and the location in the network that the app is served from. If I go to the app in IE 11 from a "good" location on the network, the frontend renders perfectly fine. Or if I view the app from a "bad" location on the network, but in a non-IE browser, again all is well. I have a feeling that we might have some IT proxy (nginx, etc.) that is preventing Tomcat from serving certain CSS/JS files, and so the end result is a partially-complete frontend that looks all wonky in the browser. And somehow, this only crops up in IE 11. I have (sort of) confirmed this by viewing the source of all my HTML, JS and CSS files and copying them to files in a local folder. I then open up one of the HTML files (locally) in a browser and the site displays perfectly. The problem here is that my JS files use a bunch of open source JS libraries. And those libraries have dependencies on other libraries. So on and so forth, and the dependency graph is pretty huge. It's tough for me to tell which files are not being downloaded properly/completely. Here's the kicker: if I add in html5shiv to my app then the problem goes away entirely, no matter which browser (IE or not) or what location in the network I choose. However adding html5shiv breaks other things in my app, and for reasons outside the context of this question, can't be used. Anyone have any idea how I could troubleshoot/fix this? Why would this only be affecting IE 11 and not other browsers? Why is html5shiv solving this?!?

http://stackoverflow.com/q/24519998
has comment: http://stackoverflow.com/comment/37970495
tagged with: imageview
has comment: http://stackoverflow.com/comment/37964730
score: 0
has body: I just started with Android and thought it would be easy to create a new class of an image which I will later move around and so on, just playing with Android basically. Well, it seems its not as easy as expected. I get a NPE: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageResource(int)' on a null object reference xml layout &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#0099cc" tools:context=".Start"&gt; &lt;!-- The primary full-screen view. This can be replaced with whatever view is needed to present your content, e.g. VideoView, SurfaceView, TextureView, etc. --&gt; &lt;!-- This FrameLayout insets its children based on system windows using android:fitsSystemWindows. --&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_gravity="center" /&gt; &lt;/FrameLayout&gt; Main activity package com.andreiv.snake; import com.andreiv.snake.util.Picture; import com.andreiv.snake.util.SystemUiHider; import android.annotation.TargetApi; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; import android.widget.ImageView; public class Start extends Activity { ImageView img; Picture pic; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); img = (ImageView)findViewById(R.id.imageView); pic = new Picture(img.getContext()); pic.drawPic(); setContentView(R.layout.activity_start); } } Picture class package com.andreiv.snake.util; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.ImageView; import com.andreiv.snake.R; /** * Created by andrei on 7/2/2014. */ public…
has answer: http://stackoverflow.com/a/24520451
answer count: 1
has comment: http://stackoverflow.com/comment/37965368
tagged with: android
type: AnsweredQuestion
has title: Android: What is wrong with my custom ImageView inherritance?
accepted answer: http://stackoverflow.com/a/24520451
tagged with: java
type: Question

http://stackoverflow.com/q/24484406
score: 6
type: Question
tagged with: java
has title: I have a header.jsp whose style keeps changing for different logins its a dynamic header
answer count: 2
has answer: http://stackoverflow.com/a/33183111
downvote count: 0
tagged with: jsp
has body: For example if admin logs in i need 2 tabs in header , and if a user logs in i need 1 tab. How to proceed with this? I have included and i want to know the javascript for this to work.
tagged with: javascript
favorite count: 0
upvote count: 6
has answer: http://stackoverflow.com/a/29341553
tagged with: dynamic
type: UnansweredQuestion

http://stackoverflow.com/comment/37856256
type: QuestionComment
score: 0
has text: Your question is IMHO just too broad. And now for something completely different: Why not map the player position to the image and check if it is above ground?
comment on: http://stackoverflow.com/q/24439040
type: Comment

http://stackoverflow.com/q/24483727
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37898317
has comment: http://stackoverflow.com/comment/104206476
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/24483901
type: Question
tagged with: mongodb
upvote count: 20
linked to: http://stackoverflow.com/q/3778428
accepted answer: http://stackoverflow.com/a/24483901
has comment: http://stackoverflow.com/comment/37898536
has answer: http://stackoverflow.com/a/72505666
linked to: http://stackoverflow.com/q/10771439
score: 20
has answer: http://stackoverflow.com/a/36180850
has answer: http://stackoverflow.com/a/24483765
downvote count: 0
has comment: http://stackoverflow.com/comment/37898782
favorite count: 0
possible better answer: http://stackoverflow.com/a/36180850
has body: We are trying to insert a document with the current date as it's field. We are writing in java using eclipse plugin for mongodb. We want to execute the Date() command of mongo to get the date from mongo and not from java. How can I execute this mongo query? db.example.insert({"date":new Date()}) I found this question in a previews question but the answer was not helpful Link
has title: How to insert a document with date in mongo?
answer count: 4
tagged with: mongodb-query

http://stackoverflow.com/a/24496661
answers question: http://stackoverflow.com/q/24495916
type: Answer
score: 1
upvote count: 1
has body: I think it may be that your USB device and your program are not sync, and I think of this causes: No initial sync, you're assuming you are in sync. I/O operations take much time (relative to miliseconds). Solutions: Do not write any file until you've ended the process, this will save you time, and as I see, time is an issue. Parse the data to completely delete all corrupted data, or assume it is the arithmetic mean between the last and next valid data (all of this should run after the data gathering). I don't know how you could sync the device, try making it wait until some data is recived.
downvote count: 0
has comment: http://stackoverflow.com/comment/37951192
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24495916

http://stackoverflow.com/comment/37795520
has text: @Namalak: Do you know the size of the list ahead of time? If so, you can just skip the list and insert directly into the array.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24428810

http://stackoverflow.com/comment/37799368
type: Comment
comment on: http://stackoverflow.com/a/24430425
score: 0
type: AnswerComment
has text: Sorry my bad, both your changes actually worked. there was a small typo in config

http://stackoverflow.com/comment/37936216
has text: There is nothing special about a class being `private static` You get an NPE just because you dereferenced a `null` just like anywhere else in your code. I suggest you break point this code and check it out in your debugger.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24504385

inode
tags question: http://stackoverflow.com/q/24509361
tag name: inode
type: Tag

http://stackoverflow.com/comment/38068899
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24575780
has text: I think you don't think you need to save orders explicitly, hibernate will do it for you when you save the customer.
score: 0

http://stackoverflow.com/a/24681049
upvote count: 11
type: AcceptedAnswer
has body: Apple removed the file under OS X 10.10 (Yosemite). Unfortunately the path to the file is hard coded within the GlassFish startup code (GFLauncher.java) and not configurable. The GlassFish team is already aware of the issue: https://java.net/jira/browse/GLASSFISH-21113 I hope there will be a fix for GlassFish 3 as well, since we still use it in production. GFLauncher Code: http://grepcode.com/file/repo1.maven.org/maven2/org.glassfish.admin/launcher/3.1.1/com/sun/enterprise/admin/launcher/GFLauncher.java?av=f
has comment: http://stackoverflow.com/comment/39839865
accepted answer of: http://stackoverflow.com/q/24509103
type: Answer
answers question: http://stackoverflow.com/q/24509103
downvote count: 0
has comment: http://stackoverflow.com/comment/41766740
score: 11
has comment: http://stackoverflow.com/comment/41513302

http://stackoverflow.com/a/24528740
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24528597
downvote count: 0
score: 1
has body: While querying the database you used: SELECT first_name, surname, home_number, cell_number, email FROM Contact WHERE id = ? but from the resultset you are expecting id contact.setId(resultSet.getInt("id")); hence the error change the query to: SELECT id, first_name, surname, home_number, cell_number, email FROM Contact WHERE id = ?

http://stackoverflow.com/comment/38007041
comment on: http://stackoverflow.com/q/24542171
score: 0
type: Comment
type: QuestionComment
has text: So like, a C++ "pointer" that points to that object in the heap?

http://stackoverflow.com/q/24577069
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24577674
accepted answer: http://stackoverflow.com/a/24577674
type: AnsweredQuestion
score: 2
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/38071201
upvote count: 2
tagged with: java
tagged with: swing
type: Question
has body: This is probably a dumb question, but I can't figure out how to fix it. I want all my JoptionPanes to be resizable, so I am imbedding them in JDialog. I will have to convert all my showXxxDialog calls eventually, so I decided to start with showInputDialog. Everything works (the Dialog looks nice, and is resizable), except that it won't display the initial value in the JOptionPane display, even though it is correct in the JOptionPane constructor. Here is my code (messageType is PLAIN_MESSAGE, but QUESTION_MESSAGE does the same): public class MyOptionPane { static Object showInputDialog(Object f, Object message, String title, int messageType, Icon ico, Object[] options, Object initValue) { JOptionPane pane = new JOptionPane(message, messageType, JOptionPane.OK_CANCEL_OPTION, ico, options, initValue); JDialog dialog = pane.createDialog((Component) f, title); if (!dialog.isResizable()) { dialog.setResizable(true); } pane.setWantsInput(true); dialog.pack(); dialog.setVisible(true); return pane.getInputValue(); } } Help would be much appreciated!
has title: Can't display intiali value in JoptionPane within JDialog

http://stackoverflow.com/a/24491372
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24491184
has body: You could try Apache Poi or docx4j which can create and manipulate MS Office documents, including OOXML (like DOCX).
has comment: http://stackoverflow.com/comment/37931407
score: 1
has comment: http://stackoverflow.com/comment/37931474

http://stackoverflow.com/q/24492366
has comment: http://stackoverflow.com/comment/38130297
has comment: http://stackoverflow.com/comment/38109767
downvote count: 2
has comment: http://stackoverflow.com/comment/38132635
answer count: 1
has comment: http://stackoverflow.com/comment/38129612
has title: display certificate content from db
type: UnansweredQuestion
has body: I made some changes on my previous code and made a little bit of progress but still have some issues with the variables. Here is part of my changes: &lt;%@ page import="java.io.*%&gt; &lt;%@ page import="java.sql.*%&gt; &lt;%@ page import="javax.security.cert.X509Certificate"%&gt; String qrycert = "select convert((hex(cert)) using ascii) as cert from table where record_id=1"; ResultSet rs = sqlstatement.executeQuery(qrycert); while (rs.next()) { byte[] certs = rs.getBytes("cert"); String cert = X509Certificate.getInstance(certs).toString(); //doesn't like this line } Comments are welcome! ================== Made new changes and got new error ============ &lt;% Statement sqlStatement = conn.createStatement(); String qrycerts = "select convert((hex(certificate)) using ascii) as certificate from dbtable where record_id=1"; ResultSet rs = sqlStatement.executeQuery(qrycerts); while (rs.next()) { byte[] certEntryBytes = rs.getBytes("certificate"); InputStream in = new ByteArrayInputStream(certEntryBytes); CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate certs = (X509Certificate)certFactory.generateCertificate(in); } %> ===================== Error =========================== HTTP Status 500 - type Exception report message 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 test.jsp at line 40 40: X509Certificate certs = (X509Certificate)certFactory.generateCertificate(in); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510 ) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.servlet.ServletException: java.…
has answer: http://stackoverflow.com/a/24617394
upvote count: 0
tagged with: java
tagged with: mysql
favorite count: 0
has comment: http://stackoverflow.com/comment/38124148
type: Question
score: -2

http://stackoverflow.com/q/24496034
type: Question
tagged with: spring
accepted answer: http://stackoverflow.com/a/24496061
has title: Spring Di via setter dynamic constructor parameters
has body: I'm beginner with spring framework, and I'm following this tutorial to applicate DI via setter. All works fine, but I'd like add to my class CsvOutputGenerator a constructor with one dynamic parameter, passed on the fly while I getting bean from Application context. How can I do that? I've already change my spring configuration in this way: ... &lt;bean id="CsvOutputGenerator" class="com.mkyong.output.impl.CsvOutputGenerator"&gt; &lt;constructor-arg type="java.lang.String" value="Test"/&gt; &lt;/bean&gt; ... but in this way is static value for my constructor.
has answer: http://stackoverflow.com/a/24496298
score: 0
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/24496298
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/24496061
has answer: http://stackoverflow.com/a/24497273
type: AnsweredQuestion

http://stackoverflow.com/comment/37845926
comment on: http://stackoverflow.com/q/24455263
score: 0
has text: What do you mean when you say are sent null? Are some messages received have payload null?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38943430
type: AnswerComment
has text: Thanks, as for new, today I already saw the answer and because I don't want to wait for the next release, I'm actually setting up Maven :) I will then try your converter and let you know
type: Comment
comment on: http://stackoverflow.com/a/24940970
score: 0

http://stackoverflow.com/comment/38079044
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24580927
type: QuestionComment
has text: @RetoKoradi Well, 0 "i"s removed is just the source word. That should be as easy as hypo[0] = word (or better, hypo.add(word)).

http://stackoverflow.com/comment/37801391
type: QuestionComment
comment on: http://stackoverflow.com/q/24431901
has text: Plz Put the code Which u have tried till now...:)so that we can get a Hint..
score: 0
type: Comment

http://stackoverflow.com/comment/58193610
has text: Very useful, thanks. There is a bug with the margins though - it should read: "int x = getWidth() - widthPerLevel - 2*margin;" (where margin then needs to be globalised).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24454396
score: 1

http://stackoverflow.com/comment/37837266
score: 0
has text: problem is with your constructor man.just call a single constructor with current parameters.
comment on: http://stackoverflow.com/q/24451207
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88835860
type: AnswerComment
has text: Edited my response and added the sample code. In case you are wondering, for my app I don't enumerate all properties there, just check the critical ones. But the Environment you receive in the Banner is a ConfigurableEnvironment, so you can iterate over getPropertySources() and enumerate from the sources that implement EnumerablePropertySource.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/47513769

http://stackoverflow.com/q/24484900
has comment: http://stackoverflow.com/comment/37900948
tagged with: workspace
type: UnansweredQuestion
tagged with: path
has title: How to get eclipse workspace path
has answer: http://stackoverflow.com/a/24485122
has answer: http://stackoverflow.com/a/24485066
tagged with: java
has body: I'm trying to get the workspace path of my eclipse.The result I want is D:\MyWorkspace. I have searched a lot and found this. ResourcesPlugin.getWorkspace().getRoot().getLocation().toString() But it returns the following. D:/runtime-EclipseApplication Any help?
tagged with: eclipse
type: Question
answer count: 2
score: 0

http://stackoverflow.com/comment/37977587
score: 0
type: QuestionComment
has text: Yep, HashMap isn't sorted. From the [javadocs](http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html): `This class makes no guarantees as to the order of the map;` You'll need to be more clear what you mean or your question will likely be closed
type: Comment
comment on: http://stackoverflow.com/q/24527022

http://stackoverflow.com/a/24433013
score: 0
has comment: http://stackoverflow.com/comment/37807884
accepted answer of: http://stackoverflow.com/q/24432568
answers question: http://stackoverflow.com/q/24432568
type: Answer
has comment: http://stackoverflow.com/comment/37807550
has body: The Logic Could Be: Install Script Wait 5 seconds Run the appInstalledOrNot function If not installed, then try again in 1 second Here could be the code: public void installApp(){ File mFile = new File(Uri.parse(downloadedPackageUriString).getPath()); Intent promptInstall = new Intent(Intent.ACTION_VIEW) .setDataAndType(Uri.fromFile(mFile), "application/vnd.android.package-archive") .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); appContext.startActivity(promptInstall); Thread t = new Thread(){ public void run(){ boolean installed = checkInstalled("vnd.android.package-archive"); while(!installed) { System.out.println("Not Installed Yet..Waiting 1 Second"); t.sleep(1000); } //Now it has been installed if(installed) { //This intent will help you to launch if the package is already installed Intent LaunchIntent = getPackageManager() .getLaunchIntentForPackage("com.Ch.Example.pack"); startActivity(LaunchIntent); System.out.println("App already installed on your phone"); } else { System.out.println("App is not installed on your phone"); } } t.start(); } private boolean checkInstalled(String uri) { PackageManager pm = getPackageManager(); boolean app_installed = false; try { pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); app_installed = true; } catch (PackageManager.NameNotFoundException e) { app_installed = false; } return app_installed ; } Code based on: How to check programmatically if an application is installed or not in Android?
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37807322

http://stackoverflow.com/a/24604587
score: 0
has comment: http://stackoverflow.com/comment/38180011
type: Answer
has body: I don't konw if it exactly meets your need, but have a look at webstart's Version Download Protocol. To sum it up: With versioned download you can specify each jar-version to be used in the jnlp-file like this: &lt;jar href="jackson-core.jar" version="2.0.2" /&gt; and deploy your jar-file on the server with a filename of jackson-core__V2.0.2.jar. With this protocol webstart will only use jar-files whose version exactly matches the given version from the jnlp-file. Another advantage is, that when the specified version is already present in the local cache webstart will not try to download the version again - regardless of timestamps etc. Advantages: Full control over versions used via jnlp-file. Less download-requests for jars present in cache Disadvantages: New versions require a change in the jnlp-file Not suitable for SNAPSHOT-builds since the file's timestamp is completely ignored and version-numbers don't change for SNAPSHOT-builds.
answers question: http://stackoverflow.com/q/24575403

http://stackoverflow.com/a/24558795
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24558549
has body: You could write a simple app such as import java.util.Random; //This is for flipping the "coin" public class coins{ private static Random random=new Random(); //This is the coin private int amountOfHead=0; //This is the int for amount of heads flipped private int amountOfTails=0; //This is the int for the amount of tails flipped private static int a1; //This is also the coin public void flip(){ a1=random.nextInt(1); //This "flips the coin" making it a 1 or 0 if(a1==0){ amountOfTails+=1; //If the "coin" is 0 tails increases by 1 }else{ amountOfHeads+=1; //If anything else happens(such as a 1) heads increases by 1 } System.out.println(amountOfHeads+", "+amountOfTails) //This prints the results out } } To run this program you just call flip().
type: Answer
score: 1

http://stackoverflow.com/q/24583521
has answer: http://stackoverflow.com/a/24583597
has title: Instantiate a priority queue with a comparator from spring
tagged with: comparator
score: 2
accepted answer: http://stackoverflow.com/a/24583597
answer count: 1
downvote count: 0
favorite count: 0
tagged with: priority-queue
tagged with: spring
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: As part of learning spring, I'm trying to declare a priority queue bean of MyMessageObject objects, but keep getting the following BeanCreationException: "Error creating bean with name 'messagesHeap' defined in URL [file:/my.app.spring.xml]: Could not resolve matching constructor" Here's my spring definitions: &lt;bean id="messagesHeap" class="java.util.PriorityQueue"&gt; &lt;constructor-arg type="int" name="initialCapacity" value="100" index="0"/&gt; &lt;constructor-arg name="comparator" type="java.util.Comparator" index="1" ref="orderComparator"/&gt; &lt;/bean&gt; &lt;bean id="orderComparator" class="com.my.myComparator"/&gt; The class myComparator implements java.util.Comparator as required. What am I doing wrong here?
type: Question

http://stackoverflow.com/q/24505482
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/37938087
tagged with: swing
has comment: http://stackoverflow.com/comment/37938242
tagged with: java
possible better answer: http://stackoverflow.com/a/24505595
has answer: http://stackoverflow.com/a/24505992
has body: I am new to the topic of GridBagLayout and I am unable to understand what is the exact difference between the constraints weight and fill. Can I fill without assigning weight. Unless you specify at least one non-zero value for weightx or weighty, all the components clump together in the center of their container. This is because when the weight is 0.0 (the default), the GridBagLayout puts any extra space between its grid of cells and the edges of the container. My question is that, if this is true then why there is no space between the components and they looked attached?
has answer: http://stackoverflow.com/a/24505595
tagged with: gridbaglayout
tagged with: layout
accepted answer: http://stackoverflow.com/a/24505992
has title: how GridBagLayout works?
tagged with: layout-manager
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/24446979
has answer: http://stackoverflow.com/a/24447053
answer count: 1
downvote count: 0
favorite count: 0
tagged with: junit
accepted answer: http://stackoverflow.com/a/24447053
has comment: http://stackoverflow.com/comment/37829159
tagged with: jenkins
upvote count: 2
has body: I have a problem when I tried to run JUnit tests with Maven. For a Jenkins plug-in I wrote a class for test. For example: I have the class ConsoleParser in package com.jenkins_plugin in folder src/main/java. The JUnit test case is ConsoleParserTest in package com.jenkins_plugin in folder src/test. For running the JUnit test I added the dependency in the pom: junit junit 4.11 And I ran in cmd the next command: mvn -Dtest=ConsoleParserTest test The problem is that I've got the following error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2. 12:test (default-test) on project swatt_jenkins: No tests were executed! (Set - DfailIfNoTests=false to ignore this error.) -> [Help 1] The full pom.xml is: 4.0.0 Jenkins_Plugin maven-compiler-plugin 2.3.2 1.6 1.6 org.apache.maven.plugins maven-surefire-plugin 2.12 org.codehaus.mojo emma-maven-plugin 1.0-alpha-3 true process-classes instrument org.jenkins-ci.plugins plugin 1.526 Jenkins_Plugin 1.0 hpi repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ repo.jenkins-ci.org http://repo.jenkins-ci.org/public/ junit junit 4.11 Also, I must mention that with those settings I ran successfully the test but after adding findbugs it crashed. So, I removed findbugs and try to run the test again but the problem that I mentioned appeared. So, can someone explain what I have to do? I tried to add another version of JUnit, Surefire but I had the same problem and I don't understand why.
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: java
has title: JUnit test with Maven in a Jenkins plugin
tagged with: eclipse
type: Question

http://stackoverflow.com/a/24439399
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37815589
answers question: http://stackoverflow.com/q/24439298
upvote count: 1
has body: An ArrayList is backed by an array - so Projectile p = (Projectile) projectiles.get(i); Gets a reference to the Projectile at position i from the array backing the projectiles List. If there is no element at i and i is within the size of the container then you would get null (e.g. it's not a new Projectile with get). The cast is necessary because this ArrayList is a raw type. Hence it is necessary to cast Object to Projectile. If possible, use a generic type with the container, List&lt;Projectile&gt; projectiles = robot.getProjectiles(); Then Projectile p = projectiles.get(i); // &lt;-- no cast with generic type.

http://stackoverflow.com/q/24449271
has title: Populate ListView From SQLite database in onCreate() in Android
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/37836553
has comment: http://stackoverflow.com/comment/37833212
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/24449522
type: UnansweredQuestion
has body: I created Activity 'A' and 'B'.I have inserted some data in Activity 'A' and i want to display all the data in listview in Activity 'B' on button click in Activity 'A'.But when i run the application it crashes and getting error and nullpointerException.Please help me.Thanks in advance. Here is my Database method code. public Cursor employeeName(){ ArrayList&lt;Employee&gt; EmployeeNameList = new ArrayList&lt;Employee&gt;(); String selectQuery = "SELECT * FROM " + EMPLOYEE_DETAILS_TABLE; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if(cursor.moveToFirst()) { do{ Employee empName = new Employee(); empName.setName(cursor.getString(1)); empName.setDepartment(cursor.getString(2)); empName.setDesignation(cursor.getString(3)); EmployeeNameList.add(empName); } while(cursor.moveToNext()); } return cursor; } public List&lt;String&gt; getAllEmployeeName() { List&lt;String&gt; labels = new ArrayList&lt;String&gt;(); // Select All Query String selectQuery = "SELECT * FROM " + EMPLOYEE_DETAILS_TABLE; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { labels.add(cursor.getString(1)); } while (cursor.moveToNext()); } cursor.close(); db.close(); return labels; } Here is my Activity code public class Employee_List extends ListActivity { DatabaseHelper databaseHelper; Context context; Employee emp; protected SQLiteDatabase db; protected Cursor cursor; protected ListAdapter adapter; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.staff_employee_list); populateListView(); } private void populateListView() { DatabaseHelper databaseHelper = new DatabaseHelper(context); db = (new DatabaseHelper(this)).getWritableDatabase(); Cursor cursor =(Cursor) databaseHelper.employeeName(); String[] fromFieldNames = new String[] {databaseHelper.Staff_Employee_Name,databaseHelper.Department,databaseHelper.Designatio…
tagged with: android-sqlite
tagged with: java
has comment: http://stackoverflow.com/comment/37833452
type: Question

http://stackoverflow.com/q/24463785
linked to: http://stackoverflow.com/q/24470026
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37878882
has comment: http://stackoverflow.com/comment/37863360
has body: Ok, I am developing a java similiarity checker application between two or more java codes that used jfreechart to display the presentation. To get the data that I need, I use getter setter to accommodate the data. Here is the getter setter code public class ReportChart { public ReportChart() { } private String nameOfMainFile; private String nameOfComparingFile; private double levensthein; private double jaccard; private double cosine; public double getLevensthein() { return levensthein; } public void setLevensthein(double levensthein) { this.levensthein = levensthein; } public double getJaccard() { return jaccard; } public void setJaccard(double jaccard) { this.jaccard = jaccard; } public double getCosine() { return cosine; } public void setCosine(double cosine) { this.cosine = cosine; } public String getNamaFileUtama() { return nameOfMainFile; } public void setNameOfMainFile(String namaFileUtama) { this.nameOfMainFile = namaFileUtama; } public String getNamaFilePembanding() { return nameOfComparingFile; } public void setNameOfComparingFile(String namaFilePembanding) { this.nameOfComparingFile = namaFilePembanding; } } To get the data, I write this source code below. You can see on the end of code, I am setting that will be implement the getter setter code. public final class ASTParseUnit { final IParserSelector parserSelector; List&lt;ReportChart&gt; Data; ReportChart detailChart; String IDLexer; /** * Constructor. * * @param parserSelector */ public ASTParseUnit(final IParserSelector parserSelector) { Data = new ArrayList &lt;ReportChart&gt;(); this.parserSelector = parserSelector; } public ASTManager parse(final JCCDFile[] files) { JCCDFile temp; temp = files[0]; String name = temp.getName(); String idLexerSeleksi = ""; StringBuilder namaFileUtama = new StringBuilder(); StringBuilder countLevenstheins = new StringBuilder(); StringBuilder countJaccards = new StringBuilder(); StringBuilder countCosines = new StringBuilder(); for (final JCCDFile file : files) { cont…
tagged with: java
tagged with: loops
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/37860459
has title: failed to loop List of Data in JfreeChart
type: Question

http://stackoverflow.com/q/24475455
tagged with: android
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37882454
type: Question
tagged with: ioexception
tagged with: camera
score: 1
tagged with: java
tagged with: prepare
has comment: http://stackoverflow.com/comment/37882414
has body: First of all, I've checked stackoverflow again an again about this problem and I'm still not able to find out what's wrong ... I try to record a video, without audio, and I still have this prepared failed -1 issue ... The file is created but stays at 0kb. I tried different output format, check my manifest etc ... Can't find the problem :( More info => I test my app on a Galaxy S2 android 2.3.5 ... Any help more than appreciated ... Thanks ! Here is my CameraView activity, where I display the preview and record the vidéo ( preview works fine ): package com.guillaimej.testapplication.app; import java.io.File; import java.io.FileDescriptor; import java.io.IOException; import java.util.List; import android.graphics.ImageFormat; import android.media.CamcorderProfile; import android.util.Log; import android.content.Context; import android.graphics.Point; import android.hardware.Camera; import android.hardware.Camera.Size; import android.media.MediaRecorder; import android.os.Environment; import android.view.Display; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.WindowManager; import android.widget.Toast; public class CameraInputView extends SurfaceView implements SurfaceHolder.Callback { private static final String TAG = "CameraInputView"; private SurfaceHolder mHolder; private Camera mCamera; private Size mPreviewSize; private List<Size> mSupportedPreviewSizes; int w, h; MediaRecorder mediaRecorder; public CameraInputView(Context context, Camera camera) { super(context); // FETCH THE CAMERA INSTANCE mCamera = camera; mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); Camera.Parameters params = mCamera.getParameters(); // Find screen size WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); if(android.os.Build.VERSION.SDK_INT >= 13){ w = display.getWidth(); h = display.getHeight(); Point point = new Po…
answer count: 1
downvote count: 0
favorite count: 0
has title: Android MediaRecorder prepared failed -1
has answer: http://stackoverflow.com/a/24475567

http://stackoverflow.com/a/24470735
upvote count: 1
has comment: http://stackoverflow.com/comment/37873546
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37873606
has body: That is why we have intent.putExtra("classTestObject", object); You dont have to create Object instance again in each activity. Just pass the reference.
answers question: http://stackoverflow.com/q/24470714

http://stackoverflow.com/comment/37890301
comment on: http://stackoverflow.com/q/24478827
score: 0
type: Comment
type: QuestionComment
has text: i dont know how to high light :( so i mark a comment on line 52

http://stackoverflow.com/q/24467307
has body: I have the next problem: I am making a simple cast: TargetBot2Params params = (TargetBot2Params)bot.getParams(); But I get the next error: Inconvertible types Requiered: TargetBot2Params Found: UT2004BotParameters And I dont know why occurs this, because I think that it doesnt do the cast. Anyone knows why occurs this? Thanks for your time.
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24467323
tagged with: java
has title: Error Casting in Java
type: Question
tagged with: casting
answer count: 1
score: -1
linked to: http://stackoverflow.com/q/393252
downvote count: 1
duplicate of: http://stackoverflow.com/q/393252

http://stackoverflow.com/comment/38028380
has text: Forget memory for now.. I can fire multiple queries and create threads... The problem is how will I hold the record in memory without creating an object Array.It will be good if I can avoid the time in type casting the items, as there will be many columns in each record
score: 0
comment on: http://stackoverflow.com/q/24554084
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24576813
has comment: http://stackoverflow.com/comment/38090677
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/24604536
has comment: http://stackoverflow.com/comment/38072477
type: AnsweredQuestion
tagged with: java
tagged with: google-cloud-storage
type: Question
answer count: 2
has body: I have CSV file which i have stored in Google cloud storage . I am reading this CSV file and building a tree map for each occurrence of the words . Is there way i can sort and display only top 10 words in the file ? Here's my code: @SuppressWarnings("serial") public class GoogleCloudStorageServlet extends HttpServlet { public static final String BUCKETNAME = "bigdata"; public static final String FILENAME = "Railways.csv"; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); resp.getWriter().println("Hello, world from java"); GcsService gcsService = GcsServiceFactory.createGcsService(); GcsFilename filename = new GcsFilename(BUCKETNAME, FILENAME); GcsFileOptions options = new GcsFileOptions.Builder() .mimeType("text/html") .acl("public-read") .addUserMetadata("myfield1", "my field value") .build(); GcsOutputChannel writeChannel = gcsService.createOrReplace(filename, options); PrintWriter writer = new PrintWriter(Channels.newWriter(writeChannel, "UTF8")); GcsInputChannel readChannel = null; BufferedReader reader = null; String cvsSplitBy = ","; try { readChannel = gcsService.openReadChannel(filename, 0); reader = new BufferedReader(Channels.newReader(readChannel, "UTF8")); String line; TreeMap&lt;String, Integer&gt; map = new TreeMap&lt;String, Integer&gt;(); while ((line = reader.readLine()) != null) { String[] post = line.split(cvsSplitBy); String[] words = post[1].split("[ \n\t\r.,;:!?(){}]"); for (int counter = 0; counter &lt; words.length; counter++) { String key = words[counter].toLowerCase(); // remove .toLowerCase for Case Sensitive result. if (key.length() &gt; 0) { if (map.get(key) == null) { map.put(key, 1); } else { int value = map.get(key).intValue(); value++; map.put(key, value); } } } //Display only top 10 words in the file } } finally { if (reader != null) { reader.close(); } } } }
has comment: http://stackoverflow.com/comment/38084263
downvote count: 0
has answer: http://stackoverflow.com/a/24604536
tagged with: sorting
possible better answer: http://stackoverflow.com/a/24577038
has title: Display top 10 words in a CSV file
has answer: http://stackoverflow.com/a/24577038
score: 2
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/comment/38090082
type: Comment
comment on: http://stackoverflow.com/a/24580850
score: 0
type: AnswerComment
has text: As simple as it is to write my own query, why should I change my model to adapt to the persistence engine idiosyncrasies? @Query(value="insert into UserComment (Story_id, Comment_id) VALUES (:storyId, :commentId)", nativeQuery = true)

static-analysis
tags question: http://stackoverflow.com/q/24526276
type: Tag
tag name: static-analysis

http://stackoverflow.com/a/24560823
has body: The class you are trying to run and its dependency are on two different classpaths. Test class is rooted inside bin, wheras ConditionalCompilation class is rooted inside the parent directory. One fix is to specify the dependency classpath explicitly. java -classpath bin;. ConditionalCompilation Another fix is to compile to and run from the bin directory. javac -d .\bin -classpath .\bin ConditionalCompilation.java cd bin java ConditionalCompilation
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24560702
has comment: http://stackoverflow.com/comment/38041224
has comment: http://stackoverflow.com/comment/38041180
type: Answer
answers question: http://stackoverflow.com/q/24560702
score: 0

http://stackoverflow.com/q/24543062
tagged with: android
has title: My phone doesn't vibrate
favorite count: 0
has comment: http://stackoverflow.com/comment/38008636
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38008400
type: Question
score: 2
has answer: http://stackoverflow.com/a/24543240
tagged with: java
upvote count: 2
has answer: http://stackoverflow.com/a/58158847
has answer: http://stackoverflow.com/a/56032174
answer count: 3
has body: I tried to vibrate on my android phone that Samsung Galaxy3 (android 4.1.2). But It's not working. I don't know why this problem occured. MainActivity.java package com.example.vibration; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Vibrator; import android.util.Log; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Vibrator vibe = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibe.vibrate(2000); //LogCat if (vibe.hasVibrator()) { Log.v("Can Vibrate", "YES"); vibe.vibrate(6000); } else { Log.v("Can Vibrate", "NO"); } } } LogCat Information It's working (I found YES).. but my phone doesn't vibrate :-( AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.vibration" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" /&gt; &lt;uses-permission android:name="android.permission.VIBRATE"/&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; Thank you for in advance

http://stackoverflow.com/comment/60797999
has text: No, it does not! But I have managed to get it around. It's a bit lengthy solution but serving the purpose.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24450989

http://stackoverflow.com/q/24516913
has comment: http://stackoverflow.com/comment/37959212
has answer: http://stackoverflow.com/a/24517049
tagged with: android
has title: Android: Importing Project, Cant run due to multiple errors?
type: UnansweredQuestion
has body: I am attempting to import code to Eclipse to run it. It imports correctly but then almost all of the packages and classes contain errors. E.g: Almost every Line either has the error: " " cannot be resolved to a type or " " is undefined I am asking as I do not know how to fix the errors. Is it just an error within my eclipse? It is not a syntax error etc as I know the code runs on another machine.
tagged with: java
tagged with: eclipse
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37958836

http://stackoverflow.com/comment/38085457
score: 0
type: AnswerComment
has text: Oh, Thanks! I couldn't get my head around it.
type: Comment
comment on: http://stackoverflow.com/a/24584776

http://stackoverflow.com/q/24435918
has comment: http://stackoverflow.com/comment/37978897
possible better answer: http://stackoverflow.com/a/24657777
tagged with: maven
has comment: http://stackoverflow.com/comment/37949329
tagged with: pom.xml
tagged with: build
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24632594
tagged with: coap
type: Question
accepted answer: http://stackoverflow.com/a/24632594
score: 0
answer count: 2
has body: I am trying to build the Californium repository https://github.com/eclipse/californium using maven. Typing "mvn clean install" gives the following output: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.eclipse.californium:californium-core:jar:1.0.0-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 29, column 18 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] Californium (Cf) Root [INFO] Californium (Cf) Core [INFO] Californium (Cf) Proxy [INFO] Californium (Cf) OSGi Bundle [INFO] Cf-PlugtestClient [INFO] Cf-PlugtestChecker [INFO] Cf-PlugtestServer [INFO] Cf-HelloWorldClient [INFO] Cf-HelloWorldServer [INFO] Cf-SecureServer [INFO] Cf-ExampleCrossProxy [INFO] Cf Benchmark Server [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Californium (Cf) Root 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.eclipse.californium:element-connector:jar:1.0-SNAPSHOT is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Californium (Cf) Root ............................. FAILURE [0.097s] [INFO] Californium (Cf) Core ............................. SKIPPED [INFO] Californium (Cf) Proxy ............................ SKIPPED [INFO] Californium (Cf) OSGi Bundle ...................... SKIPPED [INFO] Cf-PlugtestClient ................................. SKIPPED [INFO] Cf-PlugtestChecker ................…
has title: Californium build failure using maven
has answer: http://stackoverflow.com/a/24657777

http://stackoverflow.com/a/24444457
has body: = operator will assign value of right side expression to the variable on left side. So in x=y=z,first value of z will be assigned to y and then it is assigned to x. STEP 1 : x=(y=z) /assign value of z to y. STEP 2 : x=y /assign value of y to x. So value of x will be 3.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24444361
downvote count: 0

http://stackoverflow.com/q/24500336
tagged with: java
type: Question
has title: FactoryBeanNotInitializedException: Cannot determine target class for proxy
tagged with: pool
score: 0
has answer: http://stackoverflow.com/a/24504573
answer count: 1
has body: I want to setup an object pool in my spring application with annotation only. I started out with this example taken from Spring docs: http://docs.spring.io/spring/docs/2.5.x/reference/aop-api.html#aop-ts-pool. Here is how I translate the XML configuration: @Configuration @EnableAutoConfiguration @ComponentScan public class SpringObjectPoolTest { public static void main(String[] args) throws Exception { context = new SpringApplicationBuilder(SpringObjectPoolTest.class) // .addCommandLineProperties(false) // .web(false) // .headless(false) // .registerShutdownHook(true) // .application() // .run(); context.getBean(SpringObjectPoolTest.class).go(); } @Resource(name = "pfb") private FactoryBean&lt;MyTask&gt; pool; @Resource(name="pool") private TargetSource targetSource; private static ConfigurableApplicationContext context; @Bean(name = "task") @Scope("prototype") public MyTask createNewTask() { return new MyTask(); } @Bean(name = "pool") public CommonsPoolTargetSource setupObjectPool() { CommonsPoolTargetSource pc = new CommonsPoolTargetSource(); pc.setMaxSize(25); pc.setTargetBeanName("task"); return pc; } @Bean(name = "pfb") public ProxyFactoryBean createProxyFactoryBean() { ProxyFactoryBean pfb = new ProxyFactoryBean(); pfb.setTargetSource(targetSource); return pfb; } private void go() { try { pool.getObject().speak(); } catch (Exception e) { e.printStackTrace(); } } } However I get this exception: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'pfb': org.springframework.beans.factory.FactoryBeanNotInitializedException: Cannot determine target class for proxy
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24504573

struts2
tags question: http://stackoverflow.com/q/24527235
tags question: http://stackoverflow.com/q/24440274
tags question: http://stackoverflow.com/q/24565641
tags question: http://stackoverflow.com/q/24567776
tags question: http://stackoverflow.com/q/24569881
tags question: http://stackoverflow.com/q/24455349
tags question: http://stackoverflow.com/q/24545746
tags question: http://stackoverflow.com/q/24433920
tags question: http://stackoverflow.com/q/24443842
tags question: http://stackoverflow.com/q/24527457
tags question: http://stackoverflow.com/q/24585795
tags question: http://stackoverflow.com/q/24560996
tag name: struts2
tags question: http://stackoverflow.com/q/24428474
tags question: http://stackoverflow.com/q/24484611
tags question: http://stackoverflow.com/q/24548266
tags question: http://stackoverflow.com/q/24513656
tags question: http://stackoverflow.com/q/24454545
tags question: http://stackoverflow.com/q/24557138
tags question: http://stackoverflow.com/q/24469315
tags question: http://stackoverflow.com/q/24546512
tags question: http://stackoverflow.com/q/24516881
tags question: http://stackoverflow.com/q/24573688
tags question: http://stackoverflow.com/q/24465235
tags question: http://stackoverflow.com/q/24576614
tags question: http://stackoverflow.com/q/24481871
tags question: http://stackoverflow.com/q/24553157
tags question: http://stackoverflow.com/q/24525825
tags question: http://stackoverflow.com/q/24572069
tags question: http://stackoverflow.com/q/24449060
tags question: http://stackoverflow.com/q/24434579
tags question: http://stackoverflow.com/q/24492500
tags question: http://stackoverflow.com/q/24475784
type: Tag
tags question: http://stackoverflow.com/q/24558195

http://stackoverflow.com/comment/37933079
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24483388
type: AnswerComment
has text: Could you post your full code(main class, async class, db class). so that i can let you know where is the exact problem.

http://stackoverflow.com/comment/38003514
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24540610
score: 3
has text: `HashMap` isn't a synchronized collection, so you should assume that no operations are atomic.

http://stackoverflow.com/a/24503526
answers question: http://stackoverflow.com/q/24501268
downvote count: 0
upvote count: 8
has body: in your class having the render method use can do following code: Vector3 touchPoint=new Vector3(); void update() { if(Gdx.input.justTouched()) { //unprojects the camera camera.unproject(touchPoint.set(Gdx.input.getX(),Gdx.input.getY(),0)); if(balloon.getBoundingRectangles().contains(touchPoint.x,touchPoint.y)) { // will be here when balloon will be touched } } }
type: Answer
score: 8

http://stackoverflow.com/a/24459713
has body: You can use GSON librery, it's very easy to use. Just create a class (model) public class Event{ private String event_id; private String event_title; ... } and in your main activity Event ev = new Event ("EV00000001", "Movie 1") Gson gson = new Gson(); gSon = gson.toJson(ev); Log.i("gson", gSon); and you will get JSON [ { "event_id": "EV00000001", "event_title": "Movie 1", } ]
upvote count: 2
type: Answer
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/24459349

http://stackoverflow.com/q/24516470
has title: Java For Loop, Input Number of Scores
possible better answer: http://stackoverflow.com/a/24516558
has answer: http://stackoverflow.com/a/24516558
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24516608
tagged with: java
has comment: http://stackoverflow.com/comment/37958037
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/37957967
has comment: http://stackoverflow.com/comment/37957964
downvote count: 7
has comment: http://stackoverflow.com/comment/38319865
has comment: http://stackoverflow.com/comment/37958016
type: Question
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/37958015
has answer: http://stackoverflow.com/a/24516608
has body: I am beginner in Java programming and I need to indicate the number of scores before the program enters a for loop. Here is an example: If I enter '4' as the input it will declare enter score 4 times and will get the average. Trial code: import java.io.*; public class Exer2{ public static void main(String[] args)throws Exception{ BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String strinput; int i; int x; x = Integer.parseInt(br.readLine()); System.out.print("Enter number or scores here:"); x = input.nextInt(); for (i = 0; i &lt; x; i++){ System.out.print("Enter score here:"); if (i==0){ strinput = input.readLine(); x=Integer.parseInt(br.readLine())); } } i=(a+b+c)/x; System.out.println("The average score is " +i);
score: -6
has comment: http://stackoverflow.com/comment/37957962
favorite count: 0
has comment: http://stackoverflow.com/comment/37958004

http://stackoverflow.com/q/24587013
score: 0
has title: check adjacent elements java 2d array
answer count: 1
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/38089490
linked to: http://stackoverflow.com/q/19460781
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24588239
tagged with: java
duplicate of: http://stackoverflow.com/q/19460781
type: Question
has answer: http://stackoverflow.com/a/24588239
has comment: http://stackoverflow.com/comment/38089926
has body: Let's say that i have a 4X4 2D array. For example | 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 | | 8 | 9 | 10| 11| | 12| 13| 14| 15| I need to check the adjacent elements up down and left and the adjacent alement is not get out of bound. For example 0{1,4}, 3{2,7}, 5{1,4,6,9}. Any help? Thanks Additional Inflammations. grid = new boolean [][]; for(int i=0;i&lt;grid.length;i++){ for(j=0;j&lt;grid.length; j++) grid[i][j] = false; } grid[0][1]= true; if(grid[i][j+1]]==true){ //do sth }else if(grid[i][j-1]==true){ // do sth }else if(grid[i-1][j]==true){ // do sth }else if(grid[i+1][j]==true){ // do sth }
has comment: http://stackoverflow.com/comment/38089970

http://stackoverflow.com/a/24536547
type: Answer
has body: Your code is perfectly valid. This is probably caused by: Bad IDE settings Damaged or alternative javac compiler. Re-download your IDE, you probably want to download the latest version of it and perform a clean install. You can also try to download and install JDK again (preferably latest version). Just a little tip. In Java, there is a convention that variable visibility modifier comes first. So instead of final private, learn to write private final.
accepted answer of: http://stackoverflow.com/q/24536332
has comment: http://stackoverflow.com/comment/37995636
answers question: http://stackoverflow.com/q/24536332
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37878560
type: Comment
comment on: http://stackoverflow.com/a/24472709
type: AnswerComment
has text: "Your custom add method is synchronizing on a different object to the requestList object is using to synchronize. Hence, there won't be mutual exclusion." - the synchronizedList wrapper (`requestList`) and the actual list might be synchronizing on different objects, and so the `synchronized` modifier of `add` is useless here, but that doesn't mean it won't work.
score: 0

http://stackoverflow.com/q/24544827
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has body: I have a problem deploying my jersey 2.0 web Applications, there is CDI deployment failure, Here the error log : org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 &lt;Br&gt; Unsatisfied dependencies for type [IterableProvider&lt;InjectionResolver&lt;Object&gt;&gt;] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 2 of [BackedAnnotatedConstructor] @Inject org.glassfish.jersey.internal.inject.JerseyClassAnalyzer(@Named ClassAnalyzer, IterableProvider&lt;InjectionResolver&lt;Object&gt;&gt;)] This error happens only sometimes. When it does I clean my project and restart my glassfish until deployment succeeds but this takes too much time. I don't have any idea how to fix this problem permanently. Can anybody help me?
has title: Jersey deployment Error CDI
downvote count: 0
tagged with: jersey-2.0
favorite count: 0
tagged with: cdi
tagged with: deployment

http://stackoverflow.com/comment/37946037
score: 0
type: Comment
has text: do not do #1. Rights by themselves are not typically hierarchical. instead make an assignment table to the users (or roles) and have a trigger that auto-populates additional assignments if some special combination is achieved.
type: QuestionComment
comment on: http://stackoverflow.com/q/24509817

http://stackoverflow.com/q/24483985
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37898843
has comment: http://stackoverflow.com/comment/37898981
tagged with: object
tagged with: java
tagged with: floating-point
tagged with: memory
accepted answer: http://stackoverflow.com/a/24484133
tagged with: vector
downvote count: 0
has body: I am currently working on some code for my GUI elements and while working on the code for detecting if the mouse is within the element I had a thought about efficiency, not only now but in the future. Currently I am using Vector2f for both dimensions and position due to the ease of passing them in and out of functions with calls to functions such as getDimensions which just returns the Vector2f and so on. My question though is whether I am being wasteful with my use of Vectors in general and Vector2f specifically. Is it better to have two floats within my objects for x and y and two for width and height or to have the two vectors, one for position and one for dimensions. The main worry is that creating the Vector objects takes up more space than just using the primitive floats. I have looked at the source of the Vector2f and 3f classes for ideas and they seem to be very light weight but seeing as I know very little about how much memory different objects take up and how it is all determined that I would ask those who could much easier understand the problem at hand. Thank you in advance for any and all answers!
type: Question
type: AnsweredQuestion
score: 1
favorite count: 0
has title: Which is better to use frequently in objects: Vector2f or 2 floats
has comment: http://stackoverflow.com/comment/37912219
has answer: http://stackoverflow.com/a/24484133

http://stackoverflow.com/a/24486060
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24484669
has body: The issue in your code is that you mentioned hmb2ddl.auto instead of hibernate.hbm2ddl.auto also it has spelling mistake. so change it to create

http://stackoverflow.com/q/24547538
type: Question
has answer: http://stackoverflow.com/a/24547604
has title: Parsing string values from a special response pattern in java
score: 0
has answer: http://stackoverflow.com/a/24547839
has comment: http://stackoverflow.com/comment/38016167
has answer: http://stackoverflow.com/a/24547764
tagged with: regex
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38016174
possible better answer: http://stackoverflow.com/a/24547604
has answer: http://stackoverflow.com/a/24547664
tagged with: java
accepted answer: http://stackoverflow.com/a/24547664
has comment: http://stackoverflow.com/comment/38016268
has body: In my application , i am getting a response string from a device that has a pattern like that; +CUSD: &lt;m&gt;[,&lt;str&gt;,&lt;dcs&gt;] Here &lt;m&gt; is number, &lt;str&gt; is string, &lt;dcs&gt; is number and the values in brackets may exist or may not exist. For example i may get this response; +CUSD: 4 or this response; +CUSD: 2, "The string value which can have also comma",15 So, i want to parse &lt;m&gt;,&lt;str&gt; and &lt;dcs&gt; values from response. How can i do that ?

http://stackoverflow.com/comment/37866500
type: Comment
has text: Thanks for the insight, the if statement does look a little cleaner. The reason I did greater than 30 and less than 65 is cause that how it reads in the table. I could post the table here , it would paste properly.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24466911

http://stackoverflow.com/comment/37897800
has text: @Krishna The servlet-mapping maps the servlet class to a url-pattern. The webcontainer is the one thats incharge of getting the request, intercepting the url and mapping it to its servlet.
comment on: http://stackoverflow.com/q/24482900
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24482768
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37896980
has body: You can't access values() because it's not an instance method; it's a static method belonging to the enum type. So passing an instance of the superclass Enum doesn't give you the information you need. As far as the interface methods, declaring Enum&lt;? extends MyInterface&gt; declared certain generic information about the enum, but doesn't tell the compiler that generic_enum is itself an instance of MyInterface. If you want to declare that generic_enum implements MyInterface, you should do exactly that: public void AcceptsGeneric ( MyInterface generic_enum ) If, for whatever reason, you need to know that it implements MyInterface and it's an enum, you can declare your method as follows: public &lt;T extends Enum&lt;T&gt; &amp; MyInterface&gt; void AcceptsGeneric ( T generic_enum )
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24482592
accepted answer of: http://stackoverflow.com/q/24482592
upvote count: 2

cucumber
tags question: http://stackoverflow.com/q/24544320
tags question: http://stackoverflow.com/q/24516965
tags question: http://stackoverflow.com/q/24441682
type: Tag
tag name: cucumber

http://stackoverflow.com/q/24582047
has comment: http://stackoverflow.com/comment/38080548
has title: JPA Performance: Entity or Entity Id as query parameter?
has body: Let's say there are two entity types: Book (with primary key bookId) and Author (with primary key authorId). An author writes 0...n books. So Author is referenced in Book using @ManyToOne. If we want to retrieve all books written by a certain author, we could do two things in JPQL (e. g. NamedQuery): SELECT b FROM Book b WHERE b.author = :author (entity as parameter) SELECT b FROM Book b WHERE b.author.authorId = :authorId (primary key ID of entity as parameter) In the first option we have to watch out that the passed object is really of type Author and it already has a primary key. But: Is there a difference regarding performance in the two options mentioned above? I guess (2) is less expensive, but (1) might be easier to optimize for the JPA provider. Is there a performance test or literature available on this question? We can assume that the Author instance (whose books we want to search for) has already been loaded (e. g. to view his/her profile in the response), so it was no additional code writing effort to either pass the whole object or just it's ID to the book search method. But is there a difference in execution speed? Maybe depending on the JPA provider used?
type: AnsweredQuestion
tagged with: performance
tagged with: java
accepted answer: http://stackoverflow.com/a/24596518
has comment: http://stackoverflow.com/comment/78427724
type: Question
upvote count: 4
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/38093954
has answer: http://stackoverflow.com/a/24596518
score: 4
favorite count: 0

http://stackoverflow.com/comment/37796676
score: 0
type: Comment
has text: You need to call `Thread.join()` to be sure, your old thread finished. But this is really a bad way to do it.
comment on: http://stackoverflow.com/a/24429422
type: AnswerComment

http://stackoverflow.com/a/24449990
has body: The JSON string you are trying to convert starts with the word !DOCTYPE. Since the string !DOCTYPE is not formatted as a JSON string you get a JSONException. The link that you are reading data from starts with the HTML tag &lt;!DOCTYPE html&gt; (example). Sanitize your data input string and remove any HTML tags and non-JSON strings to make your code work. You can sanitize either in your php code (not sure how to do that with the code you provided), or strip out all tags in your app. To remove HTML tags (and all other tags) you can use: String noHTML = html.replaceAll("\\&lt;.*?&gt;","");
has comment: http://stackoverflow.com/comment/37898821
score: 0
answers question: http://stackoverflow.com/q/24449870
type: Answer

http://stackoverflow.com/comment/37997593
comment on: http://stackoverflow.com/q/24537602
has text: With no details about that number, we can't help you. If it's a unix timestamp, it's Sep 28/1970, which is probably not correct. If it's a millisecond timestamp, it's even worse 12:29am, Jan 1/1970.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24535241
tagged with: ant
tagged with: java
score: 0
tagged with: intellij-idea
answer count: 1
accepted answer: http://stackoverflow.com/a/24536399
tagged with: plugins
has answer: http://stackoverflow.com/a/24536399
type: AnsweredQuestion
tagged with: ideavim
type: Question
has body: I'm trying to install the ideaVim plugin for intellij from source. I'm using this repo. When I cd into the top level of the ideavim directory and then run ant jar, it produces the IdeaVim.jar file fine. Then I go into my ~/.IntelliJIdea13/config/ folder and do a mkdir plugins to create the directory. I then copied my IdeaVim.jar file into this folder. So then I start intellij and go to plugins and enable the ideaVim plugin and it tells me to restart intellij. So I do but when it starts up I get this error: Plugin 'IdeaVIM' failed to initialize and will be disabled. Please restart Intellij IDEA. java.lang.ClassNotFoundException: com.maddyhome.idea.vim.VimPlugin PluginClassLoader[IdeaVIM, 0.35] at com.intellij.idea.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:68) ... Does anyone have any idea why this could be failing to initialize? Did I do the ant build wrong or do I have to include more then my .jar file in ~/.IntelliJIdea13/ ?
has title: How can I install an intellij plugin from source?

http://stackoverflow.com/a/24494622
has comment: http://stackoverflow.com/comment/37918878
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37978731
type: Answer
has body: Unfortunately I don't have an answer that will make the top of your priority list but if I were you I'd settle on Collections.emptySet Type inference was your first priority but I don't know if the choice can/should influence that given you were looking for an emptyCollection() On the second priority, think about any api that takes in a collection which performs differently (accidentally/intentionally) based on the sub-interfaces of the concrete object passed in. Aren't they more likely to offer varied performance based on the concrete implementations (as with an ArrayList or LinkedList) instead? The empty set/list are not modeled on any empty data structures anyway; they are dummy implementations - hence no real difference Based on java's modelling of these interfaces (which admittedly is not ideal), a Collection is very similar to a Set. In fact I think the methods are almost exactly the same. Logically too it looks OK with List being the specific-sub type that adds additional ordering concerns. Now Collection and Set looking very similar(java-wise) brings up a question. If you are using a Collection type, it is clear it is not a list you want. Now the question is are you sure you don't mean a Set. If you don't, then are you using something like a Bag (surely there must be concrete instances which are not empty in the overall logic). So if you are concerned with say a Bag, then shouldn't it be up to the Bag api to provide an emptyBag() method? Just wondering. btw, I'd stick with emptySet() in the meantime :)
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24491808
score: 3
answers question: http://stackoverflow.com/q/24491808

http://stackoverflow.com/comment/38079335
type: Comment
has text: Oh right! That make sense! Thank you very much guys, you have made the picture much clearer! :)
comment on: http://stackoverflow.com/a/24581150
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38087087
score: 0
comment on: http://stackoverflow.com/q/24584603
has text: Can su clarify? The docker build already works on the boot2docker vm. The cli basically sends the Dockerfile and context files to the server for the build. So at the end of the `docker build` command, the image already is on your boot2docker vm.
type: QuestionComment
type: Comment

connection-pooling
tags question: http://stackoverflow.com/q/24490129
tags question: http://stackoverflow.com/q/24451317
tags question: http://stackoverflow.com/q/24514575
type: Tag
tag name: connection-pooling
tags question: http://stackoverflow.com/q/24501048

http://stackoverflow.com/q/24563063
has body: I'm reading Thinking in Java. The chapter about access (private, public etc.). This is a quotation from the book: ...just because a reference to an object is private inside a class doesn't mean that some other object can't have a public reference to the same object. Then we are redirected to the online supplements for the book to learn about aliasing issues. On the official site there is a solution guide for the book. But it is expensive for me. Could you clarify what is meant by that aliasing issues so that I could google more examples.
tagged with: java
has title: Aliasing issues (public reference to a private object inside a class)
upvote count: 1
has answer: http://stackoverflow.com/a/24563113
type: UnansweredQuestion
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: Question

tcp
type: Tag
tags question: http://stackoverflow.com/q/24516418
tags question: http://stackoverflow.com/q/24531252
tags question: http://stackoverflow.com/q/24436994
tags question: http://stackoverflow.com/q/24528504
tags question: http://stackoverflow.com/q/24555703
tags question: http://stackoverflow.com/q/24502888
tags question: http://stackoverflow.com/q/24457023
tags question: http://stackoverflow.com/q/24490918
tags question: http://stackoverflow.com/q/24511769
tag name: tcp

http://stackoverflow.com/comment/37977103
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24526398
has text: @user3580294 I flagged that for you. I hope it helps.

http://stackoverflow.com/a/24458545
has comment: http://stackoverflow.com/comment/37884390
has comment: http://stackoverflow.com/comment/37884364
has body: You need to specify your class correctly in html. Like &lt;applet code="opennote.OpenNote.class" width="320" height="120"&gt; OR &lt;applet code="opennote\OpenNote.class" width="320" height="120"&gt; This is because your code is in package opennote.
answers question: http://stackoverflow.com/q/24458504
upvote count: 1
has comment: http://stackoverflow.com/comment/37851088
has comment: http://stackoverflow.com/comment/37863846
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37868158
score: 1

http://stackoverflow.com/comment/38041222
comment on: http://stackoverflow.com/a/24559389
type: Comment
has text: @Marko Topolnik: at most, a single line per property and direction. However, by providing an appropriate constructor for `class My`, which you usually do as it’s handy for other uses as well, `readResolve` could be a single-line implementation thus reducing the boilerplate to a single line per property. Which is not much given the fact that each mutable property has at least seven lines of code in class `My` anyway.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37884533
comment on: http://stackoverflow.com/q/24474825
type: Comment
type: QuestionComment
has text: Nevertheless, have a look at the answer from trashgod. Simply painting the image *larger* is **much** more efficient than painting thousands of rectangles. (Although, based on the question, one has to consider the possibility that you chose your approach intentionally...)
score: 0

http://stackoverflow.com/a/24457606
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24444639
type: Answer
has body: As of the time I'm writing this, I don't think the support library contains WatchActivity try changing it to Activity and removing the corresponding import statement, and you should be good to go. Helpful links: http://developer.android.com/preview/google-play-services-wear.html http://developer.android.com/training/building-wearables.html https://plus.google.com/u/0/communities/113381227473021565406
downvote count: 0

http://stackoverflow.com/a/24477734
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24477684
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24477684
score: 1
has body: First, don't give the methods different names. Next, if you make your Superclass abstract, and add one one abstract method (e.g. getObjects() below) then you can catch the Exception(s) thrown in your concrete implementations in one place. Also, you give a caller a single consistent entry point (e.g. getValues()). Note: This can make debugging difficult. public List&lt;T&gt; getValues() { try { return getObjects(); } catch (Exception e) { e.printStackTrace(); } finally { System.out.println("In finally"); } return null; // &lt;-- there was an Exception. Default return. } protected abstract List&lt;T&gt; getObjects() throws Exception;

http://stackoverflow.com/a/24488013
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24487355
downvote count: 0
has comment: http://stackoverflow.com/comment/37906246
type: Answer
has body: In order to validate the data on a Swing-component you should use the InputVerifier Class. Check it out at the API Docs for InputVerifier. To find out whether the given number is binary you can do: A numerical check public boolean isBinary(int number){ while (number != 0) if(number % 10 &gt; 1) return false; number /= 10; } return true; } A string check public boolean isBinary(String number){ char[] ary = number.toCharArray(); for(char c : ary) { if(!(c == '0' || c == '1')) return false; } return true; }

http://stackoverflow.com/comment/38071630
score: 0
type: AnswerComment
has text: Well I tried this but witout any change in the response, I get the next message com.servinfo.services.controller.AreaTController getData: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
comment on: http://stackoverflow.com/a/24576748
type: Comment

http://stackoverflow.com/q/24473153
has comment: http://stackoverflow.com/comment/37877996
downvote count: 0
has title: Not finding ImageView?
favorite count: 0
possible better answer: http://stackoverflow.com/a/24473192
has comment: http://stackoverflow.com/comment/37877986
has answer: http://stackoverflow.com/a/24473192
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37878173
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24473194
upvote count: 1
has comment: http://stackoverflow.com/comment/37878047
type: Question
has answer: http://stackoverflow.com/a/24473752
has body: I am trying to do something very basic and I cannot figure out why it will not find the ImageView from the Java code. When I type R.id.scanButton I get an error saying that resource does not exist.. but as you can see in my XML it has been created. What am I missing here? MainActivity.java package com.erinkabbash.coolmeter; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView button = (ImageView) findViewById(R.id.scanButton); // ImageView not Found } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } 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" tools…
answer count: 3
accepted answer: http://stackoverflow.com/a/24473194
has comment: http://stackoverflow.com/comment/37878036

http://stackoverflow.com/comment/37944003
comment on: http://stackoverflow.com/q/24461096
has text: @AlexanderGavrilov I just tried it out and there is indeed a problem with the dependencies ... But I cannot figure out how I can resolve this dependency error ... I already checked the target platform, but for me it seems that all required bundles are there.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24551495
score: 5
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24552035
has comment: http://stackoverflow.com/comment/38023994
has comment: http://stackoverflow.com/comment/38023677
tagged with: jaxb
type: Question
has title: How does JAXB advance the XMLStreamReader?
upvote count: 5
accepted answer: http://stackoverflow.com/a/24552035
answer count: 1
downvote count: 0
has body: I'm using JAXB to unmarshal objects from very large XML files using an XMLStreamReader. If the XML elements I'm unmarshalling are separated (by a newline or even a single space) this works fine. If the XML elements I'm unmarshalling do not have whitespace between them, I lose every other item - the XML reader seems to swallow the element after the one that gets unmarshalled. Source for a simplified runnable example that demonstrates this is at https://gist.github.com/dalelane/88df784c3cb74b214d5c The interesting bits are: XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(inputStream); JAXBContext context = JAXBContext.newInstance(MyJAXBClass.class); Unmarshaller unmarshaller = context.createUnmarshaller(); boolean running = true; while (running){ switch (reader.next()){ case XMLStreamConstants.START_ELEMENT: if (reader.getLocalName().equals("myunmarshallobjname")){ JAXBElement&lt;MyJAXBClass&gt; unmarshalledObj = unmarshaller.unmarshal(reader, MyJAXBClass.class); MyJAXBClass item = unmarshalledObj.getValue(); } break; case XMLStreamConstants.END_DOCUMENT: reader.close(); running = false; break; } } Every time the stream reader hits the start of an element, I pass it to the unmarshaller to unmarshall that fragment. It works if I have XML with: &lt;myunmarshallobjname key="one"&gt;&lt;/myunmarshallobjname&gt; &lt;myunmarshallobjname key="two"&gt;&lt;/myunmarshallobjname&gt; But loses items if I have: &lt;myunmarshallobjname key="one"&gt;&lt;/myunmarshallobjname&gt;&lt;myunmarshallobjname key="two"&gt;&lt;/myunmarshallobjname&gt; What am I doing wrong? How do I get the reader to not skip over elements?
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/38005314
type: Comment
has text: In businessMethodOnAnotherFacade Im getting null pointer exception just like in comment.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24541106

http://stackoverflow.com/comment/38055042
score: 0
type: Comment
has text: I have seen this statement and to me it does not really make sense ... Oracle says that JavaFX is for "creating and delivering rich internet applications" and its a intended to replace Swing.. Well fair enough but swing was never designed to deliver rich internet applications ;)
type: AnswerComment
comment on: http://stackoverflow.com/a/24553247

http://stackoverflow.com/q/24585300
tagged with: oop
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/24585483
has answer: http://stackoverflow.com/a/24585630
accepted answer: http://stackoverflow.com/a/24585399
has comment: http://stackoverflow.com/comment/38086298
possible better answer: http://stackoverflow.com/a/24585387
has title: I am trying to get the mode of an input of ten numbers in java
score: 0
has answer: http://stackoverflow.com/a/24585399
answer count: 4
has body: import java.util.*; public class main { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int[] quiz = new int[10]; int mean = 0,mode = 0,median,range; Scanner scan = new Scanner(System.in); for(int x=0;x&lt;=9;x++){ System.out.print("Enter quiz["+(x+1)+"]:"); quiz[x]= scan.nextInt(); } Arrays.sort(quiz); for(int x=0;x&lt;=9;x++){ mean = mean+quiz[x]; } mean = mean/10; median = (quiz[4]+quiz[5])/2; range = quiz[9]-quiz[0]; int[] cntr = new int[10]; for(int x=0;x&lt;=9;x++){ for(int y=0;y&lt;=9;y++){ if (quiz[x]==quiz[y]&amp;&amp;x!=y){ cntr[x]++; } } } int[] sortcntr = cntr; int ndx = 0; Arrays.sort(sortcntr); for(int z=0;z&lt;=9;z++){ if(cntr[z]==sortcntr[9]){ ndx = z; } else mode=0; } mode = quiz[ndx]; System.out.println("Mean: "+mean); System.out.println("Median: "+median); System.out.println("Range: "+range); if(mode==0){ System.out.println("Mode: none"); } else System.out.println("Mode: "+mode); System.out.print(sortcntr[9]); System.out.print(cntr[9]); System.out.println(ndx); } } this is the codes that i used everything is right except for the mode. the mode variable there always returns the highest number from the number. the latter part was just for debugging and not for use. please help
has answer: http://stackoverflow.com/a/24585387
type: AnsweredQuestion

http://stackoverflow.com/comment/37831844
has text: The original question has been edited such that I am not sure this really answers that question. The answer to the question as it is currently written is that you cannot do that. When the array is declared, the number of dimensions has to be known. The values of each of those dimensions can be runtime dynamic, but not the number of dimensions.
type: Comment
comment on: http://stackoverflow.com/a/24448432
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38062914
score: 0
type: AnswerComment
type: Comment
has text: Yes, I got it. But what explains calling the actual method `foo()`? That's what I am asking about. There is a call to `given` to mock a final method. Why is Mockito executing real code instead of complaining about final method being mocked?
comment on: http://stackoverflow.com/a/24572143

http://stackoverflow.com/comment/37905697
score: 0
type: Comment
has text: Are you planning on using Spring Security?
type: QuestionComment
comment on: http://stackoverflow.com/q/24486751

http://stackoverflow.com/comment/38099087
score: 0
comment on: http://stackoverflow.com/q/24441855
type: Comment
type: QuestionComment
has text: A stack-allocated object is still technically "constructed". What's saved is the allocation and garbage collection that a heap-allocated object would require. A JITC may be able to determine that some of the construction process (eg, setting the class pointer) can be eliminated, but with the (presumably inlined) method call there it gets messy fast. And, of course, if the method is not inlined then there is really nothing that can be eliminated. Not saying it couldn't be done, but I greatly doubt that it *would* be done, since it doesn't appear to be a "hot" scenario.

http://stackoverflow.com/a/24668834
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/24518607
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/38248176
has body: The exception doesn't come to Grizzly, it's getting processed by Jersey. Grizzly has no information about the error other than provided by Jersey via: Response.sendError(int code, String description) where Jersey passes (500, "Request failed.")

http://stackoverflow.com/comment/37953980
type: Comment
has text: Okey, i parse the string in english, but i need to display it in spanish, and with argentinian time. How should i do this ?
type: AnswerComment
comment on: http://stackoverflow.com/a/24512843
score: 0

http://stackoverflow.com/q/24519660
has answer: http://stackoverflow.com/a/38379872
upvote count: 28
has comment: http://stackoverflow.com/comment/37967868
type: Question
has title: Why does starting StreamingContext fail with “IllegalArgumentException: requirement failed: No output operations registered, so nothing to execute”?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/47972011
tagged with: java
score: 27
answer count: 3
has body: I'm trying to execute a Spark Streaming example with Twitter as the source as follows: public static void main (String.. args) { SparkConf conf = new SparkConf().setAppName("Spark_Streaming_Twitter").setMaster("local"); JavaSparkContext sc = new JavaSparkContext(conf); JavaStreamingContext jssc = new JavaStreamingContext(sc, new Duration(2)); JavaSQLContext sqlCtx = new JavaSQLContext(sc); String[] filters = new String[] {"soccer"}; JavaReceiverInputDStream&lt;Status&gt; receiverStream = TwitterUtils.createStream(jssc,filters); jssc.start(); jssc.awaitTermination(); } But I'm getting the following exception Exception in thread "main" java.lang.AssertionError: assertion failed: No output streams registered, so nothing to execute at scala.Predef$.assert(Predef.scala:179) at org.apache.spark.streaming.DStreamGraph.validate(DStreamGraph.scala:158) at org.apache.spark.streaming.StreamingContext.validate(StreamingContext.scala:416) at org.apache.spark.streaming.StreamingContext.start(StreamingContext.scala:437) at org.apache.spark.streaming.api.java.JavaStreamingContext.start(JavaStreamingContext.scala:501) at org.learning.spark.TwitterStreamSpark.main(TwitterStreamSpark.java:53) Any suggestion how to fix this issue?
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24572198
accepted answer: http://stackoverflow.com/a/24572198
tagged with: apache-spark
tagged with: spark-streaming
has answer: http://stackoverflow.com/a/47972011

http://stackoverflow.com/a/24490613
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37911910
has comment: http://stackoverflow.com/comment/37912093
has comment: http://stackoverflow.com/comment/37911330
type: Answer
has comment: http://stackoverflow.com/comment/37911272
has comment: http://stackoverflow.com/comment/37911838
has body: JAXB (JSR-222) implementations support java.util.Date and java.util.Calendar by default so you will not require an XmlAdapter for them. Classes like java.sql.Date, java.sql.Time, and java.sql.Timestamp will require an XmlAdapter. I would recommend separate adapters instead of trying to combine them into one. Note An XmlAdapter can be specified at the package level. When doe this way it applies to all mapped fields/properties on that type belonging to domain classes in that package. This can greatly reduce the amount of times you need to specify @XmlJavaTypeAdapter. You can read more about this approach on my blog. http://blog.bdoughan.com/2012/02/jaxb-and-package-level-xmladapters.html UPDATE There are two properties named "publishDate" this problem is related to the following location: at public java.sql.Timestamp Book.getPublishDate() at Book this problem is related to the following location: at private java.sql.Timestamp Book.publishDate at Book By default JAXB treats public properties (get/set method pairs) and annotated fields as mapped. This is what's causing this part of the exception. You need to do one of the following: Annotate the get method instead of the field. Keep the annotation on the field and specify @XmlAccessorType(XmlAccessType.FIELD) on your class. I have written more about this on my blog: http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html
downvote count: 0
has comment: http://stackoverflow.com/comment/37911203
score: 3
accepted answer of: http://stackoverflow.com/q/24489242
answers question: http://stackoverflow.com/q/24489242

http://stackoverflow.com/q/24493050
has comment: http://stackoverflow.com/comment/37916262
score: 0
tagged with: httpsession
answer count: 1
has comment: http://stackoverflow.com/comment/37916176
has answer: http://stackoverflow.com/a/24527682
has body: My xhtml web pages are called from an external system using a simple request, I suppose to check if the user name - given from the request - is valid or not, if valid he suppose to get to the home page, other than that he is redirected to the external system. I created a filter to get the request: @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; // skip the resources library if (!req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) { res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP // 1.1. res.setHeader("Pragma", "no-cache"); // HTTP 1.0. res.setDateHeader("Expires", 0); // Proxies. } Object attr = req.getParameter("user"); String language = (String) req.getParameter("language"); if (attr != null &amp;&amp; language != null) { // check user in db String userAdmin = (String) attr; ResultStatus result = myDao.findUser(userAdmin); if (result.getStatus().equals(ResponseStatus.SUCCESS)) { // User is logged in, so just continue request. User user = new User(); user.setAccountId(result.getAccount().getAccountId()); chain.doFilter(req, res); } else { // User is not logged in, so redirect to index. res.sendRedirect(req.getContextPath() + "/test.xhtml"); } } else { // User is not logged in, so redirect to index. res.sendRedirect(req.getContextPath() + "/test.xhtml"); } } I need to create session for the user in the filter if he is a valid user, so I can get the user object at any back bean.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37915728
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37916199
has title: Create http session in filter

http://stackoverflow.com/comment/38035808
type: QuestionComment
has text: I was hoping to get an answer to whether there is an open source library that converts Perl's regex to Java syntax
comment on: http://stackoverflow.com/q/24557824
score: 0
type: Comment

http://stackoverflow.com/a/24580290
answers question: http://stackoverflow.com/q/24580242
has body: Say our range is [0,4], create an array like this: [000001111222334] Now use a standard Random object to draw from the array. By doing this, we have gone from drawing from a uniform distribution to a distribution of our own design. In reality, we're not going to want to use an auxiliary array. You can do the following in lieu of an auxiliary array: Draw from [0,14]; map [0,4] to 0, [5,8] to 1, [9,11] to 2, [12,13] to 3 and [14] to 4. It really depends on what your distribution looks like. You can approximate drawing from a non-uniform distribution via drawing multiple times from uniform distributions over varying ranges. Of course, if you know the probability mass function or probability density function of your distribution, then you're golden.
has comment: http://stackoverflow.com/comment/38077599
has comment: http://stackoverflow.com/comment/38077378
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38077424
upvote count: 2

http://stackoverflow.com/q/24521150
possible better answer: http://stackoverflow.com/a/24521310
score: 0
answer count: 3
has body: I installed (after unzipping) android-studio-ide-135.1224218-windows, hoping to be up and running a "hello world" program by now, but the IDE won't even start because "Your Android SDK is missing, out of date or missing templates." It tells me "You can configure your SDK via Configure | Project Defaults | Project Structure | SDKs" but when I do so, I see NOTHING in the text box for Android SDK location. I searched for "android sdk" on my computer, and found C:\Program Files (x86)\Android\android-studio\plugins\android\lib\sdk-common.jar, but when I put that or C:\Program Files (x86)\Android\android-studio\plugins\android\lib into the text box, I get NO ERROR, but then I get the same message, and when I come back to the text box, IT DOESN'T HAVE WHAT I PUT INTO IT. If I browse for the text box location, no matter what I put in, it says "Please choose a valid SDK directory". That's the only "android sdk" on my computer. I JUST installed Android Studio to C:\Program Files (x86)\Android\android-studio with no errors. I have C:\Program Files\Java\jdk1.7.0_60 as JDK location. It won't let me change it to C:\Program Files (x86)\Java\jdk1.7.0_25. I've Googled to see if I can download an android sdk from somewhere but found nothing. WHAT DO I DO? I can't get into the IDE to try stuff.
has answer: http://stackoverflow.com/a/24536801
tagged with: android
has comment: http://stackoverflow.com/comment/37967017
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37966842
tagged with: java
has answer: http://stackoverflow.com/a/27219077
has title: Installed Android Studio 0.8.1 but can't get into IDE since no Android SDK
accepted answer: http://stackoverflow.com/a/24536801
has answer: http://stackoverflow.com/a/24521310
type: Question

http://stackoverflow.com/a/24505756
has comment: http://stackoverflow.com/comment/37940727
has body: "What do I need ?", It really depends of the technology you want to use with it .. eg, if you use glassfish (netbeans server), you can use their jersey "org.glassfish.jersey.jackson.JacksonFeature" as json provider and the other ressources glassfish includes. You won't need anything else for a simple implementation. As you are a beginner, you better follow a tutorial like this one : http://java.dzone.com/news/simple-restful-web-services
answers question: http://stackoverflow.com/q/24504447
downvote count: 0
has comment: http://stackoverflow.com/comment/37939254
has comment: http://stackoverflow.com/comment/37939167
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/37891679
has text: If you "simply have no idea where to even start", then your question is not appropriate for Stack Overflow.
comment on: http://stackoverflow.com/q/24480285
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37969885
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24522511
has text: Thanks that actually worked perfectly. Now I can study lol without that bothering me.

http://stackoverflow.com/q/24502811
has comment: http://stackoverflow.com/comment/37934513
upvote count: 1
has title: String splitting and wrapping
has comment: http://stackoverflow.com/comment/37933581
has comment: http://stackoverflow.com/comment/37933484
tagged with: c++
has answer: http://stackoverflow.com/a/24502998
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24503037
has comment: http://stackoverflow.com/comment/37934715
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/24503172
has body: Suppose I am given this string- String A_Old[]="010.011.100.000.111"; On every occurrence of "000" I am expected to break the string and wrap the end towards the front of the string. The resultant should look like this- String A_New[]="111.010.011.100"; Any help on how to tackle this problem would be appreciated. Also, what do I do when there are multiple occurrences of "000"? String A_Old[]="010.011.100.000.111.001.011.000.101.110"; should convert to : String A_New[]="101.110.111.001.011.010.011.100"; Code in java or c++ is understood and appreciated. EDIT This was what I thought would work- String b[]=A_Old.split(".000.",2); //should split the string in 2 parts. A_New=b[1].concat(b[0]); // concatenation with a loss of a period I was told to avoid the loss of the period as well as not using dummy variables. Both of which fails here. Any idea on how to tackle this?
downvote count: 0
accepted answer: http://stackoverflow.com/a/24503037
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/24502940
has answer: http://stackoverflow.com/a/24502940

http://stackoverflow.com/a/28816801
has body: You'll need to create a hardcode event for this textfield1. ADempiere framework doens't have support for this action for now.
type: Answer
answers question: http://stackoverflow.com/q/24577442
score: 0

http://stackoverflow.com/a/24514204
score: -2
has comment: http://stackoverflow.com/comment/37954148
has comment: http://stackoverflow.com/comment/37953811
upvote count: 0
has body: Sub can access private fields from Superclass because Sub is of type Superclass and it gains access to these private fields when calling upon methods defined in Superclass. It, however, can not call upon these fields when you attempt to make methods that will only belong to the Sub class due to Superclass privatizing "direct" access to these fields from its children.
has comment: http://stackoverflow.com/comment/37953589
type: Answer
answers question: http://stackoverflow.com/q/24514081
has comment: http://stackoverflow.com/comment/37953699
downvote count: 2

http://stackoverflow.com/comment/38066129
has text: You shouldn't just change version like this. Version 3.0 should only be used for Java EE 6 compliant application servers.
comment on: http://stackoverflow.com/a/24574448
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37834524
has text: Extremely unlikely. Provide more information about your issue.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24449996

http://stackoverflow.com/a/24509527
type: AcceptedAnswer
has body: Databases other than Oracle actually do distinguish between three different datatypes: DATE only date, no time TIME only time of the day, no date TIMESTAMP both, date &amp; time. JDBC tries to abstract standard SQL concepts and the above three datatypes are defined by ANSI SQL and thus JDBC needs to support them. As Oracle's date always includes the time, you have to use setTimestamp() otherwise the time is lost when you store it in the database.
accepted answer of: http://stackoverflow.com/q/24509062
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24509062

http://stackoverflow.com/q/24427586
score: 9
type: Question
has body: In chapter 3, item 8: public final class CaseInsensitiveString { private final String s; public CaseInsensitiveString(String s) { if (s == null) throw new NullPointerException(); this.s = s; } @Override public boolean equals(Object o) { return o instanceof CaseInsensitiveString &amp;&amp; ((CaseInsensitiveString) o).s.equalsIgnoreCase(s); } // remainder omitted } After describing issues surrounding the equals() method, he goes on to talk about this class in the context of comparing fields. For some classes, such as CaseInsensitiveString above, field comparisons are more complex than simple equality tests. If this is the case, you may want to store a canonical form of the field, so the equals() method can do cheap exact comparisons on these canonical forms rather than more costly inexact comparisons. This technique is most appropriate for immutable classes; if the object can change, you must keep the canonical form up-to-date. So my question (and I double-checked what 'canonical' means): what is Bloch talking about? What would the canonical form be? I'm ready to be told that the answer is very simple (presumably otherwise his editor would have told him to add more) but I want to see other people say so. He also mentions the same thing for hashCode() in the next item 9. To give it in context, he also discusses a bad version of the equals() method for CaseInsensitiveString: // Broken - violates symmetry @Override public boolean equals(Object o) { if (o instanceof CaseInsensitiveString) return s.equalsIgnoreCase( ((CaseInsensitiveString) o).s); if (o instanceof String) // one-way interoperability! return s.equalsIgnoreCase((String) o); return false; }
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24428722
tagged with: equals
has title: What is a 'canonical representation' of a field meant to be for equals() method (Joshua Bloch)
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24434892
upvote count: 9
tagged with: java
has answer: http://stackoverflow.com/a/24428039

http://stackoverflow.com/comment/37862402
comment on: http://stackoverflow.com/q/24464403
score: 0
type: Comment
type: QuestionComment
has text: @chrylis Agreed, but as I said above, using them for anti-piracy is not very foolproof when a MAC address can be spoofed to match the one required to run an pirate copy of some software. The pirate copy will probably be run on a different network anyway...

http://stackoverflow.com/a/24499257
upvote count: 5
has body: Garbage collection, by definition, only deallocates memory no longer being referenced. In this case, apparently, a is still referencing the array.
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24499207

http://stackoverflow.com/comment/38011452
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24544197
has text: ResultMapWithBLOBs does extending BaseResultMap. But I just want a single resultMap that contains all columns, is this possible?

http://stackoverflow.com/q/24488636
possible better answer: http://stackoverflow.com/a/24489116
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24489116
upvote count: 2
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/24509577
tagged with: caching
answer count: 2
downvote count: 0
has title: How can I compare the speed of the various caching frameworks?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24509577
has body: I wish to compare the Read, Write and Read/Write speed for a burst of data on the following caching platforms: EhCache Redis MemCached GemFire JCS (Java Caching System) How can I do so? How can I make use of platforms like Spring and/or Hibernate in doing this?
tagged with: spring

http://stackoverflow.com/comment/37881240
type: Comment
comment on: http://stackoverflow.com/a/24474874
score: 0
type: AnswerComment
has text: Immutable state, well, here you go. ;D

http://stackoverflow.com/q/24483813
tagged with: java
accepted answer: http://stackoverflow.com/a/24483950
has comment: http://stackoverflow.com/comment/37898583
has comment: http://stackoverflow.com/comment/37918095
answer count: 2
tagged with: location
tagged with: google-maps
score: -5
has body: Input : Current location lat lon radius list of near by lat lon Required Output: List of lat lon which come under the provided radius from my current location. Can someone give me the method to achieve it? I have following code to check whether the passed locations come under the passed radius... How can we optimize more? I don't was to use for loop to check my all locations everytime public static boolean pointIsInCircle(PointF pointForCheck, PointF center, double radius) { if (getDistanceBetweenTwoPoints(pointForCheck, center) &lt;= radius) return true; else return false; } public static double getDistanceBetweenTwoPoints(PointF p1, PointF p2) { double R = 6371000; // m double dLat = Math.toRadians(p2.x - p1.x); double dLon = Math.toRadians(p2.y - p1.y); double lat1 = Math.toRadians(p1.x); double lat2 = Math.toRadians(p2.x); double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); double d = R * c; return d; }
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/24484177
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24484177
tagged with: geolocation
upvote count: 1
has answer: http://stackoverflow.com/a/24483950
type: Question
has title: How to filter my nearby location by passing current location , radius and lat lon of near by locations

http://stackoverflow.com/comment/101332885
comment on: http://stackoverflow.com/a/24531432
type: Comment
score: 2
has text: also if you had custom transaction manager bean name don't forget to set it. For Java Config: `@EnableJpaRepositories(transactionManagerRef="myTransactionManagerBeanName") `
type: AnswerComment

http://stackoverflow.com/q/24563604
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/6321555
linked to: http://stackoverflow.com/q/309424
has comment: http://stackoverflow.com/comment/38046360
has answer: http://stackoverflow.com/a/24563874
has comment: http://stackoverflow.com/comment/38065843
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24563874
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/38088349
has body: I put my code in AsyncTask, in OnPostExecution, the result in Dialog is different from the one which is logged in Logcat. The one in Logcat is incomplete, the one in Dialog is complete Here is my code: private class DownloadTask extends AsyncTask&lt;String, Void, String&gt;{ @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String url =params[0]; String data = ""; try{ HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost,localContext); int status = httpResponse.getStatusLine().getStatusCode(); if(status == 200){ //Receive OK data = EntityUtils.toString(httpResponse.getEntity()); } }catch(Exception e){ Log.e("HTTP", "ERROR"); } return data; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); AlertDialog.Builder builder = new Builder(MainActivity.this); builder.setMessage(result); builder.setPositiveButton("OK", null); builder.create().show(); Log.d("Response", result); } In method onCreate(), I executed DownloadTask: String url = "https://maps.googleapis.com/maps/api/directions/json?origin=10.9052136,106.6928473&amp;destination=10.736465,106.710779&amp;sensor=false&amp;units=metric&amp;mode=driving"; DownloadTask downloadTask = new DownloadTask(); downloadTask.execute(url); I want to receive complete result to parse to JSON
tagged with: google-directions-api
has title: Can't get full body of HttpResponse
type: AnsweredQuestion

http://stackoverflow.com/comment/38121229
comment on: http://stackoverflow.com/a/24602307
type: Comment
has text: @rafeal yes java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:3361/EcoService.svc/Json/saveSerialNumbers
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38058050
comment on: http://stackoverflow.com/q/24569865
type: QuestionComment
has text: Can you correct your code listing please? the lines starting with int time = (60 / minute)... is not within a method.
type: Comment
score: 1

http://stackoverflow.com/comment/38002390
comment on: http://stackoverflow.com/q/24539948
score: 0
type: Comment
type: QuestionComment
has text: An id should be unique, so you should use directly `doc.select("#table1")` and so on

http://stackoverflow.com/comment/40220996
has text: This should work "if you installed the ADT plugin manually...". Otherwise, does not. You can check this through Eclipse icon: " If you installed the ADT plugin manually you should have the standard purple eclipse icon. If you are using the ADT Bundle the launch icon will be green with curly braces." This works for me. Source: answer of Luke Deighton and others below on this post.
score: 5
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24448709

http://stackoverflow.com/comment/37832367
comment on: http://stackoverflow.com/q/24448733
score: 0
type: Comment
type: QuestionComment
has text: [This](http://stackoverflow.com/questions/4410803/a-simple-question-about-lib-folder-in-eclipse) with *Add library*

http://stackoverflow.com/a/24727985
upvote count: 2
has body: I tested and tested, and finally found a solution. There are two ways to solve this problem for those interested. I won't go into the way that involved searching through API of TextComponent to discover how it was done there. That was very difficult for me to try to implement myself, and I eventually had to go another route. I resorted to mapping characters and virtual keys to Actions. This is what I was looking for: a simple way to loop through characters of interest, and thus save code and complexity in simply mapping keystrokes to actions: If you're not concerned with capturing some key I have listed below simply remove the character or virtual key from the proper array. You can even add new characters First instantiate a JComponent (I used a JFrame called mainPane in this example). I want to capture all keystrokes inputted into the frame, so I used JComponent.WHEN_IN_FOCUSED_WINDOW. note the static import of KeyEvent constants in the code below. import static java.awt.event.KeyEvent.*; mainPane.setFocusTraversalKeysEnabled(false); JRootPane rootPane = mainPane.getRootPane(); InputMap theWIMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap theAMap = rootPane.getActionMap(); Then you can add code that captures letter keystrokes... for(char c = 'A'; c &lt;= 'Z'; c++) { // upper case KeyStroke capital = KeyStroke.getKeyStroke("typed " + c); theWIMap.put(capital, Character.toString(c)); theAMap.put(Character.toString(c), new KeyAction(c)); // lower case KeyStroke little = KeyStroke.getKeyStroke("typed " + Character.toLowerCase(c)); theWIMap.put(little, Character.toString(Character.toLowerCase(c))); theAMap.put(Character.toString(Character.toLowerCase(c)), new KeyAction(Character.toLowerCase(c))); } ... then write code to capture the typing of common symbols on many keyboards (the ones you can see by looking down at the typeface on the keys on your keyboard. I have them listed here in order of their "VK constant values" as specified in Java API S…
accepted answer of: http://stackoverflow.com/q/24470164
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24470164
type: Answer
has comment: http://stackoverflow.com/comment/97704488
score: 2

http://stackoverflow.com/comment/37844118
type: QuestionComment
has text: Why would you transform it into a file? I'd try to avoid that... you can just read it into memory, surely.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24455021

http://stackoverflow.com/a/24584306
has body: Your TestSerializer cannot get that type internally due to type erasure. That information has to be provided externally. This means you'll have to refactor how you do it through configuration.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24583979

http://stackoverflow.com/a/24527305
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24527012
downvote count: 0
has body: As you are importing libraries from the sun.com.* package which is usually discourages by oracle.These are in rt.jar, which is being used as run-time facilities by the JVM, so you should avoid having dependency on that package try using some other alternate libraries. You can try ImageIO as an alternate

http://stackoverflow.com/comment/37983052
comment on: http://stackoverflow.com/a/24530046
type: AnswerComment
has text: or if it is a primitive type: `String.valueOf(req.getResponse());`
score: 0
type: Comment

http://stackoverflow.com/q/24549652
type: Question
tagged with: domparser
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24550285
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I need to extract the first page content from the docx file and save it as a seperate document. I need everything from the first page( images, tables, text) to be saved as it is in new docx file. What i tried is : I looked into the xml of the unzipped docx file. Since word document is reflowable i couldnt find a page break after each page ends. So i couldnt find the end of each page via the document.xml Is there any way to get the XML content of the first page of the document alone using java XML DOM parser ?
upvote count: 2
has answer: http://stackoverflow.com/a/24550285
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: document
has title: Extract the first page content from docx file by XML parsing

http://stackoverflow.com/comment/37804976
has text: You could use `List<? super T>` to prevent someone trying to call `List<String> s = cast(myNumbers, String.class)`.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24433641
type: Comment

http://stackoverflow.com/comment/38144874
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24541800
has text: @Baz : Yes baz i am working on it :) Will let you know

http://stackoverflow.com/comment/37831951
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24439735
has text: @PCGIZMO Sorry, i named arrayIndex -> index and moved it as an protected field into the main class. look here for extends jframe : [link](https://stackoverflow.com/questions/5895282/should-i-subclass-jframe-jpanel-or-not)

http://stackoverflow.com/comment/37912569
has text: You have fo change <g:StackLayoutPanel styleName='{style.menuview}' unit='EM'> to <g:StackLayoutPanel ui:field='panel' styleName='{style.menuview}' unit='EM'>
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24488623

http://stackoverflow.com/comment/37862770
type: Comment
comment on: http://stackoverflow.com/a/24465011
score: 0
type: AnswerComment
has text: I can't see the folder creation in this config piece

http://stackoverflow.com/comment/37812180
has text: The iteration order for a HashMap is not guaranteed. So if you're just looking for "some" value in the map, do getValues().iterator().next() and you won't be able to predict which value you get. What is the actual problem you are trying to solve?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24437594
score: 0

http://stackoverflow.com/comment/38069948
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24527391
has text: @DavidWallace Yes, what you say is fine, but it's not the whole story. The fact is, there is no guarantee the test will satisfy one of the two conditions you described, and that doesn't necessarily make it a poor test. For example, and this is very common, a test may stub X to return Y simply because a method executed during the test needs it, but this is something not meant to be verified in this particular test. Maybe some other test does verify it and will fail, but you still can end up with a test passing when it should fail.
type: Comment

http://stackoverflow.com/a/24427724
score: 0
answers question: http://stackoverflow.com/q/24427619
has comment: http://stackoverflow.com/comment/37794058
has body: First time when you put "-", the method onTextChanged will be called, and parsing will be done on "-", that is not a valid int. So you need to escape parsing if string is "-". Use below code into onTextChanged(...). Better is to move this code into afterTextChanged(...) int value = 0; if (! TextUtils.isEmpty(arg0)) { String text = arg0.toString(); if ("-".equals(text)) { // Nothing to do } else { value = Integer.parseInt(text); } seekBar.setProgress(value); }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24427619

http://stackoverflow.com/q/24506074
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has body: two created screens that has two button, each button links to the other, so two screens with two buttons, I don't know how to add a link to the third screen, eclipse was running it but no use main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="I&amp;apos;m screen 1 (main.xml)" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Click me to another screen" /&gt; &lt;/LinearLayout&gt; main2.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;Button android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="(main2.xml) how do get to the 3rd" /&gt; &lt;/LinearLayout&gt; AppActivity.java package com.mkyong.android; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class AppActivity extends Activity { Button button; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, App2Activity.class); startActivity(inten…
has answer: http://stackoverflow.com/a/24506151
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
score: 0
accepted answer: http://stackoverflow.com/a/24506151
has title: How to make a thind link throw a button in a third screen?

http://stackoverflow.com/comment/37795409
has text: Thanks, it is exactly what I needed, I owe you one :-) If you should be from Germany just tell me where I can invite you to a beer :-)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24428014
score: 0

http://stackoverflow.com/comment/38039887
type: Comment
comment on: http://stackoverflow.com/q/24560138
type: QuestionComment
has text: @Insert username here I agree. That's the only problem I can see -- you may be attempting to subtract a null value from an integer, in which case bad things would happen. :-)
score: 0

http://stackoverflow.com/a/24463532
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24463524
answers question: http://stackoverflow.com/q/24463524
has comment: http://stackoverflow.com/comment/37860062
has comment: http://stackoverflow.com/comment/37859942
type: AcceptedAnswer
has body: Check before doing this in your scriplet if(request.getParameterValues("color1")!=null){ //Go On } As your select is in same .jsp and so on start up load it will give you null for sure. &lt;select name="color1" id="dd1" multiple&gt; Moreover you are comparing array with "" if(!x.equals("")) //No use Check for Not Null if(x!=null)//Cahange this If you are using form why not pass request and perform checks and other stuff in Servlet.

http://stackoverflow.com/q/24551915
has title: How to get Form data as a Map in Spring MVC controller?
has comment: http://stackoverflow.com/comment/38026853
type: Question
has answer: http://stackoverflow.com/a/55547091
score: 37
upvote count: 37
downvote count: 0
has comment: http://stackoverflow.com/comment/38026604
has answer: http://stackoverflow.com/a/24552056
has answer: http://stackoverflow.com/a/35621197
possible better answer: http://stackoverflow.com/a/24552056
favorite count: 0
has body: I have a complicated html form that dynamically created with java script. I want to get the map of key-value pairs as a Map in java and store them. here is my controller to get the submitted data. @RequestMapping(value="/create", method=RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public String createRole(Hashmap&lt;String, Object) keyVals) { .... } but my map is empty. How can i get form data as a map of name-value pairs in Spring mvc controller?
has comment: http://stackoverflow.com/comment/38025543
has comment: http://stackoverflow.com/comment/38024272
has answer: http://stackoverflow.com/a/55808190
tagged with: spring
answer count: 4
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/35621197
tagged with: java
has comment: http://stackoverflow.com/comment/38024119

http://stackoverflow.com/comment/37807856
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24434913
has text: Maybe I overrated the part of the question that said *"...Quadrillion **and further**"* ...
type: AnswerComment

http://stackoverflow.com/comment/37901975
comment on: http://stackoverflow.com/q/24485178
score: 0
type: QuestionComment
type: Comment
has text: @Mitch - You haven't posted `<uses-permission>` tag as I see in your image. Was that intentional ?

http://stackoverflow.com/a/24516950
answers question: http://stackoverflow.com/q/24516798
has comment: http://stackoverflow.com/comment/37959241
has comment: http://stackoverflow.com/comment/37962447
downvote count: 0
has comment: http://stackoverflow.com/comment/37960417
type: Answer
score: 4
has body: In this example I would say author uses $ prefix to identify variable that comes from outside (function parameter) and prefix _ to identify variable that belongs to the this function or entire class. So the answer is NO, it doesn't hold any significant meaning. It is done for convenience only. You may want to look into code naming conventions to learn more about that.
upvote count: 4
has comment: http://stackoverflow.com/comment/37959316
has comment: http://stackoverflow.com/comment/37959215

http://stackoverflow.com/q/24583979
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24584033
has answer: http://stackoverflow.com/a/24584306
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38084109
has title: Is there any way to get Class from reflection?
score: 2
tagged with: reflection
has comment: http://stackoverflow.com/comment/38083918
tagged with: java
has body: Is there any way to get Class from reflection? What i want to do is, I have implemented custom Serializer for hazelcast-3.2.3. and I don't want to write separate Serializer for each class(whom object I need to store in Hcast). I want this class TestSerializer&lt;T&gt; { Class&lt;T&gt; classType; Public Test(){ classType = T.someway() //if there is any method to get that; } } Because I'm configuring my Serializer in hazelcast.xml i cant pass Class in constructor parameters.
type: Question

http://stackoverflow.com/q/24430809
answer count: 1
has comment: http://stackoverflow.com/comment/37801072
has comment: http://stackoverflow.com/comment/37816267
tagged with: android
type: UnansweredQuestion
tagged with: file
has title: Recursively file search not working
tagged with: java
has body: What i wanna do is to recursively search for some files on the external sd-card. The problem is that the code is looking ok, but (assuming .txt files) it only shows me 7 files out of 100+ that are being spread throughout folders. The code is this: file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()); void makelist(File file){ if(file.isFile()){ if(SimpleAdapter.getFileType(file)==null) mis.add(file); else if(SimpleAdapter.getFileType(file).equalsIgnoreCase("text")) doc.add(file); }else if(file.isDirectory()){ for(File f:file.listFiles()) makelist(f); } } Any idea how could i make it run correctly?
tagged with: eclipse
type: Question
tagged with: search
score: 0
has answer: http://stackoverflow.com/a/24431215

http://stackoverflow.com/q/24480469
type: Question
has answer: http://stackoverflow.com/a/24490092
tagged with: maven
has answer: http://stackoverflow.com/a/24514239
tagged with: nosql
has answer: http://stackoverflow.com/a/24495224
score: 0
tagged with: java
answer count: 3
has body: I have running MongoDB server, created test1 database with collection called zips. (taken from http://media.mongodb.org/zips.json). Now I want to read it from my application using Morphia. following morphia tutorial(https://github.com/mongodb/morphia/wiki/GettingStarted): I created maven project, and upadated dependencies(https://github.com/mongodb/morphia/wiki/Dependencies). now my project contain only entity class and main. Entity class: package com.mycompany.morphia; import com.sun.corba.se.spi.ior.ObjectId; import org.mongodb.morphia.annotationsEntity; import org.mongodb.morphia.annotations.Id; @Entity public class MyEntity { @Id String _id; //maybe ObjectId ? String city; Object loc; Integer pop; String state; } and main class package com.mycompany.morphia; import com.mongodb.Mongo; import com.mongodb.MongoClient; import java.io.IOException; import org.mongodb.morphia.Datastore; import org.mongodb.morphia.Morphia; public class App { public static void main( String[] args ) throws IOException { MongoClient m = new MongoClient("localhost", 27017); Datastore ds = new Morphia().createDatastore(m, "test1"); MyEntity e = ds.find(MyEntity.class).get(); System.out.println( e.city.toString()); System.in.read(); } } Still while debugging I got null. I don't know how to check if I'm connected to my db, and how to properly query it.
tagged with: mongodb
accepted answer: http://stackoverflow.com/a/24514239
has title: Morphia with MongoDB connection
type: AnsweredQuestion
tagged with: morphia
possible better answer: http://stackoverflow.com/a/24490092

http://stackoverflow.com/comment/37990531
comment on: http://stackoverflow.com/a/24532119
has text: Yes i am, you see i'm not a good programmer, i just started to try stuff out myself. I would like to thank you allready for your help, but now i have the problem of changing code, so it works with JPanel XD. I have a problem with" BufferStrategy bs = getBufferStrategy();"
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24567287
has comment: http://stackoverflow.com/comment/38053723
type: Answer
accepted answer of: http://stackoverflow.com/q/24567221
answers question: http://stackoverflow.com/q/24567221
upvote count: 4
has comment: http://stackoverflow.com/comment/38053646
has comment: http://stackoverflow.com/comment/38053382
has comment: http://stackoverflow.com/comment/38053529
downvote count: 0
has comment: http://stackoverflow.com/comment/38053597
has comment: http://stackoverflow.com/comment/38053536
score: 4
has body: Why did it remove duplicate value entry? Because that's the very definition of a Map: for a given key, it stores one value. If you put another value for a key that is already in the map, the new value replaces the old one for this key. And since you told the map that a key is equal to another one when their associated value are equal, the map considers two keys to be equal when their value are equal. Note that your solution is a bad one which probably works by accident. Indeed, your comparator doesn't respect the contract of the Comparator interface. Indeed, when two values are equal, you arbitrarily decide to make the first one bigger than the second one. This means that your comparator makes A > B and B > A true at the same time, which is not correct. Sorting a TreeMap by value just looks like an absurdity to me. You won't be able to add any new value to the map anyway, since it would require the entry to already exist in the old map. Shouldn't you simply have a sorted list of map entries?
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38053694

http://stackoverflow.com/comment/38086116
type: QuestionComment
comment on: http://stackoverflow.com/q/24585237
score: 0
has text: you can just put string values in ArrayList<String> and if you wanna put other values ,you have to convert them into string!
type: Comment

http://stackoverflow.com/a/24527796
has body: Try this: public class StringUtils { private StringUtils() {} public static String arrayToString(String[] a, String separator) { if (a == null || separator == null) { return null; } StringBuffer result = new StringBuffer(); if (a.length &gt; 0) { result.append(a[0]); for (int i=1; i &lt; a.length; i++) { result.append(separator); result.append(a[i]); } } return result.toString(); } public static void main(String args[]) throws Exception { System.out.println( StringUtils.arrayToString(new String[] { "a" , "b", "c" } , ",") ); } } Also check Arrays.toString() which: Returns a string representation of the contents of the specified array. int[] intArray={1, 2, 3, 4, 5}; String str = Arrays.toString(array); System.out.print(str);
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37979438
answers question: http://stackoverflow.com/q/24527739
has comment: http://stackoverflow.com/comment/37979988
has comment: http://stackoverflow.com/comment/37979079
type: Answer

http://stackoverflow.com/comment/37836896
type: QuestionComment
type: Comment
has text: Yes onFormSubmit function in MainActivity.java gets called when the "Submit" button is clicked. Yes the javascript interface works... Did not get what you meant by "Are you able/permitted to adapt the html source when needed?"
comment on: http://stackoverflow.com/q/24448567
score: 0

http://stackoverflow.com/comment/38013837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24545363
has text: This is going to be hard to explain, but, you create a `head` using `new ListNode<E>(null);`, which means when you call `getData` on it, it will return `null`. You never reset this. Instead, when you add a new element, you need to determine if there is anything already in your `NodeChain`, if there is not, you need make the node the head
score: 0

http://stackoverflow.com/comment/37885657
comment on: http://stackoverflow.com/q/24477235
score: 0
type: Comment
type: QuestionComment
has text: You should pass some other info tag as Extras to identify which layout to load. or another way is to create a separate activity for pageTwo.

http://stackoverflow.com/a/65534799
score: 0
has body: Checkstyle 3.2 added support for SuppressionFilters. Public Maven repos list the release date as November 8, 2005, but they also list that same release date for several other versions, so presumably, this was the date of some migration, but the release has been available at least since then. The default Checkstyle version in the maven-checkstyle-plugin has been 4.1 at least since January of 2006. You can configure the suppression filter via Maven, independently of the checkstyle config XML other answers have referenced. A suppression config something like this should help with the scenario you shared in your question: <?xml version="1.0"?> <suppress checks="FileTabCharacter" files=".*\.java" />
type: Answer
answers question: http://stackoverflow.com/q/24566839

http://stackoverflow.com/comment/37963299
has text: @JigarJoshi Finish button work in Server Runtime Environment wizard but not on a Server wizard
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24519063

http://stackoverflow.com/q/24539574
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24842750
downvote count: 0
score: 8
favorite count: 0
tagged with: javassist
upvote count: 8
has body: I am facing a problem where I have to modify a package-info. package-info.java @javax.xml.bind.annotation.XmlSchema(namespace = "http://some.url/soap/style/document_literal") package org.example.wsdl.wsdl; The following code works fine with 1.7.0_45. // do not load any classes before, this could break the following code. Class&lt;?&gt; pkgInfo = Class.forName("org.example.wsdl.package-info", true, NameSpaceModifier.class.getClassLoader()); Field field = Class.class.getDeclaredField("annotations"); field.setAccessible(true); final XmlSchema oldAnnotation = (XmlSchema) pkgInfo.getAnnotations()[0]; logger.debug("Old Annotation namespace value was: " + oldAnnotation.namespace()); XmlSchema newAnnotation = new XmlSchema() { @Override public XmlNs[] xmlns() { return oldAnnotation.xmlns(); } @Override public String namespace() { return "newNs"; } @Override public XmlNsForm elementFormDefault() { return oldAnnotation.elementFormDefault(); } @Override public XmlNsForm attributeFormDefault() { return oldAnnotation.attributeFormDefault(); } @Override public String location() { return oldAnnotation.location(); } @Override public Class&lt;? extends Annotation&gt; annotationType() { return oldAnnotation.annotationType(); } }; @SuppressWarnings("unchecked") Map&lt;Class&lt;? extends Annotation&gt;, Annotation&gt; annotations = (Map&lt;Class&lt;? extends Annotation&gt;, Annotation&gt;) field.get(pkgInfo); annotations.put(XmlSchema.class, newAnnotation); XmlSchema modifiedAnnotation = (XmlSchema) pkgInfo.getAnnotations()[0]; When compiling and executing the same Code with 1.8.0_05 I get this error message: java.lang.NoSuchFieldException: annotations at java.lang.Class.getDeclaredField(Class.java:2057) I know its a Hack, at least it looks like one. But does Java 8 work here as expected? How do I have to change that code that it does work with Java 8 then? Javassist answers are welcome too ;)
possible better answer: http://stackoverflow.com/a/49298020
has title: Unable to modify annotation of package-info.java using Java 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/49298020
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/24842750

http://stackoverflow.com/comment/44931244
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24472733
has text: Wow, definitely points for creativity on that one ;) We decided that such static functions were rare enough that we could would handle them individually (by wrapping the declarations in macros that disable and then re-enable the typemap). Last thing is to figure out how to handle public member variables. Currently looking for a way to disable the automatic getter/setter creation for those...

http://stackoverflow.com/comment/37841042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24450500
has text: what does your httpServiceClient do?
score: 0

http://stackoverflow.com/comment/38080335
has text: "private key, myserver.key, ..." - they should be the same thing. What's the difference between them?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24578375

c++
tags question: http://stackoverflow.com/q/24556672
tags question: http://stackoverflow.com/q/24456152
tags question: http://stackoverflow.com/q/24461687
tags question: http://stackoverflow.com/q/24555951
tags question: http://stackoverflow.com/q/24552723
tags question: http://stackoverflow.com/q/24451609
type: Tag
tags question: http://stackoverflow.com/q/24517456
tags question: http://stackoverflow.com/q/24528412
tags question: http://stackoverflow.com/q/24544629
tags question: http://stackoverflow.com/q/24570041
tags question: http://stackoverflow.com/q/24510117
tags question: http://stackoverflow.com/q/24502811
tags question: http://stackoverflow.com/q/24471657
tags question: http://stackoverflow.com/q/24512295
tags question: http://stackoverflow.com/q/24490020
tags question: http://stackoverflow.com/q/24533017
tags question: http://stackoverflow.com/q/24491965
tag name: c++
tags question: http://stackoverflow.com/q/24457722
tags question: http://stackoverflow.com/q/24505264
tags question: http://stackoverflow.com/q/24499833

http://stackoverflow.com/q/24523474
type: Question
has comment: http://stackoverflow.com/comment/37971114
has comment: http://stackoverflow.com/comment/37971190
upvote count: 0
has title: Iterate in hashmap
score: -7
has answer: http://stackoverflow.com/a/24523529
answer count: 3
has answer: http://stackoverflow.com/a/24524790
has comment: http://stackoverflow.com/comment/37971218
has comment: http://stackoverflow.com/comment/38028577
favorite count: 0
has comment: http://stackoverflow.com/comment/37971090
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24523554
downvote count: 7
has comment: http://stackoverflow.com/comment/37971102
has body: I have a hashmap and want to get the key and value by iterating. I keep adding entries to oneList and oneMap multiple times. I'm getting only the first "string variable" multiple times. Map&lt;Integer, List&lt;Object&gt;&gt; oneMap = new LinkedHashMap&lt;Integer, List&lt;Object&gt;&gt;(); List&lt;Object&gt; oneList = new LinkedList&lt;Object&gt;(); oneList.add("one"); oneList.add(FieldType); oneMap.put("1", oneList); //iterating through the map for (Map.Entry&lt;Integer,List&lt;Object&gt;&gt; entry : oneMap.entrySet()) { System.out.println("Compare Key :: " +entry.getKey()); oneList = entry.getValue(); String oneSrvFld = (String) oneList.get(0); System.out.println("one srvFld :: " +oneSrvFld); }
has comment: http://stackoverflow.com/comment/37971253
has comment: http://stackoverflow.com/comment/37971103
tagged with: java

http://stackoverflow.com/q/24428608
has title: project is crashing in android
has answer: http://stackoverflow.com/a/24428924
has body: I want to make an application which will check abusive words in a string entered by user and if there is no abusive words then it will post to other applications and if the string entred by user contains abusive words then a pop will be generated . Here is my code in normal java abusive word checking is working good but in android it is just crashing. I am giving error report of logcat 06-26 14:44:27.333: W/System.err(338): at android.app.ActivityThread.main(ActivityThread.java:3683) 06-26 14:44:27.343: W/System.err(338): at java.lang.reflect.Method.invokeNative(Native Method) 06-26 14:44:27.343: W/System.err(338): at java.lang.reflect.Method.invoke(Method.java:507) 06-26 14:44:27.353: W/System.err(338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 06-26 14:44:27.353: W/System.err(338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 06-26 14:44:27.363: W/System.err(338): at dalvik.system.NativeStart.main(Native Method) 06-26 14:44:27.373: D/AndroidRuntime(338): Shutting down VM 06-26 14:44:27.373: W/dalvikvm(338): threadid=1: thread exiting with uncaught exception (group=0x40015560) 06-26 14:44:27.383: E/AndroidRuntime(338): FATAL EXCEPTION: main 06-26 14:44:27.383: E/AndroidRuntime(338): java.lang.NullPointerException 06-26 14:44:27.383: E/AndroidRuntime(338): at com.vssgatekeeper.Main$1.onClick(Main.java:62) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.view.View.performClick(View.java:2485) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.view.View$PerformClick.run(View.java:9080) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.os.Handler.handleCallback(Handler.java:587) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.os.Handler.dispatchMessage(Handler.java:92) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.os.Looper.loop(Looper.java:123) 06-26 14:44:27.383: E/AndroidRuntime(338): at android.app.ActivityThread.main(ActivityThread.java:3683) 06-26 14:44:27.383: E/AndroidRuntime(…
tagged with: java
has comment: http://stackoverflow.com/comment/37795181
upvote count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37795221
has answer: http://stackoverflow.com/a/24428920
has answer: http://stackoverflow.com/a/24428843
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/37795246
type: Question
has answer: http://stackoverflow.com/a/24428851
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/24428869

http://stackoverflow.com/a/24453852
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24453685
has body: Change your GetData to package com.example.testapp; import java.io.BufferedReader; public class GetData { private static GetData _instance; public List&lt;String&gt; myArray = null; public static GetData getMyData() //This is what the fragment calls to get the array. { if(_instance == null) _instance = new GetData(); return _instance; } private GetData() { myArray = new LinkedList&lt;String&gt;(); } public void runData() { GetData data = GetData.getMyData(); myArray.add(0, "test"); //Array given value } } Your array was not correctly initialized. If you want to use a String[] array, you must specify a length, using new String[5] for example. But if you don't know the final length, I suggest you to use my above code.

http://stackoverflow.com/comment/37932932
has text: The problem is, just about any answer you get would be a tutorial dump anyway...
comment on: http://stackoverflow.com/q/24502187
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37933893
has text: for (int i = 0; i < octalNum.length(); i++) { if (octalNum.charAt(i) == 8 || octalNum.charAt(i) == 9) { System.out.print("Please enter a postive octal number: "); octalNum = in.next(); } }
comment on: http://stackoverflow.com/q/24503053
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38037758
has text: I prefer not to use a libary just for this small part of the program. I'll try and search for another way without extra libaries.
comment on: http://stackoverflow.com/q/24558448
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24578745
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24578965
has comment: http://stackoverflow.com/comment/38074318
type: Question
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/38074254
has title: How do you send an int[] between a server and client in Java?
has body: I have been trying to find a way to send an int[] from the server to the client. I have a basic multiplayer game that works over LAN. There is currently no player limit other than those imposed by Java itself. Each player has a square that they can control using WASD. In the server, I am currently using a byte[] to store all of the player positions. The problem with this is that the positions can't go past 128 or -127. However, the DataOutputStream can write byte[]s but not int[]s. I have seen that there is a writeInt() function, but this can only send a single number rather than a bunch of them in one variable. I am worried about using this because I don't want the clients to receive the integers in the wrong order and mess stuff up. So the real question is: What is the best way to send a bunch of integers between the clients and server? I would also like to keep the speed as fast as possible. I can post my current code if you need to see it. By the way this is my first post so if I did something wrong please let me know.
downvote count: 1

http://stackoverflow.com/comment/37917347
comment on: http://stackoverflow.com/a/24493945
has text: I'm getting the Graphics of PdfTemplate (class from itextpdf library), but component.paint(g) doesn't work because component is invisible. Looks like I've missed something.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/37894637
type: Comment
type: QuestionComment
score: 1
has text: Try the browser console to trace the no. of request send to the server, by pressing `F12` on the browser, goto `Net/Network` tab, then type the url in the address bar and monitor the `net` tab.
comment on: http://stackoverflow.com/q/24481717

http://stackoverflow.com/q/24434788
has title: How many legal ways are there to create an instance of set/list/map with and without Generics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24435074
tagged with: java
has body: I am a bit confused about instance creating since I started to learn Generics because I realize for example, you can create a HashMap like this, HashMap hashmap = new HashMap(); but also, HashMap&lt;String,String&gt; hashmap = new HashMap&lt;String, String&gt;(); While I can also declare instance hashmap like this since HashMap is implemented from Map Interface Map&lt;String,String&gt; hashmap = new HashMap&lt;String, String&gt;(); But if above is true, then I can also create instance of ArrayList this way, is it right? List&lt;String&gt; arraylist = new ArrayList&lt;String&gt;(); And, how about a custom defined one, lets say class Walk implemented from interface Move so to create an instance object of Walk I can use code like both, Walk walk = new Walk(); Move walk = new Walk(); And these won't cause problems, are these two declarations the same? And is Implementation the key feature to enable the feature while how about class extended from another for exapmle, class Son extended from class Father, is this one legal then? Father son = new Son();
has answer: http://stackoverflow.com/a/24435088
has answer: http://stackoverflow.com/a/24434893
has answer: http://stackoverflow.com/a/24435050
type: Question
possible better answer: http://stackoverflow.com/a/24435074
score: 2
tagged with: implementation
downvote count: 0
accepted answer: http://stackoverflow.com/a/24435050
tagged with: inheritance
linked to: http://stackoverflow.com/q/2770321
favorite count: 0
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/24435593

http://stackoverflow.com/comment/37848175
type: Comment
comment on: http://stackoverflow.com/a/24440060
has text: Thanks again @Christian Schneider (+1) - one last followup here: You say that my app and any extensions must all be OSGi bundles, but then you mention that I can embed the OSGi framework inside my app. Does this mean that I can have a non-OSGi app running an embedded OSGi framework (and thus, binding to OSGi bundles/plugins)? Or would my app *still* need to be OSGi? Thanks again!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37949404
has text: I just need the line to be smooth between the four points, I guess that is called cubic interpolation (but I might be wrong..)
score: 0
comment on: http://stackoverflow.com/q/24511817
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38066683
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24574792
score: 0
has text: in the onPostExecute()? Like `if(null != getActivity) { ParsingAdapterCategorie adapter = new ParsingAdapterCategorie(getActivity(), titoli, bitmap, data); lista.setAdapter(adapter); }` ?

http://stackoverflow.com/q/24429011
has answer: http://stackoverflow.com/a/24429787
has comment: http://stackoverflow.com/comment/37795900
has title: JSch sftp job summary
possible better answer: http://stackoverflow.com/a/24429488
type: AnsweredQuestion
tagged with: java
type: Question
has body: private final String host; private final String userAccount; private final String keyDir; private ChannelSftp sftpChannel; private Session session; private Channel channel public void send(List&lt;Path&gt; filesToSend, String destination) throws SftpException, IOException { if (sftpChannel == null) { logger.error("Failed to create SFTP channel"); } for (Path file : filesToSend) { send(file, destination); } //summary of sent files over sftpchannel } public void send(Path file, String destination) throws SftpException, IOException { if (sftpChannel == null) { logger.error("Failed to create SFTP channel"); } sftpChannel.put(Files.newInputStream(file), destination + File.separator + file.getFileName()); } //end send }//end class After all the files have been sent, can somebody show me how I can get a count of how many number of files have successfully been sent. Not important but also if any failed or any kind of monitoring. How can I do this with Jsch library. I would like something in my log such as : Preparing to send [14] files Number of files sent is [14]...
has answer: http://stackoverflow.com/a/24429488
score: 0
accepted answer: http://stackoverflow.com/a/24429787
tagged with: sftp
answer count: 2
tagged with: jsch

http://stackoverflow.com/a/24437332
has body: Solved! via combination of the two good answers. I used the code from this answer, and incorporated do..while from the other answer. Then I made a new If and else if statement under the existing "else" statement! Thankyou everyone for your kind and speedy help. P.s any easier way than two seperate if/else statements? I will put my final code here for anyone who has a similar question to me. import java.util.Scanner; public class CopyOfMain { public static void main(String joel[]){ System.out.println("Do you think my dog Olly is cute? Yes or No"); Scanner ans = new Scanner(System.in); String response = ans.nextLine(); { do { if (response.equalsIgnoreCase("Yes")){ System.out.print("Woof :-)"); }else if(response.equalsIgnoreCase("No")){ System.out.print("Grrrr :-("); }else{ System.out.print("What? Please try again."); response = ans.nextLine(); if (response.equalsIgnoreCase("Yes")){ System.out.print("Woof :-)"); }else if(response.equalsIgnoreCase("No")){ System.out.print("Grrrr :-("); } } } while (!response.equalsIgnoreCase("Yes") &amp;&amp; !response.equalsIgnoreCase("No")); } ans.close(); } } EDIT: Elliot Frisch has solved the problem well, with a shorter code. Look at his edited answer!
score: 0
answers question: http://stackoverflow.com/q/24436562
type: Answer

http://stackoverflow.com/a/59371495
upvote count: 2
answers question: http://stackoverflow.com/q/24471109
has body: Add an interface in your adapter class. public interface SelectedUser{ void selectedUser(UserModel userModel); } implement your interface in the mainactivity and overide selectedUser method. @Override public void selectedUser(UserModel userModel) { startActivity(new Intent(MainActivity.this, SelectedUserActivity.class).putExtra("data",userModel)); } Full tutorial check out here plus source code. Recyclerview with clicklistener and searchview
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/26610150
has body: I have written this method which does what you are looking for without creating costly Calendar objects public static long getStartOfDay(long t) { TimeZone tz = TimeZone.getDefault(); t +=tz.getOffset(t); t -= (t % 86400000); t -= tz.getOffset(t); return t; } To get the time in millisecond for the start of today you could do this getStartOfDay(System.currentTimeMillis());
answers question: http://stackoverflow.com/q/24493691
score: 0
type: Answer

http://stackoverflow.com/comment/79627381
comment on: http://stackoverflow.com/a/24538674
has text: But calling getEnclosingClass() A$B will nevertheless load A. So this information must be somewhere. Is it in the name?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37873698
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24470789
has text: Is your file already created?
score: 0

http://stackoverflow.com/q/24462513
has answer: http://stackoverflow.com/a/24462884
has comment: http://stackoverflow.com/comment/37858138
has comment: http://stackoverflow.com/comment/37858829
has comment: http://stackoverflow.com/comment/85948824
has comment: http://stackoverflow.com/comment/37858067
has title: time complexity for java arrayList remove(element)
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24462605
score: 19
type: Question
has answer: http://stackoverflow.com/a/24462516
upvote count: 19
answer count: 3
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has body: I was trying to graph the Time Complexity of ArrayList's remove(element) method. My understanding is that it should be O(N), however, its giving me a O(1). Can anyone point out what i did wrong here?? Thank you in advance. public static void arrayListRemoveTiming(){ long startTime, midPointTime, stopTime; // Spin the computer until one second has gone by, this allows this // thread to stabilize; startTime = System.nanoTime(); while (System.nanoTime() - startTime &lt; 1000000000) { } long timesToLoop = 100000; int N; ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); // Fill up the array with 0 to 10000 for (N = 0; N &lt; timesToLoop; N++) list.add(N); startTime = System.nanoTime(); for (int i = 0; i &lt; list.size() ; i++) { list.remove(i); midPointTime = System.nanoTime(); // Run an Loop to capture other cost. for (int j = 0; j &lt; timesToLoop; j++) { } stopTime = System.nanoTime(); // Compute the time, subtract the cost of running the loop // from the cost of running the loop. double averageTime = ((midPointTime - startTime) - (stopTime - midPointTime)) / timesToLoop; System.out.println(averageTime); } }
type: UnansweredQuestion

http://stackoverflow.com/q/24463781
score: -1
has answer: http://stackoverflow.com/a/24463902
answer count: 1
favorite count: 0
has body: I'm currently developing simple android app that I wanted to add iframe tag into my app. I'm using WebView android library, everything seems coded in correct way. But when I try to import android.webkit.WebView... It tells me conflicts with the type defined in the same file. I'm try to clean my projects and refresh it and restart the Eclipse program. Still having the same problem. package com.example.projectrandom; import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; //Error this line public class WebView extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.webview); WebView webView = (WebView) findViewById(R.id.webView_spinnerwheel); }
type: UnansweredQuestion
tagged with: android
tagged with: conflict
has title: WebKit Conflicts with the type defined in the same file
tagged with: java
has comment: http://stackoverflow.com/comment/37860390
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/comment/38926061
has text: Can you please share the link to any tutorial or content related to this ?
comment on: http://stackoverflow.com/a/24554710
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24502030
upvote count: 16
has comment: http://stackoverflow.com/comment/37971346
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24499692
answers question: http://stackoverflow.com/q/24499692
type: Answer
has comment: http://stackoverflow.com/comment/37960516
has body: Resource names don't start with a slash, so you'll need to get rid of that. The resource should preferably be read with UnitTests.getClassLoader().getResourceAsStream("the/resource/name"), or, if a File is required, new File(UnitTests.getClassLoader().getResource("the/resource/name").toURI()). On Java 8, you could try something like: URI uri = UnitTests.class.getClassLoader().getResource("the/resource/name").toURI(); String string = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8"));
score: 16

http://stackoverflow.com/comment/37914300
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24492365
type: Comment
has text: You don't _write_ a default constructor. You write a parameter-less constructor or you let the compiler provide you with a default constructor.

http://stackoverflow.com/q/24552899
has answer: http://stackoverflow.com/a/24554219
linked to: http://stackoverflow.com/q/24456886
score: 0
answer count: 1
type: UnansweredQuestion
has body: Im using extdirectspring and spring in a java webapp. I've recently been trying to set up exception handling basically following this tutorial. I have a few context files. But upon adding the following setup to my module which includes the exception handler One called server-context looks like this <context:component-scan base-package="blah.eventsModule" /> /WEB-INF/errorPages/ <mvc:annotation-driven /> This is the one I'd added the exception handling stuff to Its supposed to be picking up this class: @Component public class ErrorReporter { @Autowired private MyConfig _config; @ExceptionHandler(Throwable.class) public ModelAndView ShowErrorPage(Exception exception) { if (_config.debug()) return new ModelAndView("ShowStackTrace.jsp", "exception", exception); return new ModelAndView("Whoops.jsp"); } } I initially left out <mvc:annotation-driven /> to see if it was necessary. A break point in ShowErrorPage wasn't hit so I put it back in. Now I get the following error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routerController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter ch.ralscha.extdirectspring.controller.RouterController.handlerAdapter; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] is defined: expected single matching bean but found 2: That's happening in extdirectspring (a third party library). I've not created RequestMappingHandlerAdapter explicitely but obviously now I've got two of them. I don't care what extdirect is trying to do with this. So if there is a way of scoping what I'm doing then that would be good. The only other thing I can think is that spring doesn't like the…
tagged with: spring-mvc
tagged with: java
has title: Configuring exception handling in spring
type: Question

http://stackoverflow.com/q/24555822
tagged with: gzipinputstream
has answer: http://stackoverflow.com/a/24740971
has body: I have a directory containing gzip compressed log files with one event per line. In order to read and process these real-time, I have created a WatcherService that are identical to the code listed here: http://docs.oracle.com/javase/tutorial/essential/io/notification.html In the processEvents() method, I have added this code to read the files that have been added or appended, line by line: if (kind == ENTRY_MODIFY) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(Files.newInputStream(child, StandardOpenOption.READ))))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch(EOFException ex) { //file is empty, so ignore until next signal } catch(Exception ex) { ex.printStackTrace(); } } Now, as you can imagine, this works great for files that are created written and closed within milliseconds, however, when working with large files that are appended over time, this will read the entire file over and over again for every appended line (given that the file is flushed and synced by the producer now and then). Is there any way I can read only the new lines in this file every time a ENTRY_MODIFY signal is sent, or find out when the file is "complete"? How do I deal with files that are not appended, but rather overwritten?
accepted answer: http://stackoverflow.com/a/24740971
has title: WatcherService to tail Gzip log files
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/240294
has comment: http://stackoverflow.com/comment/38333533
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/937747
answer count: 1
linked to: http://stackoverflow.com/q/11100760

http://stackoverflow.com/q/24454212
possible better answer: http://stackoverflow.com/a/24454502
type: AnsweredQuestion
has body: I have the following list of Strings: {"New York","London","Paris","Berlin","New York"} I am trying to use the Guava Library and I want to filter this list in such a way that I will get only the strings which will equal to a string that I will provide. If I had a fixed value let's say "New York" I would do the following: Predicate&lt;String&gt; myCity = new Predicate&lt;String&gt;() { @Override public boolean apply(String city) { return city == "New York"; } }; But what if I want the return statement to be something like this : return city == myStringVariable Can I give the argument for the city to the Predicate or combine two predicates somehow ?
upvote count: 2
tagged with: predicate
accepted answer: http://stackoverflow.com/a/24454322
has title: Dynamically filter List with Predicate
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37842551
tagged with: guava
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24454288
answer count: 3
has answer: http://stackoverflow.com/a/24454322
favorite count: 0
has answer: http://stackoverflow.com/a/24454502
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/37924679
has text: @Jesper, May be worth adding that `30 Feb == 2 Mar` on non-leap years only.
score: 1
comment on: http://stackoverflow.com/q/24497682
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38003685
has text: I'll have to checked that it is still happening, but I first saw this behavior in JBoss, then confirmed it with a test case.
type: AnswerComment
comment on: http://stackoverflow.com/a/24524321
score: 0
type: Comment

http://stackoverflow.com/comment/37900164
type: Comment
has text: What you are trying to do is on your SearchJobList fragment execute SearchJobAsync and when data come from response try to show result on your SearchJobList fragment is it or anything else ?
score: 0
comment on: http://stackoverflow.com/q/24484390
type: QuestionComment

http://stackoverflow.com/comment/37808410
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24435711
has text: What does "continues repeated character" mean?
type: Comment

http://stackoverflow.com/comment/38078592
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24580952
has text: Define "it doesn't recognize it". What happens, and when, and what do you expect instead. Also please respect the Java naming conventions: variables and methods start with a lowercase letter.

http://stackoverflow.com/comment/38047084
has text: We don't just write code for you here.
comment on: http://stackoverflow.com/q/24563747
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24545692
has comment: http://stackoverflow.com/comment/38021713
has comment: http://stackoverflow.com/comment/38023000
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24545120
has body: Bitmap stores the pixel data in the native heap*, not in the java heap, and takes care of managing it by itself. That would mean GC shouldn't give you any serious headaches. The problem is probably constantly using createBitmap(), which is usually a really costly operation. This will make a disk IO call at worst, or a relatively big memory allocation at best. You would like to use it as little as possible, i.e. only when initially reading them from the disk. Instead I advise you to use a Matrix in conjunction with a Canvas. Just change your Matrix and with each step repaint your Bitmaps with it. EDIT: *Only correct for Android 2.3.3 &lt;-> Android 3.0
answers question: http://stackoverflow.com/q/24545120
has comment: http://stackoverflow.com/comment/38023639
type: Answer
has comment: http://stackoverflow.com/comment/38022027
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/38023320

http://stackoverflow.com/comment/37883796
type: QuestionComment
has text: @DavidPostill I don’t see how that question is a duplicate of this one.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24473977

http://stackoverflow.com/comment/37915365
has text: protip: `{20,20}` can be expressed as `{20}`. Save a few chars.
type: AnswerComment
comment on: http://stackoverflow.com/a/24492869
type: Comment
score: 0

http://stackoverflow.com/q/24556037
upvote count: 1
has comment: http://stackoverflow.com/comment/38031731
has answer: http://stackoverflow.com/a/24556098
favorite count: 0
has comment: http://stackoverflow.com/comment/38031598
type: UnansweredQuestion
has title: understanding java if clause syntax
downvote count: 6
has answer: http://stackoverflow.com/a/24556058
has comment: http://stackoverflow.com/comment/38031683
score: -5
has comment: http://stackoverflow.com/comment/38031595
tagged with: java
has comment: http://stackoverflow.com/comment/38031790
type: Question
has comment: http://stackoverflow.com/comment/38031693
has answer: http://stackoverflow.com/a/24556112
has body: I was going through the following code, and I do not understand what sum-in means in this clause: if (sum-in == largest) Here is the context of that line: public static String ArrayAdditionI(int[] arr) { // find max Arrays.sort(arr); int largest = arr[arr.length - 1]; int sum = 0; for (int i = 0; i &lt; (arr.length - 1); i++) { sum += arr[i]; } java.util.List&lt;Integer&gt; list = new java.util.ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; (arr.length - 1); i++) { list.add(arr[i]); } if (largest == sum) return "true"; for (Integer in : list) { if (sum-in == largest){ return "true"; } } return "false"; }
has comment: http://stackoverflow.com/comment/38031672
answer count: 3

http://stackoverflow.com/q/24434931
favorite count: 0
linked to: http://stackoverflow.com/q/13392986
tagged with: eclipselink
has comment: http://stackoverflow.com/comment/48170563
has comment: http://stackoverflow.com/comment/38584256
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: compile-time-weaving
has comment: http://stackoverflow.com/comment/37840422
score: 2
tagged with: java
has body: I am using EclipseLink 2.5.1 on Tomcat 8. Tried to static weave jars, but got error at run time. java.lang.NoSuchMethodError: mypackage.Employee._persistence_checkFetchedForSet(Ljava/lang/String;)V at mypackage.Employee.setAddress(Employee.java) Employee extends a super class that is annotated with @MappedSuperclass. The superclass is in a different jar. I tried to weave the jar, the superclass with @MappedSuperclass was not woven. If I disable static weaving, dynamic weaving is not supported in Tomcat. all lazy properties will become eager fetch. Is there a way to control the fetch graph? Fetch graph is to fetch lazy properties, can not make eager properties to be lazy. Thanks.
has title: eclipseLink 2.5.1 static weaving NoSuchMethodError
has comment: http://stackoverflow.com/comment/48168916
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/37853224
tagged with: tomcat

http://stackoverflow.com/q/24431386
upvote count: 0
has comment: http://stackoverflow.com/comment/37805088
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/37802176
has comment: http://stackoverflow.com/comment/37802897
has comment: http://stackoverflow.com/comment/37801411
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37802493
has comment: http://stackoverflow.com/comment/37803390
downvote count: 1
has comment: http://stackoverflow.com/comment/37801222
type: Question
has comment: http://stackoverflow.com/comment/37800583
has body: I'm trying to use MySQL in Java 8 (using Eclipse Luna Release (4.4.0) with tomcat 8.0.9 on Windows 7 x64). I put the mysql-connector-java-5.1.31-bin.jar into my WEB-INF/lib directory. When compiling the project as a normal Java application everything works. However, when I try to use the same code as a servlet, it throws java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test Moving the .jar file into TomCat's /lib directory didn't help either (compiling as a normal application still worked though). I haven't really changed anything, just upgraded from an older combination of Java, TomCat and Eclipse. Apparently TomCat doesn't load the library/driver correctly; any ideas why that might be?
has answer: http://stackoverflow.com/a/24431566
has comment: http://stackoverflow.com/comment/37802391
has title: Unable to use MySQL Connector/J with Servlets using TomCat
score: -1
tagged with: eclipse
tagged with: servlets
has answer: http://stackoverflow.com/a/24432029
has comment: http://stackoverflow.com/comment/37803952
answer count: 2

http://stackoverflow.com/q/24428930
tagged with: spring-form
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24438239
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24438239
has answer: http://stackoverflow.com/a/24492036
tagged with: java
has title: Spring Form Validation Error: java.lang.IllegalArgumentException: 'items' must not be null
type: Question
linked to: http://stackoverflow.com/q/12146298
has body: I am trying to Validate Spring form which includes: Normal input fields Radio buttons whose options are set in controller (later may come from database) Check box whose options are also set in controller Select field which is also set in controller Method 1 approach is followed. Model: public class Student { private Long id; @NotEmpty private String name; @NotEmpty private String address; @NotEmpty private String contactNumber; @NotEmpty private String grade; @NotEmpty private String gender; @NotEmpty @Email private String email; @NotEmpty private List<String> extraSubjects = new ArrayList<String>(); /**** Corresponding getter setters ****/ } Controller:- @Controller @RequestMapping("/student") public class StudentController { private Logger logger = Logger.getLogger(StudentController.class); @RequestMapping("/home") public String getHomePage() { return "home"; } @RequestMapping(value = "/add", method = RequestMethod.GET) public String addStudentForm(Model model) { Student student = new Student(); model.addAttribute("studentForm", student); LinkedHashMap<Integer, String> gradeList = new LinkedHashMap<Integer, String>(); gradeList.put(1, "Class 1"); gradeList.put(2, "Class 2"); gradeList.put(3, "Class 3"); gradeList.put(4, "Class 4"); gradeList.put(5, "Class 5"); model.addAttribute("gradeList", gradeList); List<String> genderList = new ArrayList<String>(); genderList.add("Male"); genderList.add("Female"); model.addAttribute("genderList", genderList); student.setGender("Male"); List<String> extraSubjects = new ArrayList<String>(); extraSubjects.add("Math II"); extraSubjects.add("Population"); List<String> extraSubjectsStd = new ArrayList<String>(); extraSubjectsStd.add("Math II"); extraSubjectsStd.add("Population"); student.setExtraSubjects(extraSubjectsStd); extraSubjects.add("Computer"); model.addAttribute("extraSubjects", extraSubjects); return "addstudent"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String addStudent( @Valid @ModelAttrib…
score: 4
has comment: http://stackoverflow.com/comment/37803344
has comment: http://stackoverflow.com/comment/37810385
upvote count: 4
accepted answer: http://stackoverflow.com/a/24492036
has comment: http://stackoverflow.com/comment/37811031
answer count: 2
has comment: http://stackoverflow.com/comment/37802399
tagged with: validation

http://stackoverflow.com/comment/37844692
type: QuestionComment
comment on: http://stackoverflow.com/q/24455107
score: 0
has text: (But I think at some point the factory will be used to switch between two different implementations)
type: Comment

log4net-configuration
type: Tag
tag name: log4net-configuration
tags question: http://stackoverflow.com/q/24486850

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/24502234
type: Tag

http://stackoverflow.com/q/24470789
tagged with: android
has comment: http://stackoverflow.com/comment/37873579
has title: Can't Access Android Internal Files
tagged with: java
has comment: http://stackoverflow.com/comment/37873698
has comment: http://stackoverflow.com/comment/37873580
has comment: http://stackoverflow.com/comment/37873601
has comment: http://stackoverflow.com/comment/37873558
type: Question
has answer: http://stackoverflow.com/a/24470886
has comment: http://stackoverflow.com/comment/37873631
score: 0
has body: So I'm trying to use this method here: NavigationalMap map = MapLoader.loadMap ( getFilesDir( ) , "Lab-room-peninsula.svg"); mv.setMap( map ); What its supposed to do is take in a file directory as object and a string. The thing is, I'm running this on a nexus 7, and I can't save Lab-room-peninsula.svg to my application private files because I can't find those private files, even when I connect it to my computer. How do I parse into this method a directory as a file object from a directory that I know exists in my internal storage of my nexus 7?
answer count: 1
has comment: http://stackoverflow.com/comment/37873867
type: UnansweredQuestion

http://stackoverflow.com/q/24520500
has answer: http://stackoverflow.com/a/24537938
tagged with: branch
tagged with: github
type: Question
has title: Iterate through all branches
has comment: http://stackoverflow.com/comment/37965669
tagged with: java
score: 0
answer count: 1
tagged with: git
has body: I want to get all commits of a specific branch with JGit. Let's take for example test-kitchen. It has 5 branches: master spec-coverage legacy-0.7 sethvargo/docs sethvargo/full_chef_path How can I iterate for example through spec-coverage only? In this example I would get all available branches and commits. But I need to choose which branch I want the commits from. Extract: // branch for (Ref branch : git.branchList().setListMode(ListMode.REMOTE).call()){ git.checkout().setName(branch.getName()).call(); System.out.println("Branch: " + branch.getName()); // commits Iterable&lt;RevCommit&gt; commits = git.log().all().call(); for (RevCommit commit : commits) { System.out.println(commit); // doing something with the commits... } }
tagged with: jgit
has comment: http://stackoverflow.com/comment/37965701
type: UnansweredQuestion

http://stackoverflow.com/q/24506234
answer count: 1
has answer: http://stackoverflow.com/a/24509597
type: UnansweredQuestion
tagged with: spring
tagged with: jsf
has body: i need to send the the primeface auto-complete object in to backing bean while user clicks on "Add" button. in this case the primeface auto complete function works properly. but while sending the selected object in to backing bean it always gives me a null pointer this is my page &lt;h:form id="orderForm" &gt; &lt;p:outputLabel value="Item : " for="acItem" /&gt; &lt;p:autoComplete id="acItem" value="#{orderController.item}" completeMethod="#{orderController.completeItem}" var="item" itemLabel="#{item.itemDescription}" itemValue="#{item}" converter="itemConverter" forceSelection="true" /&gt; &lt;p:outputLabel value="Qty : " for="itemQty" /&gt; &lt;p:inputText id="itemQty" value="#{orderController.quantity}"/&gt; &lt;p:commandButton id="add" value="AddItem" update="dataTable" actionListener="#{orderController.addItemsToDataTable(item)}"/&gt; &lt;p:dataTable id="dataTable" value="#{orderController.orderdItems}" var="item" paginator="true" rows="10"&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Item ID"/&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{item.itemId}"/&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Item Code"/&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{item.itemCode}"/&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Customer Name"/&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{item.itemDescription}"/&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;h:commandButton id="save" value="Save" action="#{orderController.createOrder}" /&gt; &lt;h:messages /&gt; &lt;/h:form&gt; and this is my baking bean import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; import org.springframework.stereotype.Component; import com.kpowd.model.Item; import com.kpowd.model.Order; import com.kpowd.model.OrderItem; import com.kpowd.service.ItemService; …
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37969678
has title: how to get the prime face auto complete object in to backing bean
tagged with: primefaces
tagged with: jsf-2
score: 0

http://stackoverflow.com/comment/38013204
type: QuestionComment
has text: use isDaemon() it will make you sure whether it is daemon thread or something else As I know without parent thread daemon cannot exists
type: Comment
comment on: http://stackoverflow.com/q/24545756
score: 0

http://stackoverflow.com/q/24537799
tagged with: command-prompt
tagged with: java
has answer: http://stackoverflow.com/a/24537851
type: Question
answer count: 2
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/24537846
has body: I am trying to compile multiple .jar libraries from command prompt but I keep getting this error: C:\Users\welcome\Documents\NetBeansProjects\LearningJAVA\JavaApplication8\src\javaapplication8&gt;java -version java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode) C:\Users\welcome\Documents\NetBeansProjects\LearningJAVA\JavaApplication8\src\javaapplication8&gt;cd C: \Users\welcome\Documents\NetBeansProjects\LearningJAVA\JavaApplication8\src\javaapplication8 C:\Users\welcome\Documents\NetBeansProjects\LearningJAVA\JavaApplication8\src\javaapplication8&gt;javac -cp *; JavaApplication8.java C:\Users\welcome\Documents\NetBeansProjects\LearningJAVA\JavaApplication8\src\javaapplication8&gt;java JavaApplication8 Exception in thread "main" java.lang.NoClassDefFoundError: JavaApplication8 (wrong name: javaapplica tion8/JavaApplication8) 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$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) How can I solve it?
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has title: Java Programming ,Command Prompt
has comment: http://stackoverflow.com/comment/37997968

http://stackoverflow.com/comment/38000345
type: Comment
type: QuestionComment
score: 3
has text: A class is loaded when it is needed, or when you ask for it. This doesn't change because a class is nested.
comment on: http://stackoverflow.com/q/24538509

http://stackoverflow.com/q/24523218
has comment: http://stackoverflow.com/comment/37980774
has comment: http://stackoverflow.com/comment/37970690
type: UnansweredQuestion
tagged with: glassfish-3
answer count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: How to connect two mysql schemas one in localhost and other in computer in hibernate in j2ee project using glassfish server. I have created 2 persistence units and 2 data sources. Is it the correct way to do this? Data retrieving can be done from both schemas. But it throws java.sql.SQLException: Error in allocating a connection.Cause: java.lang.IllegalStateException: Local transaction already has 1 non-XA Resource: cannot add more resources. " exception when updating the database. Have you any ideas to do this?
has title: how to connect two schemas one in local host and one in remote computer
type: Question
has comment: http://stackoverflow.com/comment/37970816
has comment: http://stackoverflow.com/comment/38507656
linked to: http://stackoverflow.com/q/14950835
has comment: http://stackoverflow.com/comment/38006123
score: 0

http://stackoverflow.com/comment/37986460
comment on: http://stackoverflow.com/q/24531686
score: 1
has text: http://stackoverflow.com/questions/10324272/why-is-it-not-good-practice-to-synchronize-on-boolean
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24503172
has comment: http://stackoverflow.com/comment/37934574
type: Answer
has body: I tried it in java: public static String convert(String in) { String[] strs = in.split("\\.*000\\.*"); StringBuilder sb = new StringBuilder(); for (int i = strs.length - 1; i &gt;= 0; --i) { sb.append(strs[i]); if (i &gt; 0 &amp;&amp; strs[i - 1].length() &gt; 0) { sb.append("."); } } return sb.toString(); } public static void main(String[] args) { System.out.println(convert("010.011.100.000.111")); System.out.println(convert("010.011.100.000.111.001.011.000.101.110")); System.out.println(convert("010.011.100.111")); System.out.println(convert("000.010.011.100.111")); System.out.println(convert("010.011.100.111.000")); System.out.println(convert("000.010.011.100.111.000")); } Output: 111.010.011.100 101.110.111.001.011.010.011.100 010.011.100.111 010.011.100.111 010.011.100.111 010.011.100.111
has comment: http://stackoverflow.com/comment/37934489
score: 0
answers question: http://stackoverflow.com/q/24502811

http://stackoverflow.com/a/24484313
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24484201
downvote count: 0
has body: There is no special bytecode for one class with a public static void main(String ..args), that method is compiled the same way as any other method. The difference is made by the Java Virtual Machine (not the compiler), whose specification states this: The Java Virtual Machine starts up by creating an initial class, which is specified in an implementation-dependent manner, using the bootstrap class loader (§5.3.1). The Java Virtual Machine then links the initial class, initializes it, and invokes the public class method void main(String[]).
type: Answer

http://stackoverflow.com/q/24468614
tagged with: arraylist
answer count: 2
has body: I'm trying to get the data from a database on Sqlite. first the rows and insert them into a String [], then insert the String[]'s into an arraylist, and finally return the arraylist to use it in other class. public ArrayList&lt;String[]&gt; getWeekUni() { SQLiteDatabase db = helper.getWritableDatabase(); String[] columns = { MenuDataBase.SOPA, MenuDataBase.FONDO1, MenuDataBase.REFRESCO, MenuDataBase.CALORIAS, }; ArrayList&lt;String[]&gt; weekdays = new ArrayList&lt;String[]&gt;(); String[] rowDay = new String[4]; Cursor cursor = db.query(MenuDataBase.TABLE_UNI, columns, null, null, null, null, null); while (cursor.moveToNext()) { cursor.moveToNext(); int index1 = cursor.getColumnIndex(MenuDataBase.SOPA); int index2 = cursor.getColumnIndex(MenuDataBase.FONDO1); int index3 = cursor.getColumnIndex(MenuDataBase.REFRESCO); int index4 = cursor.getColumnIndex(MenuDataBase.CALORIAS); rowDay[0] = cursor.getString(index1); rowDay[1] = cursor.getString(index2); rowDay[2] = cursor.getString(index3); rowDay[3] = cursor.getString(index4); Log.d("TEST", rowDay[0]+" Get week"); Log.d("TEST", rowDay[1]+" Get week"); int i = 0; weekdays.add(rowDay); Log.d("TEST",Integer.toString(weekdays.size())); Log.d("TEST", weekdays.get(i)[0].toString()); Log.d("TEST", weekdays.get(i)[1].toString()); i++; } Log.d("TEST", weekdays.get(0)[0].toString()+" weekdays"); Log.d("TEST", weekdays.get(0)[1].toString()+" weekdays"); Log.d("TEST", weekdays.get(3)[0].toString()+" weekdays"); Log.d("TEST", weekdays.get(3)[1].toString()+" weekdays"); db.close(); return weekdays; } And my log cat is this: 06-28 10:54:44.160: D/TEST(13577): Semola Get week 06-28 10:54:44.160: D/TEST(13577): Garbanzos a la Americana Get week 06-28 10:54:44.160: D/TEST(13577): 1 06-28 10:54:44.160: D/TEST(13577): Semola 06-28 10:54:44.160: D/TEST(13577): Garbanzos a la Americana 06-28 10:54:44.160: D/TEST(13577): Juliana Get week 06-28 10:54:44.160: D/TEST(13577): Aeropuerto Get week 06-28 10:54:44.160: D/TEST(13577): 2 06-28 10:54:…
tagged with: sqlite
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24468672
possible better answer: http://stackoverflow.com/a/24468677
tagged with: android
has answer: http://stackoverflow.com/a/24468677
has title: Arraylist of String Arrays issue
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37869448
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/24468672
type: Question

http://stackoverflow.com/comment/37977531
comment on: http://stackoverflow.com/q/24526742
score: 0
has text: Well it looks like a cookie problem. Without more information on what your login system is, I cannot be 100% sure, but it does smell like it. It is current that sessions are maintained using a cookie on browser. All major browsers allow you to list your current cookies. You should note what cookies exists in your browser (or clear them all), log to app on tomcatA and note the new cookie (domain, name and value), then on tomcatB and see what happened. It is necessary to help you to fix the problem.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24539478
tagged with: spring
has title: Including snippets of linked entities in ResourceSupports
score: 2
tagged with: java
tagged with: spring-hateoas
has body: I'm trying to build a uniform REST facade that returns Spring HATEOAS ResourceSupport classes representing my domain resources, using @ResponseBody for JSON and Thymeleaf for HTML. I have a Painting class that looks like this: public class PaintingResource extends ResourceSupport { private String title; private Integer year; // artist is a Link rel="artist" } For both the JSON and HTML rendering of Painting, I need to have a snippet of the artist's information available (e.g., name and URL for a profile picture), but it doesn't make sense to embed the entire ArtistResource class, and Link doesn't permit attaching any additional metadata. Should I create a nested Artist class to hold just the snippet and create all of this in the resource assembler, or is there a more idiomatic way to mesh the snippet into PaintingResource? If I use a nested class, should I just embed the name and URL values and use a separate Link object to point to the artist's page?
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/24552125
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/24567422
type: UnansweredQuestion
tagged with: atmosphere
has body: I'm new to this, and trying to understand &amp; implement atmosphere-jersey for my POC: TODO app. I'm not sure whether my architecture is right or wrong. Want to know how could be the architecture of my web application. Client side I'm using angular.js and serverside just atmosphere-jersey. My TODO app contains, Teams &amp; TODO's. If anyone creates a team, it should be pushed/broadcast to all the logged users If anyone creates TODO item in a team, it should broadcast to only those members of team So started with LoginService Client makes first request to a LoginLogoutService in which it checks user credentials. Here I could do with simple http request and could save userObject in HttpSession, but for AtmosphereServices objects stored in HttpSession are not available. So im using atmosphere-websocket-request. var request = { url: 'atm/loginLogoutService/login?' + queryString, contentType: 'application/json', logLevel: 'debug', transport: 'websocket', trackMessageLength: true, shared: true, fallbackTransport: 'long-polling' }; If he is an authorized user, then In suspend method I'm creating a session(by storing its uuid in a ConcurrentMap) and setting an attribute: userObject in AtmosphereResource @Path("login") @Suspend(contentType = "application/json", listeners = {OnDisconnect.class}) @GET public String suspend( @Context AtmosphereResource resource, @QueryParam("sessionId") String sessionId, @QueryParam("userId") int userId, @QueryParam("password") String password, @QueryParam("fullname") String fullName ) { try { UserManager um = new UserManager(); UserData loginAtemptByUser = null; if (fullName == null || "".equalsIgnoreCase(fullName)) { logger.debug("Checking from DB..."); loginAtemptByUser = um.authenticateUser(userId, password); if (loginAtemptByUser != null) { logger.debug("Authorised user logged in."); createSession(resource); setAttribute(resource, USER_IN_SESSION_ATTR, loginAtemptByUser); responseJSON.put(KEY_LOGIN_STATUS, VAL_LOGIN_SUCCESS); responseJSON…
downvote count: 0
score: 1
tagged with: java
type: Question
has title: How the application architecture should be, if we want to use atmosphere-jersey for websockets?
has answer: http://stackoverflow.com/a/24568115
upvote count: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/21650032
tagged with: angularjs

http://stackoverflow.com/comment/105430855
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24443973
type: AnswerComment
has text: @demongolem the maven dep still looks like it is there. But in general I think the answer still holds up even if you may need to find a new version on maven.

http://stackoverflow.com/comment/37936752
type: AnswerComment
comment on: http://stackoverflow.com/a/24484331
type: Comment
has text: Means in the php code, put it in such a way that it returns whatever u send as response
score: 0

http://stackoverflow.com/comment/138273515
comment on: http://stackoverflow.com/a/24442252
type: Comment
score: 0
type: AnswerComment
has text: @Kevin Your first question is meaningless, and your second sentence therefore ditto.

http://stackoverflow.com/comment/37910526
type: Comment
comment on: http://stackoverflow.com/a/24490394
has text: @CommonsWare, sorry the service does exist, I just didnt paste the code as I know it works!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/38347168
comment on: http://stackoverflow.com/q/24553900
has text: I won Tumbleweed badge thanks to this question..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38022622
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24550234
has text: if (but1==null){ //print log info here}
score: 0

http://stackoverflow.com/a/24531009
downvote count: 0
has comment: http://stackoverflow.com/comment/37985097
has comment: http://stackoverflow.com/comment/38006914
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37985529
score: 1
answers question: http://stackoverflow.com/q/24530866
has comment: http://stackoverflow.com/comment/37985884
has body: You should move your JSONfunctions.getJSONfromURL("http://url.com") in the try-catch block.

http://stackoverflow.com/q/24554770
has body: I have the next problem in spring mvc. Here is my method in controller I want to test : @Controller @RequestMapping("/groups") public class GroupController { @Autowired private GroupService groupService; @RequestMapping(method = RequestMethod.GET) public String getGroups() { return "groups"; } Spring config file <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="com.softserveinc.ita"/> <mvc:annotation-driven /> <mvc:resources location="/WEB-INF/css/" mapping="css/**"/> <mvc:resources location="/WEB-INF/js/" mapping="js/**"/> <mvc:resources location="/WEB-INF/images/" mapping="images/**"/> <mvc:resources location="/WEB-INF/template/" mapping="template/**"/> <property name="templateLoaderPath" value="/WEB-INF/ftl/"/> <property name="suffix" value=".ftl"/> Web XML <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> Spring MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / Test @Test public void testGetGroupsAndExpectIsOk() throws Exception { mockMvc.perform( get("/groups") ) .andExpect(status().isOk()) .andExpect(view().name("groups")); } I have more methods in controller and more tests, but only 1 doesnt work. I have the following exception : javax.servlet.ServletException: Could not resolve view with name 'groups…
upvote count: 1
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24556924
tagged with: freemarker
tagged with: spring
tagged with: spring-mvc
has title: Spring mvc empty servlet name in exception
type: UnansweredQuestion
tagged with: servletexception

http://stackoverflow.com/a/24512680
answers question: http://stackoverflow.com/q/24512068
has comment: http://stackoverflow.com/comment/37951023
type: Answer
has body: The tag logic:notEmpty evaluates to true because your middle name string has spaces. You should get rid of spaces before returning it to the tag. Better do it in the form bean like public String getMiddleName() { return middleName != null? middleName.trim(): middleName;}
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/37951190
accepted answer of: http://stackoverflow.com/q/24512068
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37950889

http://stackoverflow.com/a/39917222
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24432227
type: Answer
upvote count: 1
has body: An EJB should call native code via a JCA Resource Adapter. A sample is in JNI-RA-HOWTO : https://wiki.ow2.org/jonas/Wiki.jsp?page=JNIRAHOWTO

http://stackoverflow.com/comment/37877442
score: 0
has text: No, GC will _not_ close open connections for you. That's why the `close()` method exists.
type: Comment
comment on: http://stackoverflow.com/a/24472872
type: AnswerComment

http://stackoverflow.com/comment/37957271
type: AnswerComment
comment on: http://stackoverflow.com/a/24510347
has text: @James_D I will try sir, that's why I've uploaded screen shots of my real projects.
type: Comment
score: 0

http://stackoverflow.com/a/24451180
score: 0
type: Answer
has body: You would have got this exception if you had tried to run this program providing 2 or fewer arguments. args[0] will be the first index of the array. args[1] will be the second index. args[2] will be the third index of the array. This is because array index starts with 0 and ends with n-1 for arrays in Java. (n is the size of the array). Command line way This program will run fine, if you run the program as java Hi Demo Test Argument Here Demo is at args[0], Test is at args[1] and Argument is at args[2]. Using Eclipse IDE Right click on the class file. Select Run As and select Run Configurations Double Click on Java Application Go to the Arguments tab and provide three arguments in the Program Arguments textarea separated by spaces as shown in the image below. Now click on Apply and then on Run
answers question: http://stackoverflow.com/q/24449591

http://stackoverflow.com/comment/38043427
type: QuestionComment
has text: Are you using `null` layout? There are a lots of Layout Managers.
comment on: http://stackoverflow.com/q/24561449
score: 0
type: Comment

http://stackoverflow.com/q/24489200
type: Question
tagged with: jodatime
score: 0
answer count: 2
has body: I'm using Joda-Time to parse dates. Is there anything to show abbreviations of the weekdays in a specific locale? (eg german: Mo, Di, Mi, Sa...)? Or how could I achieve this?
possible better answer: http://stackoverflow.com/a/24490972
accepted answer: http://stackoverflow.com/a/24491618
linked to: http://stackoverflow.com/q/20907809
type: AnsweredQuestion
has title: Locale-dependent abbreviation of weekdays in Joda-Time?
has comment: http://stackoverflow.com/comment/37913561
has answer: http://stackoverflow.com/a/24491618
tagged with: java
has answer: http://stackoverflow.com/a/24490972

http://stackoverflow.com/comment/37797801
has text: thats awesome...Now I want give location of the file. this is where I am going wrong. For an example if want give the link to pdf file which is folder PDFs within WebContent directory, then do href goes like"http://localhost:8080/div_container/test.jsp/PDFs/pdffile.pdf"..right? please help me.
type: Comment
comment on: http://stackoverflow.com/a/24429072
score: 0
type: AnswerComment

http://stackoverflow.com/q/24526375
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24526477
upvote count: 5
has comment: http://stackoverflow.com/comment/37976297
score: 4
linked to: http://stackoverflow.com/q/2721998
linked to: http://stackoverflow.com/q/513832
has title: String Constant Pool mechanism
has answer: http://stackoverflow.com/a/24526520
has body: Can anyone explain this strange behavior of Strings? Here's my code: String s2 = "hello"; String s4 = "hello"+"hello"; String s6 = "hello"+ s2; System.out.println("hellohello" == s4); System.out.println("hellohello" == s6); System.out.println(s4); System.out.println(s6); The output is: true false hellohello hellohello
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37976350
linked to: http://stackoverflow.com/q/1643067
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37976264
has answer: http://stackoverflow.com/a/24526451
has comment: http://stackoverflow.com/comment/37976251
answer count: 4
has answer: http://stackoverflow.com/a/24526426
has comment: http://stackoverflow.com/comment/37976300

http://stackoverflow.com/comment/37830624
has text: *None* of them? There are no exceptions anywhere to the principle you have stated here?
comment on: http://stackoverflow.com/a/24445768
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42564038
comment on: http://stackoverflow.com/a/25510659
type: AnswerComment
has text: It said I was missing API 21. So I installed it. Didn't work. Do I need to restart my computer or something? I restarted VS...
type: Comment
score: 1

http://stackoverflow.com/comment/37992958
has text: I have tested with atmosphere 2.0 and I could find the broadcaster without problems. Are you sure you have a client connected? I'll post my code.
comment on: http://stackoverflow.com/a/24533101
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37865810
type: Comment
type: QuestionComment
has text: Rotation of the group when click up and down.I dont that exact method to do that.
score: 0
comment on: http://stackoverflow.com/q/24463122

http://stackoverflow.com/q/24469063
has comment: http://stackoverflow.com/comment/37870263
answer count: 2
has answer: http://stackoverflow.com/a/24469991
upvote count: 36
has comment: http://stackoverflow.com/comment/37876729
has title: Behavior of memory barrier in Java
score: 36
has answer: http://stackoverflow.com/a/24469786
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41270003
has comment: http://stackoverflow.com/comment/37870373
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37870624
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37870368
has comment: http://stackoverflow.com/comment/37870402
tagged with: memory-barriers
has body: After reading more blogs/articles etc, I am now really confused about the behavior of load/store before/after memory barrier. Following are 2 quotes from Doug Lea in one of his clarification article about JMM, which are both very straighforward: Anything that was visible to thread A when it writes to volatile field f becomes visible to thread B when it reads f. Note that it is important for both threads to access the same volatile variable in order to properly set up the happens-before relationship. It is not the case that everything visible to thread A when it writes volatile field f becomes visible to thread B after it reads volatile field g. But then when I looked into another blog about memory barrier, I got these: A store barrier, “sfence” instruction on x86, forces all store instructions prior to the barrier to happen before the barrier and have the store buffers flushed to cache for the CPU on which it is issued. A load barrier, “lfence” instruction on x86, forces all load instructions after the barrier to happen after the barrier and then wait on the load buffer to drain for that CPU. To me, Doug Lea's clarification is more strict than the other one: basically, it means if the load barrier and store barrier are on different monitors, the data consistency will not be guaranteed. But the later one means even if the barriers are on different monitors, the data consistency will be guaranteed. I am not sure if I understanding these 2 correctly and also I am not sure which of them is correct. Considering the following codes: public class MemoryBarrier { volatile int i = 1, j = 2; int x; public void write() { x = 14; //W01 i = 3; //W02 } public void read1() { if (i == 3) { //R11 if (x == 14) //R12 System.out.println("Foo"); else System.out.println("Bar"); } } public void read2() { if (j == 2) { //R21 if (x == 14) //R22 System.out.println("Foo"); else System.out.println("Bar"); } } } Let's say we have 1 write thread TW1 first call the MemoryBarrier's write() method,…
tagged with: java
type: Question
tagged with: java-memory-model

http://stackoverflow.com/a/24553916
accepted answer of: http://stackoverflow.com/q/24552733
answers question: http://stackoverflow.com/q/24552733
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: ImageIO.write() doesn't write Exif metadata* (APP1/Exif). It only stores JFIF (for more information on Exif/JFIF, see JPEG on WikiPedia) in the APP0 segment. Because of this, there will never be an APP1 segment in your code. There's also no Exif metadata available in the BufferedImage or RenderedImage that you are writing, as objects of these types only contain pixel data. If you want to extract Exif metadata, you need to find a reference to the original file you read the image (imagine) from, and read from there. *) ImageIO and the standard JPEGImageWriter can write Exif metadata, but only if you pass the Exif metadata to the writer, using the IIOMetadata API. But I don't think this is relevant for your use case.
upvote count: 1

http://stackoverflow.com/comment/37798909
has text: Yeah, I wasn't aware of all the additional semantics that you pointed out.
comment on: http://stackoverflow.com/a/24430466
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24585909
has comment: http://stackoverflow.com/comment/38088519
answers question: http://stackoverflow.com/q/24585846
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24585846
has comment: http://stackoverflow.com/comment/38088559
has body: StationPage extends Page&lt;Station&gt;, but your method signature requires it to extend Page&lt;EObject&gt;. Note that, even though Station (indirectly) extends EObject, this does not mean that Page&lt;Station&gt; extends Page&lt;EObject&gt;. So you cannot use Page&lt;Station&gt; when a Page&lt;EObject&gt; is expected. Declare the method like this: public static void register(EClass eClass, Class&lt;? extends Page&lt;? extends EObject&gt;&gt; pClass) You can ofcourse also use type parameters instead of wildcards: public static &lt;P extends Page&lt;E&gt;, E extends EObject&gt; register(EClass eClass, Class&lt;P&gt; pClass)
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/24492433
has answer: http://stackoverflow.com/a/24492973
favorite count: 0
linked to: http://stackoverflow.com/q/4740295
has title: Reading from an InputStream without blocking
has comment: http://stackoverflow.com/comment/37914706
upvote count: 4
has body: I have a few InputStreams that I would like to read from in a non-blocking manner. Here is the example: public Result getResult(InputStream ... inputStreams) { final Result result = new Result(); for (InputStream stream : inputStreams) { // TODO: read input streams without blocking here // write output using result.log.add(...) when it gets to a \n (newline) } return result; } public class Result { public final Collection&lt;String&gt; log = new ConcurrentLinkedDeque&lt;&gt;(); } So I could start a new thread for each InputStream via something like: new Thread(() -&gt; { // TODO: read here }).start(). or even use an ExecutorService but I would prefer not to be starting threads myself and have this managed by the JDK. Is something like this possible? (I have a process that prints the Result.log on request.)
downvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/136701935
has comment: http://stackoverflow.com/comment/37924909
type: Question
score: 4
tagged with: nio
has comment: http://stackoverflow.com/comment/37917386
linked to: http://stackoverflow.com/q/804951
has comment: http://stackoverflow.com/comment/37925113
has comment: http://stackoverflow.com/comment/37914543
duplicate of: http://stackoverflow.com/q/4740295
answer count: 1

http://stackoverflow.com/q/24587059
type: Question
has comment: http://stackoverflow.com/comment/38501209
downvote count: 0
has body: I am developing a whack-a-mole game for android in eclipse. My app works on android 2.2 but not on newer versions. What happens is that the splashscreen loads fine and my main activity starts fine too, but to start the game you need to tap the first screen of the main activity. When you do that the emulator shows: "Unfortunately my app stopped" I came across a similar question here, but I couldn't find out what I had to do if this was the problem in my code. Logcat: 07-04 12:08:49.029: E/InputEventReceiver(2099): Exception dispatching input event. 07-04 12:08:49.049: E/MessageQueue-JNI(2099): Exception in MessageQueue callback: handleReceiveCallback 07-04 12:08:49.329: E/MessageQueue-JNI(2099): java.lang.NullPointerException 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:589) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at com.jellyproductions.holymoly.HolyMolyView$WhackAMoleThread.doTouchEvent(HolyMolyView.java:460) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at com.jellyproductions.holymoly.HolyMolyView.onTouchEvent(HolyMolyView.java:1691) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.View.dispatchTouchEvent(View.java:7706) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959) 07-04 12:08:49.329: E/MessageQueue-JNI(2099): at android.view.ViewGroup.dis…
has title: Exception dispatching input event in app developing (Android)
has comment: http://stackoverflow.com/comment/38537312
has comment: http://stackoverflow.com/comment/38504202
tagged with: android
has comment: http://stackoverflow.com/comment/38496700
linked to: http://stackoverflow.com/q/17554452
linked to: http://stackoverflow.com/q/23236811
has comment: http://stackoverflow.com/comment/38502779
has comment: http://stackoverflow.com/comment/38104408
has comment: http://stackoverflow.com/comment/38503753
favorite count: 0
has comment: http://stackoverflow.com/comment/38431146
answer count: 0
has comment: http://stackoverflow.com/comment/38104394
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38091891
has comment: http://stackoverflow.com/comment/38494162
upvote count: 1
has comment: http://stackoverflow.com/comment/38349310
has comment: http://stackoverflow.com/comment/38501248
has comment: http://stackoverflow.com/comment/38503111
has comment: http://stackoverflow.com/comment/38263312
has comment: http://stackoverflow.com/comment/38104494
has comment: http://stackoverflow.com/comment/38114158
has comment: http://stackoverflow.com/comment/38151457
score: 1
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/38043508
comment on: http://stackoverflow.com/a/24562013
has text: Never suggest `null` layout.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38055994
comment on: http://stackoverflow.com/a/24568738
has text: You mean you want to get just the number without the leading `+`?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37868957
has text: Isn't that what I'm already doing (ie in the first line of my code)?
type: Comment
comment on: http://stackoverflow.com/a/24468267
score: 0
type: AnswerComment

http://stackoverflow.com/q/24585821
has title: Send mail (Java vs Php)
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24586721
score: 0
tagged with: email
answer count: 1
has body: I have developed an app with a login. To help users I would like to send a mail reminding their credentials.. 2 solutions but 2 problems: 1) If I send the mail from the mobile phone (using my gmail account and mail.jar library) Google always reports a possible violation of my account or a suspect access, blocking it. I read several forum page about remove this feature but some people say that Gmail is built to be used by a single person 2) If I send a mail from a php page (using the function mail($mailto,$subject,$message,$header) several mail server put automatically this email into the trash folder. Any suggestion? How to solve this issue? Thank you in advance
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/38087501

http://stackoverflow.com/comment/37983729
type: QuestionComment
comment on: http://stackoverflow.com/q/24530090
score: 0
type: Comment
has text: Can you provide the logcat output?

http://stackoverflow.com/comment/37913022
score: 1
comment on: http://stackoverflow.com/a/24490795
type: AnswerComment
has text: Actually you could probably just have `logger.log(p, msg, new Exception());`
type: Comment

http://stackoverflow.com/a/24552909
has comment: http://stackoverflow.com/comment/38026363
score: 1
has comment: http://stackoverflow.com/comment/63301422
has comment: http://stackoverflow.com/comment/63294051
has body: Frameworks like ffmpeg come with command line tools to split a video into individual frames (i.e. images in a folder). See this question: ffmpeg split avi into frames with known frame rate The answers contains links to Java frameworks which wrap ffmpeg.
answers question: http://stackoverflow.com/q/24552486
has comment: http://stackoverflow.com/comment/38025901
has comment: http://stackoverflow.com/comment/57520768
type: Answer
has comment: http://stackoverflow.com/comment/38027849
has comment: http://stackoverflow.com/comment/57532389
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/38027071

http://stackoverflow.com/a/24441346
answers question: http://stackoverflow.com/q/24441154
score: 0
has body: My psychic powers tell me that your "add" and "sub" buttons are part of the fragment's layout file, not the Activity layout file (which just includes the fragment). Hence, move this block of code: add = (Button) findViewById(R.id.bAdd); sub = (Button) findViewById(R.id.bSub); display = (TextView) findViewById(R.id.tvDisplay); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter++; display.setText("Counter equals" + counter); }}); to the onCreateView method of PlaceholderFragment. Alternatively, you can have the layout of the Activity contain all your controls and just get rid of the placeholder fragment. Fragments have their advantages, but the boiler plate PlaceholderFragment generated by eclipse can be annoying, especially for a simple prototyping exercise.
has comment: http://stackoverflow.com/comment/37820071
has comment: http://stackoverflow.com/comment/37823006
type: Answer

d3.js
tags question: http://stackoverflow.com/q/24456769
type: Tag
tags question: http://stackoverflow.com/q/24557308
tag name: d3.js
tags question: http://stackoverflow.com/q/24498675

http://stackoverflow.com/comment/37949773
has text: Setting with langLayout.setHgap(-5); and langLayout.setVgap(0) works for the gap
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24511643
type: AnswerComment

http://stackoverflow.com/comment/37977821
comment on: http://stackoverflow.com/q/24526094
has text: @GermannArlington I'm not using SMS gateway. Popup is generated by Android OS
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24557268
score: 11
has answer: http://stackoverflow.com/a/28075014
answer count: 4
tagged with: audio
has answer: http://stackoverflow.com/a/24558327
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: libgdx -- Gdx.files.internal(); --> File Not Found
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/53123449
upvote count: 11
tagged with: eclipse
has answer: http://stackoverflow.com/a/64083802
tagged with: desktop
has body: I've been having trouble using the Gdx.files.internal() from libgdx; it seems that every time I run it as a desktop application i get this main error: Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: \data\sounds\music\mainmusic.mp3 (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136) at com.badlogic.gdx.backends.lwjgl.audio.Mp3$Music.(Mp3.java:42) ... 10 more I've read 5 separate threads in the matter, one of which seemed like was the most likely problem so I've tried... creating a data folder under assets refreshing the eclipse explorer Project > clean manually creating an assets/data folder in bin (in core) triple checking file paths restarting the IDE my complete path is in /Flipcrew Legends-desktop/assets/data/sounds/music/mainmusic.mp3 public class SplashScreen implements Screen{ final FlipcrewLegends game; Texture splashTexture; Sprite splashSprite; SpriteBatch batch; TweenManager manager; Music introMusic; public SplashScreen(FlipcrewLegends game) { this.game = game; introMusic = Gdx.audio.newMusic(Gdx.files.internal("data/sounds/music/mainmusic.mp3")); introMusic.setLooping(true); } This However... seems to be working.. @Override public void show() { splashTexture = new Texture("data/images/main/splash.png"); splashTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); splashSprite = new Sprite(splashTexture); splashSprite.setColor(1, 1, 1, 0); } path: /Flipcrew Legends-desktop/assets/data/images/main/splash.png // Rest of class is omitted b/c it doesn't seem necessary (I can add it if requested) //unfortunately, Gdx.audio.newMusic doesnt seem to have a direct string path method so I couldn't try that out Additional Info: -> I've tried copying the assets folder in the desktop folder from core to no avail (deleted after) -> One thread said that libgdx usually takes the data from the android folder and then applies it to the desktop (unfortunately I started with only the desktop, no android) but I'm guessing …
favorite count: 0
accepted answer: http://stackoverflow.com/a/24558327
possible better answer: http://stackoverflow.com/a/28075014

http://stackoverflow.com/q/24557405
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38037886
tagged with: java
has answer: http://stackoverflow.com/a/24557695
type: Question
tagged with: adt
has comment: http://stackoverflow.com/comment/38034900
has answer: http://stackoverflow.com/a/24557594
tagged with: eclipse
has answer: http://stackoverflow.com/a/24557593
score: 0
answer count: 3
has title: Eclipse - "main cannot be resolved or is not a field" (Android App programming)
has body: I've got a problem with Eclipse. I use the ADT to develop Android apps directly in Eclipse. But right after creating a new project, I got an error in my "MainActivity.java"-file. I googled and everywhere its said that I have to import an ".R" class from my project folder, which didnt work for me. I also completetely redownloaded Eclipse+ADT in one package this morning. The line which gives the error is the following: setContentView(R.layout.main); Without the "import com.example.myapp.R" statement I've got the same error. Cleaning and rebuilding also didnt have any effect. Do you have any ideas? Thanks!

http://stackoverflow.com/comment/39682863
comment on: http://stackoverflow.com/a/25395203
has text: Thanks for taking your time to answer this. I actually figured it out using a different process. The process I'm using this a tad more complex but it is because I created a GUI that had to remember the directories to go back and go forward, and also to upload to a certain directory. Thank you, however!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/38034224
has text: This doesn't actually answer the question.
comment on: http://stackoverflow.com/a/24557312
type: Comment
score: 3
type: AnswerComment

http://stackoverflow.com/a/24432495
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24432295
has body: Found it, pretty simple actually : Chart chart = new Chart(); //json is the string containing your JSON object chart.setJsonConfig(json); //you'll have to draw the chart to update it if needed //chart.drawChart();
answers question: http://stackoverflow.com/q/24432295

http://stackoverflow.com/a/24474180
answers question: http://stackoverflow.com/q/24473430
downvote count: 0
has body: Just to elaborate on immibis' answer a bit: int index(int i) { return 1 + (i&gt;&gt;31) - (-i&gt;&gt;31); } String[] text = {"negative", "zero", "positive"}; private String text(int i) { return text[index(i)]; } The signed shift i&gt;&gt;31 converts every negative number into -1 and every other into 0. Computing -i&gt;&gt;31 allows to tell positive numbers from non-positive ones. Now look at the computed index: positive: 1 + 0 - (-1) = 2 zero: 1 + 0 - 0 = 1 negative: 1 + (-1) - 0 = 0
score: 6
upvote count: 6
type: Answer

http://stackoverflow.com/comment/37837741
comment on: http://stackoverflow.com/q/24451368
type: Comment
type: QuestionComment
has text: @MightyPork The "issue" here is ... that the second one simply does not work. See http://stackoverflow.com/a/24013205/3182664
score: 0

http://stackoverflow.com/comment/37924914
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24498010
has text: Judging by the URL you are hitting, it looks like you are deploying to an application server, like Tomcat or the like. If that is the case, then I would expect to see the deployment context in the URL after the hostname/port (ie. as the first part of the URI part). This would usually be the WAR name, unless you override it via the web.xml. For instance, if my WAR was called `MyApp.war` my URL would be `http://localhost:8080/MyApp/request/report/custom_report` blah blah blah. I believe that is your missing piece.

http://stackoverflow.com/a/24503476
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37935949
score: 1
has body: I think the issue is that the return type for method getNumericCellValue is double(not class Double). no method toString(). You can try: result = cell.getNumericCellValue(); change to: result = String.valueOf(cell.getNumericCellValue());
has comment: http://stackoverflow.com/comment/37934983
upvote count: 1
answers question: http://stackoverflow.com/q/24503216
has comment: http://stackoverflow.com/comment/37934928

http://stackoverflow.com/a/24585975
has body: Simple. Page&lt;Station&gt; is not considered to extend Page&lt;EObject&gt;. Check again the generics tutorial at oracle.com To see what I mean, look how would this code work if Page&lt;Station&gt; was considered to extend Page&lt;EObject&gt; public void addItem(Page&lt;EObject&gt; page, EObject item) { page.add(item); ... } addItem(new StationPage(), new EObject()); That would result in an error, since you are attempting to pass an EObject to a method that expects Station. An error that the JVM would not be able to identify as such, since the generics information is not used at runtime. So, the compiler must interpret that as a compilation error, and StationPage does not extend from Page&lt;Object&gt; Using generics as Jesper instructed public void addItem(Page&lt;? extends EObject&gt; page, EObject item) { will allow the compilation, but will put restrictions in the type of operations that you may use with the page parameter (it will not allow to call page.addItem, exactly for the same motive).
type: Answer
answers question: http://stackoverflow.com/q/24585846
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/38038883
score: 0
comment on: http://stackoverflow.com/q/24558674
type: Comment
type: QuestionComment
has text: The values are separated by arbitrary number of spaces. i.e. 100 10.0 100.0 21.3

http://stackoverflow.com/q/24456321
tagged with: eclipse
type: Question
tagged with: blender
has comment: http://stackoverflow.com/comment/37848608
has title: Using jME3 in WindowBuilder (Eclipse) SWT
tagged with: jmonkeyengine
type: UnansweredQuestion
has body: I have created a simple interface using the Eclipse WindowBuilder plugin. My goal is to load blender models using jMonkeyEngine (jME3). I believe that jME3 only supports swing and AWT, while WindowBuilder mainly uses SWT. Currently I have a window with a TabFolder. On the current tab (displayed below) is a composite (which allows me to freely place SWT components, like the button). I would like to have my model somehow displayed in the area specified below. I am fairly new to jME3 and WindowBuilder, so I would appreciate a thorough response or some resources to help me with this.
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/37848984
tagged with: java
tagged with: windowbuilder

http://stackoverflow.com/comment/37914369
score: 0
type: AnswerComment
has text: You know you can always log `Fatal error occured.` and call [`System.exit(1);`](http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#exit%28int%29)... but any reason for doing that would be questionable (together with developer's sanity).
type: Comment
comment on: http://stackoverflow.com/a/24488308

http://stackoverflow.com/comment/38121993
has text: @Bhushan, this is the screenshot of libraries included in project. https://drive.google.com/file/d/0B1JsFHtBqxS8VnRGdFNaU2RlWkU/edit?usp=sharing right click and open in net tab.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24585506
type: Comment

http://stackoverflow.com/q/24439007
has body: I am new to Java and have just beginning doing some exercises a friend sent me. The exercise in question asks us to create a class Term for the terms of a polynomial, and another the class Polynomial itself, where the polynomial is represented as a fixed size array and the values of its fields are provided. I have written the following code: class Term { int coeff; int exponent; } public class Polynomial { static int size=5; Term[] poly; public Polynomial() { poly = new Term[size]; for(int i=0;i&lt;size;i++) { poly[i].coeff=0; poly[i].exponent=0; } } public static void main(String args[]) throws Exception { Polynomial p = new Polynomial(); } } And I keep getting the following exception: Exception in thread "main" java.lang.NullPointerException at prac.polynomial.&lt;init&gt;(polynomial.java:25) at prac.polynomial.main(polynomial.java:34) Please help me with what I am doing wrong here.
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java
has answer: http://stackoverflow.com/a/24439041
has answer: http://stackoverflow.com/a/24439042
duplicate of: http://stackoverflow.com/q/218384
answer count: 2
upvote count: 0
has title: Calling the constructor of a class through its own main method and initializing variables
has comment: http://stackoverflow.com/comment/45654200
favorite count: 0
tagged with: nullpointerexception
tagged with: exception
type: UnansweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/37814811
downvote count: 2

http://stackoverflow.com/q/24467860
tagged with: java
tagged with: mozilla
downvote count: 0
tagged with: jar
favorite count: 0
has body: I'm developing an SWT crossplatform program and in linux (both 32 and 64) when i try to open a window that have a SWT browser inside i get this error(the program is exported as runnable jar): Failed to execute runnable (org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]) I read a lot of questions about this error on internet but i was not able to resolve it. I tried to set my MOZILLA_FIVE_HOME variable with no luck: i tried: MOZILLA_FIVE_HOME = /usr/lib/mozilla/ MOZILLA_FIVE_HOME = /usr/lib/ MOZILLA_FIVE_HOME = /opt/xulrunner/ MOZILLA_FIVE_HOME = /tmp/swtlib-32/ and the error i got is this everytime: Failed to execute runnable (org.eclipse.swt.SWTError: No more handles [MOZILLA_FIVE_HOME='&lt;path i set before&gt;'] (java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-mozilla-gtk-3655 in java.library.path no swt-mozilla-gtk in java.library.path /tmp/swtlib-32/libswt-mozilla-gtk-3655.so: libxpcom.so: can not open shared object file: A file or directory that does not exist Can't load library: /tmp/swtlib-32/libswt-mozilla-gtk.so )) I tried to: reinstall Firefox reinstall xulrunner reinstall libwebkit with the command: sudo apt-get install libwebkitgtk-1.0-0 i tried to set in my code the composite with the embedded browser from SWT.NONE to SWT.MOZILLA I also tried to set my LD_LIBRARY_PATH variable..still no luck On windows all works fine. What can i do? Please guide me the correct way to achieve my objective.
tagged with: linux
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swt
has title: Browser SWT Linux Failed to execute runnable (org.eclipse.swt.SWTError: No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)])
type: Question

http://stackoverflow.com/q/24574036
type: Question
tagged with: java
tagged with: eclipse
downvote count: 0
answer count: 1
favorite count: 0
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
score: 2
has answer: http://stackoverflow.com/a/24574448
upvote count: 2
has body: I am using Spring 3, Apache-maven-3.2.2, Apache-tomcat-7.0.54. &lt;web-app 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" id="WebApp_ID" version="2.5"&gt; It is giving compile time error Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'web-app'. - schema_reference.4: Failed to read schema document 'http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.
type: UnansweredQuestion
has title: atributes in web.xml are not working eclipse kepler
tagged with: maven

http://stackoverflow.com/comment/38023994
type: Comment
type: QuestionComment
has text: I'm sure the problem is in my code - I just don't know what I'm doing wrong. But if I remove the unmarshall line, the START_ELEMENT event does fire for every element like I'd expect. With the unmarshall, it doesn't - I get a START_ELEMENT for every other element.
score: 0
comment on: http://stackoverflow.com/q/24551495

http://stackoverflow.com/a/24573910
score: 0
has comment: http://stackoverflow.com/comment/38310691
type: Answer
has comment: http://stackoverflow.com/comment/38372575
has body: Based on these lines: String[] lg = new String[2]; lg = io.SrcAndTargLangInput.langInfo(); The problem is your SrcAndTargLangInput class uses a JFrame to ask the user for the input. Having said this, JFrame is not modal and thus it doesn't block the current thread waiting for an input as you wish. You have to use a modal JDialog or JOptionPane(which displays a modal dialog) instead in order to wait until users confirm their input. Take a look to these topics: The Use of Multiple JFrames, Good/Bad Practice? How to Use Modality in Dialogs How to Make Dialogs Off-topic As many developers have already said, Swing is designed to be used with Layout Managers and you should avoid methods such as setBounds(), setLocation() or setSize(). You may want to take a look to these topics too: Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? Nested Layout Example Providing white space in a Swing GUI Example (using JOptionPane) Note the text field's text doesn't change until you confirm your input. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class Demo { private void createAndShowGui() { final JTextField textField = new JTextField(10); textField.setEditable(false); JButton button = new JButton("Show dialog"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JComboBox languagesComboBox = new JComboBox(new Object[]{"English","Spanish","French"}); JPanel dialogPanel = new JPanel(); dialogPanel.add(new JLabel("Please select an option:")); dialogPanel.add(languagesComboBox); int option = JOptionPane.showConfirmDialog(null, dialogPanel, "Select an input" , JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if(option == JOptionP…
answers question: http://stackoverflow.com/q/24561098

http://stackoverflow.com/comment/37814046
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24436628
has text: @nneonneo, If a "specialist application" needs more than 17 digits of precision, it's _not_ because of the magnitude of the numbers. A double on the order of 1.0e-17 carries just as many digits of precision as a double on the order of 1.0e200.
score: 0

http://stackoverflow.com/comment/37953927
type: AnswerComment
comment on: http://stackoverflow.com/a/24512199
type: Comment
score: 1
has text: @IAmYourFaja Please see my edit. (1) by transactional store I mean any JTA compliant database (with a JDBC driver which implements X/Open XA interface part of JTA), data-grid, file server etc. (2) yes, its the responsibility of Transaction Manager (3) I haven't found yet a specific code sample. I guess that's because everybody just wants to show how to use their product standalone and only hint that's possible to combine it with other products as well, though they don't give concrete code examples.

http://stackoverflow.com/a/24484226
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24483645
downvote count: 0
type: Answer
upvote count: 17
has body: The SubnetUtils class by default excludes the zeroth and last address from the range of usable "host" addresses because they are (or were, in the case of the zeroth address) used as the network broadcast address. You need to invoke the .setInclusiveHostCount(true) method on your SubnetUtils instance to tell it to include those addresses within the returned range.
score: 17
answers question: http://stackoverflow.com/q/24483645

http://stackoverflow.com/q/24552132
answer count: 2
downvote count: 4
tagged with: android-listview
upvote count: 0
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24552443
has answer: http://stackoverflow.com/a/24552305
type: AnsweredQuestion
tagged with: java
score: -4
possible better answer: http://stackoverflow.com/a/24552305
has title: NullPointerException on String Array Declaration
has body: I have been attempting to declare an array but there is this NullPointer that comes up and prevents me from continuing. Also, I do not have access to LogCat because my Android Version now requires root for that. I am developing purely on a device with only AIDE. I cannot implicitly paste code here because my device will not allow, so I have my codes put into PasteBin pages. MainActivity.java It is at line 45 of the above paste that the NullPointer turns up on AppFiles.java This is the File that is being referenced with the MainActivity class.
has comment: http://stackoverflow.com/comment/38024446
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/24552443
has comment: http://stackoverflow.com/comment/38024433

http://stackoverflow.com/comment/37945471
comment on: http://stackoverflow.com/q/24509627
has text: Why would `(.)01` match `2(.)1`? For example `(.)01` matches `901` and `2(.)1` matches `281` but `901` and `281` are very different. Please explain in more detail what you are trying to achieve and also what you have tried so far.
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37976635
score: 0
type: Comment
type: QuestionComment
has text: use ftp and ensure that it is in binary mode.
comment on: http://stackoverflow.com/q/24526438

http://stackoverflow.com/q/24449996
upvote count: 3
answer count: 1
tagged with: applet
has title: java can system out result in out of memory issues
favorite count: 0
tagged with: out-of-memory
type: AnsweredQuestion
tagged with: memory-management
has comment: http://stackoverflow.com/comment/37834524
downvote count: 0
has comment: http://stackoverflow.com/comment/37834599
has answer: http://stackoverflow.com/a/24450272
accepted answer: http://stackoverflow.com/a/24450272
has comment: http://stackoverflow.com/comment/37834596
type: Question
score: 3
tagged with: java
has body: This is a theoretical question . Can a flood of system out on java applet , cause applet to go out of memory ? If yes what would be an easy solution to remove multiple sysout spanning across multiple files ?
tagged with: memory

http://stackoverflow.com/comment/37872743
comment on: http://stackoverflow.com/a/24470307
score: 0
type: AnswerComment
type: Comment
has text: `I am calling this function from another static function so I cannot remove static.` - that is your problem you should NOT be using static methods everywhere in your code. Read the tutorial for a better structured program. The tutorial has a working example. Learn by using working code instead of writing your own code!

http://stackoverflow.com/q/24431146
tagged with: url
score: 0
tagged with: esb
type: UnansweredQuestion
has body: In my Java client application, I have a web service call which communicates with a server application using MQ/ESB to update data. Sometime it happens MQ/ESB is down and the data does not update from one application to another, as MQ/ESB is a channel between the client and server applications. Is there a site or tool which periodically hits the web service url and reports an error via email when it goes down?
has answer: http://stackoverflow.com/a/24432072
has title: Test services up and running and report while down
has answer: http://stackoverflow.com/a/24958805
tagged with: java
type: Question
answer count: 2
tagged with: mq

http://stackoverflow.com/comment/38040882
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24560134
type: QuestionComment
has text: No, it doesn't and it shouldn't! The whole ServiceMethod `doSomething()` runs - and should run - in one transaction!

http://stackoverflow.com/a/24574844
type: Answer
score: 0
has body: You can try this code: try { Process process = Runtime.getRuntime().exec("logcat -f"); Log.d("TAG", "my test phrase"); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); StringBuilder log=new StringBuilder(); String line; FileWriter fw = new FileWriter("/sdcard/mylog"); while ((line = bufferedReader.readLine()) != null) { fw.append(line); } fw.close(); } catch (IOException e) { } This works for me. Hope it helps. More info
answers question: http://stackoverflow.com/q/24572821

http://stackoverflow.com/comment/37957837
type: Comment
has text: To be honest, though, this all ends up being overengineered for no tangible benefit. If the hashCode() method is simply concatenating the key elements into a string and then calling hashCode on that, I'd just do away with the special Keys object altogether and just use a concatenated string as the key to the hash map!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24516003

http://stackoverflow.com/q/24564760
has body: I am trying to make a very simple 2-frame program called Duck Simulator. This has a JFrame and 2 pictures. If you want to know what it does, it just is a JFrame with a starting picture of a duck sitting in a pond. It has a JLabel saying "Press D to drink water!" And when you press D, it is supposed to set the image to the duck drinking. It shows the opening image of the duck sitting in the pond in the JFrame, but when I press D, it doesn't do anything. Here is the code: package net.ducksimulator.classes; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class a implements KeyListener { static JFrame f; public static void main (String[] args) { f = new JFrame("Duck Simulator ALPHA"); try { f.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("images/duck-sitting.png"))))); } catch (IOException e) { System.out.println("Image doesn't exist."); } f.setResizable(false); f.setVisible(true); JLabel l = new JLabel("Press D to drink water!"); l.setBounds(250,20,100,10); f.add(l); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); } public void drink() throws IOException { f.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("images/duck-drinking.png"))))); } public void sit() throws IOException { f.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("images/duck-sitting.png"))))); } @Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_D) { try { drink(); } catch (IOException e1) { e1.printStackTrace(); } } } @Override public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_D) { try { System.out.println("Bagels"); sit(); } catch (IOException e1) { e1.printStackTrace(); } } } @Override public void keyTyped(KeyEvent e) { } }
tagged with: jframe
type: UnansweredQuestion
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/38049603
has title: KeyListener won't work?
tagged with: java
tagged with: keylistener
has answer: http://stackoverflow.com/a/24564922
has comment: http://stackoverflow.com/comment/38049270
type: Question
linked to: http://stackoverflow.com/q/11211472
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/38049626
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24589057
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24517426
accepted answer of: http://stackoverflow.com/q/24517426
type: Answer
has body: Here is the code snippet for you that adds an SWT label at the top of Graphical Viewer for GEF's Logic Example editor. Yopu can easily do the same for the GMF editor because GMF's DiagramEditor has been created based on GEF's LogicEditor. I have modified the following methods in GEF's LogicEditor: private Composite graphicalControl; /* * (non-Javadoc) * * @see * org.eclipse.gef.ui.parts.GraphicalEditor#createGraphicalViewer(org.eclipse * .swt.widgets.Composite) */ protected void createGraphicalViewer(Composite parent) { graphicalControl = new Composite(parent, SWT.None); graphicalControl.setLayout(new GridLayout()); Label label = new Label(graphicalControl, SWT.None); label.setText("MY DIAGRAM NAME!!!"); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); rulerComp = new RulerComposite(graphicalControl, SWT.NONE); super.createGraphicalViewer(rulerComp); rulerComp .setGraphicalViewer((ScrollingGraphicalViewer) getGraphicalViewer()); rulerComp.setLayoutData(new GridData(GridData.FILL_BOTH)); } protected Control getGraphicalControl() { return graphicalControl; } In addition to that change i removed the previous implementations of these methods in LogicEditor and replaced call to getGraphicalControl() with rulerComp for LogicEditor#configureGraphicalViewer() method (a the end there are 2 SWT listeners added) Result on the screenshot below.
score: 0

http://stackoverflow.com/a/24449121
has comment: http://stackoverflow.com/comment/37832912
has body: Here is a working example of pom.xml : <?xml version="1.0" encoding="UTF-8"?> 4.0.0 stackoverflow q24448582 1.0-SNAPSHOT <scala.version>2.10.3</scala.version> org.scala-lang scala-library ${scala.version} org.scala-tools maven-scala-plugin 2.15.2 compile compile compile test-compile testCompile test-compile process-resources compile
answers question: http://stackoverflow.com/q/24448582
has comment: http://stackoverflow.com/comment/116892511
downvote count: 0
has comment: http://stackoverflow.com/comment/37833466
has comment: http://stackoverflow.com/comment/37832959
has comment: http://stackoverflow.com/comment/52273554
type: Answer
upvote count: 19
score: 19

http://stackoverflow.com/q/24456266
answer count: 1
accepted answer: http://stackoverflow.com/a/24461978
score: 0
has body: I want to make a customized JSpinner for editing day hours. I want the format to be 1HH:mm:ss a1, I already get this part. I also want to add in some functionalities of JFormattedTextField: setplaceHolderCharacter('_') For example the time is 09:23:45, when the user delete 09, __:23:45 shows on screen. input restriction For example the time is 09:23:45, when the user delete 09, and try to enter anything, he can only enter numbers, no letter is allowed. Any help would be appreciated!
tagged with: jformattedtextfield
tagged with: swing
has title: combine JSpinner with JFormattedTextField
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24461978
tagged with: jspinner
tagged with: java
type: Question

http://stackoverflow.com/comment/37906327
comment on: http://stackoverflow.com/q/24488154
type: Comment
type: QuestionComment
has text: What on earth does "It doesn't seem to be able to work out." mean? It throws an error? If so, what's the error? It doesn't return the expected results? If not, what *is* it returning?
score: 3

http://stackoverflow.com/a/24572796
has body: Have the form do a get request for the page with the applet. Parse the the data encoded in the URL. Write the param elements for the applet containing the data in the form fields. Or alternately write the attributes of the deployment toolkit script. This might be done with:- PHP ASP Servlet/JSP Javascript &amp; HTML ..
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24566786
score: 2

http://stackoverflow.com/q/24457626
has answer: http://stackoverflow.com/a/24457740
answer count: 4
accepted answer: http://stackoverflow.com/a/24457740
score: 2
upvote count: 2
has body: I can implement single method in two ways, 1. public String getTestMessage() { return "Hello" + "World..!"; } 2. public String getTestMessage() { return new StringBuffer("Hello").append("World..!").toString(); } In first scenario, there will be two new String objects will be created. In second scenario also there will be two new objects created, but there will be one String and StringBuffer. Now way will be fast from them? I am little bit confused.
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/37848859
has title: StringBuffer and String usage scenario in Java
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1532461
possible better answer: http://stackoverflow.com/a/24457749
has answer: http://stackoverflow.com/a/24457655
has comment: http://stackoverflow.com/comment/37849135
has answer: http://stackoverflow.com/a/24457749
has comment: http://stackoverflow.com/comment/37850347
downvote count: 0
linked to: http://stackoverflow.com/q/2439243
has answer: http://stackoverflow.com/a/24458178
favorite count: 0

http://stackoverflow.com/comment/38014457
comment on: http://stackoverflow.com/a/24540162
type: Comment
has text: So I have to make some tests on 2 photos that will have a perfect match and use the value obtained to calculate the percent for all the future matches?
score: 0
type: AnswerComment

http://stackoverflow.com/a/24544833
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38011628
type: Answer
accepted answer of: http://stackoverflow.com/q/24544720
score: 2
has comment: http://stackoverflow.com/comment/38011677
answers question: http://stackoverflow.com/q/24544720
upvote count: 2
has body: Being stable at 10M is a good indicator, but it doesn't mean that this is all your app requires, it might be that blocks that consume memory were not reached. Same for memory leak. It might just indicate that the right conditions were not reached. However, if the opposite was true: if you app is steadily allocating more an more memory without releasing it, I would take that as a pretty good indication of a memory leak.

http://stackoverflow.com/q/24503490
answer count: 0
upvote count: 3
type: Question
score: 3
tagged with: java
downvote count: 0
tagged with: asp.net
favorite count: 0
has body: I tried to get the downloaded file name using HttpURLConnection, Content-Disposition, but i'm always getting the null value. The URL im providing is from the page where the download link is present Is there any problem due to dynamically generated RSID in URL? Is there any other way i can get the downloaded file name? Below my code : URL url = new URL("http://www.somewebsite.com/emp/Emp_view_rs.aspx?RSID=ezxJzVOJYgZuRiRjmEzZhe==&amp;HighlightWords=.NET%2cASP%2cASP.NET%2cASP%2c.NET%2cASP.NET%2cASP.NET "); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("GET"); conn.setAllowUserInteraction(false); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); String raw = conn.getHeaderField("Content-Disposition"); System.out.println(raw); **//Always getting raw value as NULL** if (raw != null &amp;&amp; raw.indexOf("=") != -1) { String[] fileName = raw.split("="); for(int g=0;g&lt;=fileName.length;g++) { System.out.println(fileName[g]); } } else { }
type: UnansweredQuestion
has title: Get the downloaded file name using java
tagged with: httpurlconnection

http://stackoverflow.com/q/24430565
favorite count: 0
has title: java remove lines from file based on line number
has body: Is there a Java library to remove lines based on line number? My aim is to remove lines based on line numbers. Example Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus remove lines 3,4,5 output should be Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus I have made a working method import org.apache.commons.io.FileUtils; //... private String removeLines(List&lt;Integer&gt; removeLines, File text) throws IOException { List&lt;String&gt; textLines = FileUtils.readLines(text, StandardCharsets.UTF_8); if (argsStrings.contains(Flags.DEBUG_FLAG)) { String format = String.format("%d from %d need to be removed", removeLines.size(), textLines.size()); Logger.getLogger(App.class.getName()).log(Level.INFO, format); } int i = textLines.size(); while (!removeLines.isEmpty()) { Integer line = new Integer(i + 1); i…
tagged with: line
type: AnsweredQuestion
tagged with: numbers
accepted answer: http://stackoverflow.com/a/24430706
score: 1
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/37798747
type: Question
has answer: http://stackoverflow.com/a/24430706
tagged with: file-io
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24516423
tagged with: java
has comment: http://stackoverflow.com/comment/37958077
score: -1
linked to: http://stackoverflow.com/q/13450406
has title: Getting NullPointerException on receiving data from bluetooth
tagged with: bluetooth
has body: I have to get data from a bluetooth device which is not a android device to a android phone. So as a receiver in android phone i have made a app to receive data from the bluetooth device . I followed a tutorial from a post's answer from here here enter link description here But i am getting NullPointerException. Could anyone tell me why i am getting this exception and Could anyone tell me how to solve this exception in that code??? My code were: package Android.Arduino.Bluetooth; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.TextView; import android.widget.EditText; import android.widget.Button; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import java.util.UUID; public class MainActivity extends Activity { TextView myLabel; EditText myTextbox; BluetoothAdapter mBluetoothAdapter; BluetoothSocket mmSocket; BluetoothDevice mmDevice; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; byte[] readBuffer; int readBufferPosition; int counter; volatile boolean stopWorker; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button openButton = (Button)findViewById(R.id.open); Button sendButton = (Button)findViewById(R.id.send); Button closeButton = (Button)findViewById(R.id.close); myLabel = (TextView)findViewById(R.id.label); myTextbox = (EditText)findViewById(R.id.entry); //Open Button openButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { findBT(); openBT(); } catch (IOException ex) { } } }); //Send Button sendButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { sendData(); } catch (IOException ex) …
has answer: http://stackoverflow.com/a/24531163
answer count: 2
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37957899
has comment: http://stackoverflow.com/comment/37958299
has comment: http://stackoverflow.com/comment/37958169
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24516758

http://stackoverflow.com/comment/37876158
comment on: http://stackoverflow.com/a/24471542
score: 0
type: AnswerComment
has text: I was hoping you'd say it was a bad practice. Kind of makes me wonder why it's on the exam; just because it can be done doesn't mean it should be.
type: Comment

http://stackoverflow.com/comment/38069919
score: 0
comment on: http://stackoverflow.com/a/24576284
type: Comment
has text: @PiotrSołtysiak: please re-write your question to clarify it as now I'm completely confused as to what you want.
type: AnswerComment

http://stackoverflow.com/comment/37989310
type: Comment
type: QuestionComment
has text: I know it's too late now, but my answer included how to grab the programs that open any extension.
score: 0
comment on: http://stackoverflow.com/q/24532819

http://stackoverflow.com/comment/37886808
type: AnswerComment
comment on: http://stackoverflow.com/a/24476850
score: 0
type: Comment
has text: It was showing only cat:Animal, cat:Bird upon selecting value from drop down , but after changing var JScategory=$("#category").val(); to var JScategory=$("#category").serialize(); and {category:JScategory} to {JScategory} I got console messages like cat:Animal Tiger by printing it. But still not getting any thing in my desired page.

http://stackoverflow.com/comment/37946387
comment on: http://stackoverflow.com/a/24496472
has text: In your case, I wouldn't do that, because you need your Sudoku to be valid. Filling up an array with random numbers would just be for(int i = 0; i < 9; i++) { array[i] = random.nextInt(9)+1; } but as I said that will not result in a valid sudoku, the shifting method I linked is much better for this purpose. The way I would "randomize" the Sudoku compared to that is by randomly swapping elements in the initial 9-length array that is used to generate the numbers.
type: AnswerComment
score: 0
type: Comment

intellij-idea
tags question: http://stackoverflow.com/q/24538929
tags question: http://stackoverflow.com/q/24468496
tags question: http://stackoverflow.com/q/24495448
tags question: http://stackoverflow.com/q/24511026
tags question: http://stackoverflow.com/q/24477556
tags question: http://stackoverflow.com/q/24467294
tags question: http://stackoverflow.com/q/24459077
tags question: http://stackoverflow.com/q/24468940
tags question: http://stackoverflow.com/q/24474772
tags question: http://stackoverflow.com/q/24575902
tags question: http://stackoverflow.com/q/24485690
type: Tag
tags question: http://stackoverflow.com/q/24533398
tag name: intellij-idea
tags question: http://stackoverflow.com/q/24472035
tags question: http://stackoverflow.com/q/24489246
tags question: http://stackoverflow.com/q/24550026
tags question: http://stackoverflow.com/q/24560732
tags question: http://stackoverflow.com/q/24496606
tags question: http://stackoverflow.com/q/24536388
tags question: http://stackoverflow.com/q/24564796
tags question: http://stackoverflow.com/q/24549342
tags question: http://stackoverflow.com/q/24535241
tags question: http://stackoverflow.com/q/24520842
tags question: http://stackoverflow.com/q/24547943
tags question: http://stackoverflow.com/q/24551822
tags question: http://stackoverflow.com/q/24484776
tags question: http://stackoverflow.com/q/24573643
tags question: http://stackoverflow.com/q/24438895
tags question: http://stackoverflow.com/q/24439818
tags question: http://stackoverflow.com/q/24585382
tags question: http://stackoverflow.com/q/24438098
tags question: http://stackoverflow.com/q/24541262
tags question: http://stackoverflow.com/q/24463980
tags question: http://stackoverflow.com/q/24487805
tags question: http://stackoverflow.com/q/24526438
tags question: http://stackoverflow.com/q/24441677

http://stackoverflow.com/comment/38042115
type: Comment
has text: some related links I'm looking at: https://github.com/nodyn/jvm-npm http://nodyn.io/
comment on: http://stackoverflow.com/a/24560648
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38042637
has text: No worries. I've done it a lot of times too.
score: 0
comment on: http://stackoverflow.com/q/24561408
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/113253262
has text: @Marek could you update the link for concat - brings me to a page with no mention of it
type: AnswerComment
comment on: http://stackoverflow.com/a/24595644
score: 0
type: Comment

http://stackoverflow.com/q/24490502
has body: I want to query two tables joined by inner join using hibernate. Two tables are as follows. CREATE TABLE systemuser ( system_user_id INT(20) NOT NULL AUTO_INCREMENT, user_name VARCHAR(50) NOT NULL DEFAULT '0', PRIMARY KEY (system_user_id) ) CREATE TABLE role ( system_user_id INT(20) NOT NULL , role_id INT(20) NOT NULL DEFAULT '0', PRIMARY KEY (system_user_id,role_id), CONSTRAINT FK_SYSTEM_USER_ID FOREIGN KEY (system_user_id) REFERENCES systemuser (system_user_id) ) These two tables have a one to many relationship. Bean classes for these tow are as follows. @Entity(name = "role") @IdClass(RoleCompositeKey.class) public class Role extends implements java.io.Serializable { private int roleId =0; private int systemUserId =0; private SystemUser systemUser; public Role(){ } public void setRoleId(int roleId){ this.roleId = roleId; } @Id @Column(name = "role_Id") public int getRoleId(){ return roleId; } public void setSystemUserId(int systemUserId){ this.systemUserId = systemUserId; } @Id @Column(name="system_user_id") public int getSystemUserId(){ return systemUserId; } public void setSystemUser(SystemUser systemUser){ this.systemUser= systemUser; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "system_user_id", nullable = false) public SystemUser getSystemUser(){ return systemUser; } } @Entity @Table(name = "systemuser",uniqueConstraints = { @UniqueConstraint(columnNames = "system_user_id"), @UniqueConstraint(columnNames = "user_name") }) public class SystemUser { private int systemUserId = 0; private String userName = null; private Set&lt;Role&gt; roleList; public SystemUser(){ } public void setUserName(String userName) { this.userName = userName; } @Column(name = "user_name") public String getUserName() { return userName; } public void setSystemUserId(int systemUserId){ this.systemUserId = systemUserId; } @Id @Column(name="system_user_id") public int getSystemUserId(){ return systemUserId; } public void setRole(Set&lt;Role&gt; roleList){ this.roleList = roleList…
score: 0
answer count: 1
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: Hibernate one to many mapping where one class has a composite primary key on many side
has answer: http://stackoverflow.com/a/24492028
accepted answer: http://stackoverflow.com/a/24492028

http://stackoverflow.com/comment/38014286
has text: And what about subsequent deployments? Do you need to do this process always? In my case I need to do it only when I add or change something related to the enum.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24489424
type: Comment

http://stackoverflow.com/comment/76658981
comment on: http://stackoverflow.com/a/24544278
score: 2
type: Comment
has text: `XPathConstants.NODELIST` does not look OK anymore, should be `NODESET`. See - https://docs.oracle.com/javase/7/docs/api/javax/xml/xpath/XPathConstants.html
type: AnswerComment

http://stackoverflow.com/comment/37927700
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24499620
has text: of course, i will try that. i completely forgot it. thank you so much
score: 0

http://stackoverflow.com/q/24480502
has answer: http://stackoverflow.com/a/24480622
accepted answer: http://stackoverflow.com/a/24488339
tagged with: android
has body: My app needs to connect to my own server, so I added my server's self signed certificate to the KeyStore. It works very well with my server but the issue is that now my app won't accept all other certificates! For example if I try to connect to https://maps.googleapis.com/ I get a missing certificate exception. How could I fix this? Here is how I trust my certificate: public static void setSelfSignedCertSSLContext(AssetManager assets) throws Exception { // Load self-signed cert from an InputStream CertificateFactory cf = CertificateFactory.getInstance("X.509"); InputStream caInput = assets.open("selfSigned.cer"); Certificate ca; try { ca = cf.generateCertificate(caInput); Log.d(LOG_TAG, "ca=" + ((X509Certificate) ca).getSubjectDN()); } finally { caInput.close(); } // Create a KeyStore containing our trusted CAs String keyStoreType = KeyStore.getDefaultType(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(null, null); keyStore.setCertificateEntry("ca", ca); // Create a TrustManager that trusts the CAs in our KeyStore String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm); tmf.init(keyStore); KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory .getDefaultAlgorithm()); kmf.init(keyStore, "changeit".toCharArray()); // Create an SSLContext that uses our TrustManager SSLContext context = SSLContext.getInstance("TLS"); SSLContext.setDefault(context); context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); HttpsURLConnection.setDefaultSSLSocketFactory(context .getSocketFactory()); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { public boolean verify(String string, SSLSession ssls) { return true; } }); Log.d(LOG_TAG, "SSLContext set successfully"); } and here is the exception I get when trying to connect to google: 06-29 23:27:59.181: E/AdapterClass(16358): javax.net.ssl.SSLHandshakeException: java.security.cert.CertPa…
has title: Android app SSL issue when trusting self signed certificate
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24488339
type: Question
possible better answer: http://stackoverflow.com/a/24480622
tagged with: java
tagged with: ssl
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/37892032
favorite count: 0

http://stackoverflow.com/q/24554241
has title: Calendar not working fine
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24554613
tagged with: calendar
has body: I am a 3 month old java student. For one of my module I tried to make first day of week as tuesday(so that a real friday should now be at index 3) but it didn't show expected result. I am inputting day through scanner. Below is the concerned piece of code and output: Calendar c= Calendar.getInstance(); c.setFirstDayOfWeek(Calendar.TUESDAY); c.setTime(date); int dayOfWeek=c.get(Calendar.DAY_OF_WEEK); System.out.println(dayOfWeek); Output: Enter the date(dd/mm/yyyy): 03/07/2014 6 Don't know where I am wrong. Tried a lot googling around and even set minimalDAysOfFirstWeek but nothing working out. What i want is 03/07/2014 to be shown as index 3. How to achieve so?
possible better answer: http://stackoverflow.com/a/24554613
tagged with: java
has answer: http://stackoverflow.com/a/24554404
tagged with: date
accepted answer: http://stackoverflow.com/a/24554404
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/24530714
has body: I am trying to Edit a existing file which is in my R.raw folder i am able to read the file but when i run the write function it is not working . public void tofile(View v){ BufferedWriter bw=null; FileWriter fw =null; try { String path = ("/Page2/res/raw/text.txt"); File file = new File(path); fw = new FileWriter(file); bw = new BufferedWriter(fw); bw.write("hello"); bw.flush(); bw.close(); } catch (IOException e) { e.printStackTrace(); } } i even tried fw = new FileWriter(file,true); if i add toast between even line it seems to get stuck at fw = new FileWriter(fw);
linked to: http://stackoverflow.com/q/10457053
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37984616
linked to: http://stackoverflow.com/q/11628058
tagged with: java
has title: Editing a file using FileWriter
type: Question
has comment: http://stackoverflow.com/comment/38126355
score: 0
has answer: http://stackoverflow.com/a/24603259
answer count: 1
has comment: http://stackoverflow.com/comment/38121444

http://stackoverflow.com/q/24543086
answer count: 2
possible better answer: http://stackoverflow.com/a/24547124
tagged with: jpa
accepted answer: http://stackoverflow.com/a/24559490
has answer: http://stackoverflow.com/a/24547124
score: 0
tagged with: sql
has body: i try to write a JPQL query, which deletes all entities which are within a collection of another entity. (Example code, without getter/setter and annotations) class Aa implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String value; } @Entity class A implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @JoinColumn(nullable = false) @OneToOne private Aa aa; @OneToMany(fetch = FetchType.EAGER, cascade = {CascadeType.ALL}) private List&lt;B&gt; data; } @Entity class B implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String value; } I have tried the following: DELETE FROM B b WHERE b.id IN(SELECT k.id FROM A a JOIN a.data k WHERE a.id = :id) But its end in a foreign key violation exception. Another approach was DELETE FROM B b WHERE EXISTS(SELECT a FROM A a WHERE a.id = :id) but its end in a foreign key violation too. However if i execute a sql query on the database directly, like DELETE FROM B WHERE id = &lt;a id number here&gt; then no error occurs... EntityManager.remove() is not an option because i want to delete a huge amout of data. I'm thankfully for every answer and help.
has answer: http://stackoverflow.com/a/24559490
type: AnsweredQuestion
tagged with: java
has title: JPQL DELETE query: delete entities within a list of another entity
type: Question

http://stackoverflow.com/comment/38070633
has text: Copy-paste from the linked question.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24569631

http://stackoverflow.com/comment/37895144
type: Comment
has text: @user3720722: chit man, you've already got nested for loops that already iterate through the array's rows and columns!
comment on: http://stackoverflow.com/a/24482029
type: AnswerComment
score: 0

http://stackoverflow.com/a/24465910
answers question: http://stackoverflow.com/q/24465722
has comment: http://stackoverflow.com/comment/37864420
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37864222
has comment: http://stackoverflow.com/comment/37864713
has comment: http://stackoverflow.com/comment/37864632
has comment: http://stackoverflow.com/comment/37864924
score: 0
accepted answer of: http://stackoverflow.com/q/24465722
type: Answer
has comment: http://stackoverflow.com/comment/37864371
has comment: http://stackoverflow.com/comment/37864698
has comment: http://stackoverflow.com/comment/37864745
has comment: http://stackoverflow.com/comment/37864388
has comment: http://stackoverflow.com/comment/37864572
has body: To set H2SO4 in textview,Use subscript tag as textview.setText(Html.fromHtml("H2SO4"), TextView.BufferType.EDITABLE); where textview is your Textview's tag. And get text from textview as String str = Html.toHtml(textview.getEditableText()).toString(); anothertextview.setText(Html.fromHtml(str)); For more info see Selecting, Highlighting, or Styling Portions of Text
has comment: http://stackoverflow.com/comment/37864663
has comment: http://stackoverflow.com/comment/37864590
has comment: http://stackoverflow.com/comment/37864774

http://stackoverflow.com/comment/37846907
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24454596
score: 0
has text: And, BTW, executing "command >> file" will not work from Java. >> is a shell redirect, so unless you're specifically creating a shell it will be treated as a program argument. Many other stackoverflow questions address this point and how to handle it.

http://stackoverflow.com/comment/38168531
comment on: http://stackoverflow.com/q/24570558
score: 0
has text: What I'm saying is, that if your 3rd party library forces you to do something in a specific way, I wouldn't call it compatibility code. It sure isn't interims code. I don't now your setting (it seems to be a little to complex for this site), but if it's code you don't need anymore later on, perform all the steps to get rid of it immediately instead of later. If there is no way to get rid of it, don't mark it deprecated or something like that in the first place.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37941315
comment on: http://stackoverflow.com/q/24505374
score: 0
type: QuestionComment
type: Comment
has text: Hi, I think that your type definitions are correct, can you share your wsdl in order to do some tries? maybe the error is in another place.

crash
tags question: http://stackoverflow.com/q/24490912
tag name: crash
tags question: http://stackoverflow.com/q/24450573
tags question: http://stackoverflow.com/q/24441154
type: Tag

http://stackoverflow.com/a/24531228
type: Answer
answers question: http://stackoverflow.com/q/24529600
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/38018343
has body: I should probably state that I fully agree with @peeskillet, and would not recommend using what I suggest below. :-) But if you really want to extend BufferedImage, you could do something like this (inspired by my old EasyImage class, which is in the sandbox for a reason...): public class EasyImage extends BufferedImage { public EasyImage(File iput) throws IOException { this(ImageIO.read(input)); } public EasyImage(BufferedImage image) { this(image.getColorModel(), image.getRaster()); } private EasyImage(ColorModel cm, WritableRaster raster) { super(cm, raster, cm.isAlphaPremultiplied(), null); } public boolean write(String format, File output) throws IOException { return ImageIO.write(this, format, output); } }

http://stackoverflow.com/comment/37946654
score: 1
type: AnswerComment
has text: +1, and BTW: When multiple tasks have to be submitted, one can conveniently put them into a collection and pass this collection to http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html#invokeAll-java.util.Collection- - this will wait automatically until all tasks are completed.
comment on: http://stackoverflow.com/a/24509735
type: Comment

http://stackoverflow.com/q/24552348
upvote count: 1
has comment: http://stackoverflow.com/comment/38041430
score: 1
tagged with: java
type: Question
tagged with: dependency-injection
tagged with: guice
has comment: http://stackoverflow.com/comment/38028885
answer count: 1
downvote count: 0
favorite count: 0
has body: having a problem with the openkad project, but may be a guice/environment issue: gist is code uses Guice to : @Provides @Singleton @Named("openkad.rnd") Random provideRandom(@Named("openkad.seed") final long seed) { return seed == 0 ? new Random() : new Random(seed); } however @Singleton and @Named("openkad.rnd") are both flagged by the compiler as incorrect placement. and apparently correctly so, as the named annotation targets a field, not method: /** * Annotates named things. * * @author crazybob@google.com (Bob Lee) */ @Retention(RUNTIME) @Target({ ElementType.FIELD, ElementType.PARAMETER }) @BindingAnnotation public @interface Named { String value(); } To recreate: Create Java Project in eclipse using JDK 1.6 or 1.8 targeting various runtimes Include dependencies via pom (guice 1 through 4 tried) Using source or openkad r60 jar file run unit tests (https://code.google.com/p/openkad/) What is the expected output? What do you see instead? Success for all UT's, but I see this instead: com.google.inject.CreationException: Guice configuration errors: 1) Error at il.technion.ewolf.kbr.openkad.BootstrapNodesSaver.&lt;init&gt;(BootstrapNodesSaver.java:26): Binding to java.io.File annotated with @com.google.inject.name.Named(value=openkad.file.nodes) not found. No bindings to that type were found. 2) Error at il.technion.ewolf.kbr.openkad.IncomingContentHandler.&lt;init&gt;(IncomingContentHandler.java:43): Binding to java.util.concurrent.ExecutorService annotated with @com.google.inject.name.Named(value=openkad.executors.client) not found. No bindings to that type were found. 3) Error at il.technion.ewolf.kbr.openkad.KadNet.&lt;init&gt;(KadNet.java:75): Binding to il.technion.ewolf.kbr.Node annotated with @com.google.inject.name.Named(value=openkad.local.node) not found. No bindings to that type were found. 4) Error at il.technion.ewolf.kbr.openkad.bucket.KadBuckets.&lt;init&gt;(KadBuckets.java:58): Binding to il.technion.ewolf.kbr.KeyFactory not found. No bindings to t…
has answer: http://stackoverflow.com/a/24610762
has title: Named annotation failing in jar and source
type: UnansweredQuestion
tagged with: annotations

http://stackoverflow.com/q/24468922
tagged with: apache-poi
type: UnansweredQuestion
tagged with: excel
has title: POI overriding the old excel sheet with new excel sheet
has body: if i create a first sheet it is working fine. if i call the same method to create new sheet it will over ride the previous sheet. After couple of method calls, it is showing only one sheet(last sheet). In my code every time i am creating sheet only, not workbook every time. could any body please explain.how to code it.
score: 0
tagged with: java
tagged with: selenium
tagged with: webdriver
has comment: http://stackoverflow.com/comment/37870696
type: Question
has comment: http://stackoverflow.com/comment/37870703
answer count: 1
has answer: http://stackoverflow.com/a/24650449

http://stackoverflow.com/comment/38041033
type: Comment
score: 0
has text: The units ArrayList is initialized in the code shown.
type: QuestionComment
comment on: http://stackoverflow.com/q/24560753

http://stackoverflow.com/a/36861092
has body: I had the same issue: When I build with maven, it ran well, but there was an error when running in the IDE by tomcat. I think it is because the IDE cannot copy jar libraries to output folder, ie..WEB-INF/lib/ check it For me (a lazy method), just copy the missing jars to webapp/WEB-INF/lib/ [ps: under the development directory, not the output one]
type: Answer
answers question: http://stackoverflow.com/q/24520842
score: 4
upvote count: 4
downvote count: 0

import
type: Tag
tags question: http://stackoverflow.com/q/24468339
tag name: import
tags question: http://stackoverflow.com/q/24532103
tags question: http://stackoverflow.com/q/24427597
tags question: http://stackoverflow.com/q/24463906
tags question: http://stackoverflow.com/q/24578243
tags question: http://stackoverflow.com/q/24449870
tags question: http://stackoverflow.com/q/24532854

http://stackoverflow.com/a/24533896
has comment: http://stackoverflow.com/comment/37990827
type: Answer
accepted answer of: http://stackoverflow.com/q/24533769
answers question: http://stackoverflow.com/q/24533769
has body: I think that is because of the indexing of tag. The if check also skips an index. So even though value is not being inserted it will result in null. Use separate index for tag array int j = 0; for(int i = 0; i &lt; tags.length; i++) { String content = childNodes.item(i).getNodeName().trim().replaceAll("\\s", ""); if(childNodes.item(i).getNodeType() == Node.ELEMENT_NODE &amp;&amp; childNodes.item(i).getNodeName() != null) { tags[j++] = content; } } Since you are omitting some of the child nodes, creating an array of entire child nodes length may result in wastage of memory. You can use a List instead. If you are particular about String array you can later convert this to an array as well. public String[] getAvailableTags() throws Exception { String path = "/docusign-cfg/tagConfig/tags"; XPathFactory f = XPathFactory.newInstance(); XPath x = f.newXPath(); Object result = null; try { XPathExpression expr = x.compile(path); result = expr.evaluate(doc, XPathConstants.NODE); } catch (XPathExpressionException e) { throw new Exception("An error ocurred while trying to retrieve the tags"); } Node node = (Node) result; NodeList childNodes = node.getChildNodes(); List&lt;String&gt; tags = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; tags.length; i++) { String content = childNodes.item(i).getNodeName().trim().replaceAll("\\s", ""); if(childNodes.item(i).getNodeType() == Node.ELEMENT_NODE &amp;&amp; childNodes.item(i).getNodeName() != null) { tags.add(content); } } String[] tagsArray = tags.toArray(new String[tags.size()]); return tagsArray; }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37991046

http://stackoverflow.com/comment/38545651
type: AnswerComment
has text: I did not solve it yet, but you were so helpful so I decided to award the bounty anyway.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24740971

http://stackoverflow.com/comment/38081418
has text: Yes, I finanlly solved this, the trick is to call .toTop() when you make the window visible, requestFocus() doesn't seem to change the focus state at all. Please make a detailed answer so I can accept it.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24579087

http://stackoverflow.com/comment/37991192
type: AnswerComment
type: Comment
has text: If you want to ignore nested splitted messages it just enough to configure `XPathMessageSplitter` as I've shown in JIRA: https://jira.spring.io/browse/INT-3415. The main trick - disable `apply-sequence` for nested splitters.
comment on: http://stackoverflow.com/a/24533068
score: 0

http://stackoverflow.com/comment/37821964
has text: Ok I have to use a substring. Here is the exact problem I am working on.
comment on: http://stackoverflow.com/q/24442698
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37879679
type: QuestionComment
has text: That's not a question. It's an affirmation. A question ends with a question mark.
comment on: http://stackoverflow.com/q/24473999
score: 0
type: Comment

http://stackoverflow.com/a/24505734
answers question: http://stackoverflow.com/q/24505564
type: Answer
has body: You may still be right about your CSS, since the fact that the main html has been saved does not mean that the CSS is well saved (actually, we don't even know if it tries to save it, have you tried to do your work through a proxy like Paros in order to know every communication you attempt?) http://sourceforge.net/projects/paros/ By the way, your problem may be different. Are you behind a corporate proxy in your production environment? Does your "flying saucer pdf library" need any external resource (any .xsd or something like that) that could be stuck in the firewall and cause that time-out? Make sure that you have under controll all the communication your application generates and you will find your problem.
score: 0

http://stackoverflow.com/comment/37921622
score: 0
has text: Make sure you are running Eclipse/Android Studio with JDK 1.7.
type: QuestionComment
comment on: http://stackoverflow.com/q/24496277
type: Comment

http://stackoverflow.com/comment/38402676
type: Comment
has text: Please check it once i feel u can help me.
type: AnswerComment
comment on: http://stackoverflow.com/a/24573593
score: 0

http://stackoverflow.com/q/24541060
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38013488
type: Question
has body: I'm curious why there is no implementation for Sheet.setColumnWidth that accepts a Points parameter. There is a method to set the height of a Row in points, which is setHeightInPoints The only available method to set the width is accepting a rather weird scale, defined as width = Truncate([{Number of Visible Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256 This means it depends on some width of a digit, so the value used in the parameter is just 1/256 of what is wanted here, some straight representation of a width. In Excel itself you set the width in Points, too. This means behaviour of Row-height and Column-width is not symetric. Is there any rational reason for only having that version of setColumnWidth? This leads to serious problems, as the best I can get has a different result on every computer, because the width which is set is depending on the users default font setting. I believe it has something to do with displaying nicely on many different setups, as the comment of pnuts suggests. But it is only usable in a very narrow field. At the moment I believe that there is no simple workaround for that, and I cannot find one right now. (just one that works for my case perhaps) Is there any good way to calculate a column width value from a desired points value? I.e. I want 120 points on any computer that is using the excel export functionality. What is the width value to use as parameter here to get the wanted points width?
has title: Why is Sheet.setColumnWidth not in Points? Is there a workaround?
tagged with: apache-poi
score: 0
has comment: http://stackoverflow.com/comment/38004888
tagged with: excel
tagged with: width
has comment: http://stackoverflow.com/comment/38015558
has comment: http://stackoverflow.com/comment/38018250
tagged with: java
has comment: http://stackoverflow.com/comment/38018468
answer count: 0

http://stackoverflow.com/q/24571656
tagged with: jakarta-ee
has body: I'm coding a WebService, and these terms that they use really confuses me. I've done a lot of research and it is still very vague what these terms are.
accepted answer: http://stackoverflow.com/a/24571777
tagged with: ejb
has answer: http://stackoverflow.com/a/24571777
answer count: 1
downvote count: 0
has title: Domain Object? Business Object? Model? Domain Model? What are the differences?
favorite count: 0
has comment: http://stackoverflow.com/comment/38062469
tagged with: spring
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question

http://stackoverflow.com/comment/38084362
score: 0
has text: @user3717646 could you be slightly more descriptive please, I don't know what you mean by that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24584258

http://stackoverflow.com/a/24588683
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24587542
downvote count: 0
has body: You can listen to every key event in the current Eclipse using a filter on the current SWT Display object - something like: Display.getDefault().addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event event) { // TODO handle key down here } }); which gives you a basis for what you want to do.

http://stackoverflow.com/a/24506198
downvote count: 0
has body: If your connection is supposed to handle the stream of same packet types as the first packet type (i.e. the first packet determines the state of the connection), you could take a look into the port unification example. If your connection is supposed to handle the stream of arbitrary packet types, you'd better write a decoder that understands all packet types and converts them into a POJO. Unless the number of packet types to handle are too many, it shouldn't be very difficult. Once a decoder decodes a packet, your last handler in the pipeline will look like the following: public class MyPacketHandler extends SimpleChannelInboundHandler { @Override public void channelRead0(ChannelHandlerContext ctx, Object msg) { if (msg instanceof MsgA) { handleA(ctx, (MsgA) msg); } else if (msg instanceof MsgB) { handleB(ctx, (MsgB) msg); } ... } private void handleA(ChannelHandlerContext ctx, MsgA msg) { ... } ... } If you do not like the tedious if-else blocks, you could make use of a java.util.Map and Class.isAssignableFrom().
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38014095
accepted answer of: http://stackoverflow.com/q/24491163
score: 4
answers question: http://stackoverflow.com/q/24491163
type: Answer
upvote count: 4

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/24528156
type: Tag

http://stackoverflow.com/comment/37800422
score: 0
has text: tried a few different solutions, yours works like charm, following your approach I was able to solve a few other problems as well :D thank you
comment on: http://stackoverflow.com/a/24428382
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24538231
has comment: http://stackoverflow.com/comment/38000719
has comment: http://stackoverflow.com/comment/38004628
has comment: http://stackoverflow.com/comment/38000532
answers question: http://stackoverflow.com/q/24537436
has comment: http://stackoverflow.com/comment/38000408
accepted answer of: http://stackoverflow.com/q/24537436
upvote count: 3
has body: Seems to me the database will also have the salt, and the application needs that to compute the hash. Therefore you should use SELECT `passwordHash`, `Salt` FROM `--database--` WHERE `username`= ?; and perform the comparison at the application level. This division of responsibility will come in handy later as you build out your authentication mechanism, e.g. if you add a lockout mechanism: SELECT `passwordHash`, `Salt`, `LockoutStatus` FROM `--database--` WHERE `username`= ?; If you are not using user-specific salt or a lockout then you have a potential security issue. See the oWASP guidance on this topic.
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/q/24508728
type: Question
has title: Get a Graph item image changing onTouch - Android
tagged with: ontouch
has body: I am trying to get an individual item within a GridView to change image when a finger moves across it. I have two images, no_touch and touch. What I want is for all of the items in GridView to be set as no_touch when the activity is started, and when any one or more of the items is touched by finger just those ones change to the touch image. All I can get so far is when one of the items is clicked it changes the background of the whole GridView (and a small toast appears). I want to be able to "glide" along each item and have only those ones change image. My code so far: MainActivity.java: public class MainActivty extends Activity { drawingView dview; GridView grid; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_activity1); final GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setVisibility(GridView.VISIBLE); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { gridview.setBackgroundColor(Color.RED); Toast.makeText(Activity1.this, "Position " + position, Toast.LENGTH_SHORT).show(); } }); } } ImageAdapter.java public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { imageView = new ImageView(mContext); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); return imageView; } public Integer[] mThumbIds = {R.drawable.images ....}; } If anyone knows how to, even just to get an individual item changing …
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24509050
tagged with: android
tagged with: gridview
tagged with: java

http://stackoverflow.com/comment/37828000
type: AnswerComment
comment on: http://stackoverflow.com/a/24446147
has text: I'm reading docs now, looks promising, need to read more about spring.
score: 0
type: Comment

http://stackoverflow.com/a/24527273
type: Answer
answers question: http://stackoverflow.com/q/24526276
has body: I think that will be really difficult (if it's even possible). But I have two other things you could try to find places where classes should override hashCode(): At least Netbeans has a hint for "overrides equals but not hashCode" that could help a little. Place a breakpoint on Object.hashCode() and run a more or less representative testset.
has comment: http://stackoverflow.com/comment/37978123
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/a/24447419
score: 1
has comment: http://stackoverflow.com/comment/37943570
has comment: http://stackoverflow.com/comment/37967934
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37975617
has body: You should be sure that you have all jars in the CLASSPATH. In your case it is jpos.jar. And they all (with Spring) should be loaded withing the same classloader. And one more advice: add -verbose option to the java (I guess Tomcat) to see from where your classes are loaded.
type: Answer
has comment: http://stackoverflow.com/comment/37938353
answers question: http://stackoverflow.com/q/24443639
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24443639

http://stackoverflow.com/comment/38062087
has text: its kind of snipped for you... hope its work for you.
comment on: http://stackoverflow.com/a/24572268
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37983336
type: AnswerComment
comment on: http://stackoverflow.com/a/24530073
type: Comment
score: 0
has text: u mean downcasting is not possible in java

http://stackoverflow.com/q/24562469
has comment: http://stackoverflow.com/comment/38067017
has comment: http://stackoverflow.com/comment/38141645
upvote count: 2
has title: Configuring session cookies in Weblogic
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24636774
tagged with: cookies
tagged with: session
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24636774
tagged with: weblogic
score: 2
answer count: 1
has comment: http://stackoverflow.com/comment/52896326
downvote count: 0
favorite count: 0
has body: I'm pretty new to Weblogic and I'm currently trying to convert a web application that I've been running using Tomcat on my local machine to work with Weblogic since our production servers are weblogic. I'm having trouble configuring weblogic.xml so that I can access session attributes. Currently my weblogic.xml looks like this... <?xml version='1.0' encoding='UTF-8'?> JSESSIONID localhost /domain false false false true false /domain springLib This does not seem to be working when I run locally. Do I need to include the port number in the cookie-domain (i.e. localhost:7001)? This seems to be the only glitch I haven't been able to resolve. If anyone has any ideas please help. Thanks in advance.

http://stackoverflow.com/a/44481121
type: Answer
has comment: http://stackoverflow.com/comment/137165061
upvote count: 42
has comment: http://stackoverflow.com/comment/113351186
answers question: http://stackoverflow.com/q/24541786
downvote count: 0
score: 42
has body: IntelliJ has such a nice plugin for this case as a Java Stream Debugger plugin. You should check it out: https://plugins.jetbrains.com/plugin/9696-java-stream-debugger?platform=hootsuite It extends the IDEA Debugger tool window by adding the Trace Current Stream Chain button, which becomes active when debugger stops inside of a chain of Stream API calls. It has nice interface for working with separate streams operations and gives you opportunity to follow some values that u should debug. You can launch it manually from the Debug window by clicking here:

http://stackoverflow.com/q/24466007
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24467204
type: Question
has title: ImageView And Image JavaFX
answer count: 1
score: 0
has body: I have ImageView object defined in FXML called nameImage. I want to load an Image if the condition gets satisfied. String name = playerNameFld.getText(); if ((name == null) || (name.trim().equals(""))) { uspesno = false; nameImage.setImage(new Image(getClass().getResourceAsStream( "/images/error.png"), 25.0, 25.0, true, true)); } else { uspesno = true; } And I have tried various InputStream but it returns InputStream must not be null.. Any idea?
has answer: http://stackoverflow.com/a/24467204
type: AnsweredQuestion

http://stackoverflow.com/comment/38029954
score: 0
type: AnswerComment
has text: I think an explantion would be more helpful for the Op and further visitors
comment on: http://stackoverflow.com/a/24554613
type: Comment

http://stackoverflow.com/q/24452192
tagged with: macos
score: 8
favorite count: 0
has title: Can JavaFX 8 set a default menu bar?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27840510
downvote count: 0
has comment: http://stackoverflow.com/comment/44529493
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/28072493
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/25089903
tagged with: javafx-8
answer count: 3
has body: A trivial toy application with a screen menu bar can be written like this in Java FX 8: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.input.KeyCombination; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class Main extends Application { public static void main(final String[] args) throws Exception { launch(Main.class, args); } @Override public void start(Stage stage) throws Exception { MenuBar menuBar = new MenuBar(); Menu fileMenu = new Menu("File"); MenuItem newNotebookMenuItem = new MenuItem("New Notebook..."); newNotebookMenuItem.setAccelerator(KeyCombination.keyCombination("Meta+N")); newNotebookMenuItem.setOnAction(event -&gt; { System.out.println("Action fired"); }); fileMenu.getItems().add(newNotebookMenuItem); menuBar.getMenus().add(fileMenu); menuBar.setUseSystemMenuBar(true); VBox root = new VBox(); root.getChildren().add(menuBar); Scene scene = new Scene(root, 400, 350); stage.setScene(scene); stage.show(); } } This might be OK for making toy apps like calculators where there is only one window and the application closes when the last window closes, but my application is document-based. When a document-based application has no documents open, there are no windows open but the menu should remain visible so that the user can open a new document. The usual way to do this is setDefaultMenuBar in the com.apple.eawt APIs, but this is not great because: Setting the menu bar from there hangs the application (possibly some kind of incompatibility between AWT and JavaFX - it doesn't happen with the same application running as pure Swing.) It requires me to build a javafx MenuBar for the real windows but a JMenuBar for the default menu bar and JavaFX doesn't let me reuse my Action classes, so awful adapters would end up being written to bridge the gap. Is there a proper way to set this which I just h…

http://stackoverflow.com/comment/37879264
has text: -1 because Boolean's internal implementation of `compareTo` is: `return (x == y) ? 0 : (x ? 1 : -1);` which, according to requirements, is disallowed.
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24473544

http://stackoverflow.com/comment/38077876
type: Comment
has text: So there is no other, say technical, reason?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24580586

http://stackoverflow.com/a/44532322
score: 0
has body: This worked for me: @FXML public void autoShow() { checkmenuitem.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent e) { e.consume(); } }); } checkmenuitem is the id. When it is clicked, the handle method is executed. For a detailed explanation on the event.consume() method, see this: What is the meaning of Event consumes in JavaFX Place the above method in your controller class and then call it from the initialize method in your controller class: @Override public void initialize(URL location, ResourceBundle resources) { autoShow(); }
type: Answer
answers question: http://stackoverflow.com/q/24486353

http://stackoverflow.com/comment/37906301
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24487607
type: Comment
has text: where is here the test for `0s` or `1s` ?

http://stackoverflow.com/q/24486002
has answer: http://stackoverflow.com/a/24492225
answer count: 3
has answer: http://stackoverflow.com/a/28469543
linked to: http://stackoverflow.com/q/26958865
tagged with: sqoop
has answer: http://stackoverflow.com/a/34674268
type: UnansweredQuestion
has title: No FileSystem for scheme: hdfs, in Java Program
tagged with: hive
tagged with: java
tagged with: mysql
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/37910696
has comment: http://stackoverflow.com/comment/37902544
has body: I have problem when executing this java code to import table from mysql into hive : import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.*; import com.cloudera.sqoop.Sqoop; import com.cloudera.sqoop.SqoopOptions; import com.cloudera.sqoop.SqoopOptions.FileLayout; import com.cloudera.sqoop.tool.ImportTool; import com.mysql.jdbc.*; public class SqoopExample { public static void main(String[] args) throws Exception { String driver = "com.mysql.jdbc.Driver"; Class.forName(driver).newInstance(); Configuration config = new Configuration(); config.addResource(new Path("/home/socio/hadoop/etc/hadoop/core-site.xml")); config.addResource(new Path("/home/socio/hadoop/etc/hadoop/hdfs-site.xml")); FileSystem dfs = FileSystem.get(config); SqoopOptions options = new SqoopOptions(); options.setDriverClassName(driver); options.setConf(config); options.setHiveTableName("tlinesuccess"); options.setConnManagerClassName("org.apache.sqoop.manager.GenericJdbcManager"); options.setConnectString("jdbc:mysql://dba-virtual-machine/test"); options.setHadoopMapRedHome("/home/socio/hadoop"); options.setHiveHome("/home/socio/hive"); options.setTableName("textlines"); options.setColumns(new String[] {"line"}); options.setUsername("socio"); options.setNumMappers(1); options.setJobName("Test Import"); options.setOverwriteHiveTable(true); options.setHiveImport(true); options.setFileLayout(FileLayout.TextFile); int ret = new ImportTool().run(options); } } result : Exception in thread "main" java.io.IOException: No FileSystem for scheme: hdfs at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2385) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2392) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:89) at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2431) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2413) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:368) at org.apache.hadoop.fs.FileSy…
score: 0

http://stackoverflow.com/a/24534541
answers question: http://stackoverflow.com/q/24534480
type: Answer
has body: You don't really have to install it. You should be able to navigate into [your jdk folder]/bin and run ./javac -version. So just add the bin folder to your path and set $JAVA_HOME and you're good to go.
has comment: http://stackoverflow.com/comment/37992811
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24534480
has comment: http://stackoverflow.com/comment/38146732

http://stackoverflow.com/comment/37900529
score: 0
type: Comment
type: QuestionComment
has text: Is that better indented? I'm sorry, I'm not trying to make this hard on you guys, I really want to learn!
comment on: http://stackoverflow.com/q/24484661

http://stackoverflow.com/comment/38071792
has text: @MarkPeters Do you think that it would be possible to do that if this class was a singleton inside soot? (and not as an external class , as it is now)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24577216
type: AnswerComment

http://stackoverflow.com/a/24486235
answers question: http://stackoverflow.com/q/24484661
has body: Use this simple utility. Easiest way to write ints to file public class WriteInts { private String fname; public WriteInts(String fname) { this.fname = fname; } public void write(int... a) throws IOException { File file = new File(fname); try { System.out.println("WRiting to-" + file.getAbsolutePath()); if (!file.exists()) file.createNewFile(); file.canRead(); } catch (IOException x) { x.printStackTrace(); } BufferedWriter outputWriter = new BufferedWriter(new FileWriter(file)); for (int i = 0; i &lt; a.length; i++) { outputWriter.write(Integer.toString(a[i])); /* * Add new line to keep them seperated */ outputWriter.newLine(); } /* * Flush and close the stream */ outputWriter.flush(); outputWriter.close(); } public static void main(String[] args) { int myArr[] = { 16, 31, 90, 45, 89 }; try { WriteInts wi = new WriteInts("mydata.dat"); wi.write(myArr); } catch (IOException e) { e.printStackTrace(); } } }
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24484661

http://stackoverflow.com/comment/37836961
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24450246
has text: Well since its a university assignment i don't want to put the data structure and the actual input data because im not sure if im supposed to ask such a question here or not. I don't think there is anything wrong tbh, its not like i am asking for the asnwer or something. But w/e. Anyway if you could produce something only for this small tree that would be fine. Keep the leafs as they are and have the nodes hold the sum of their underlying clusters. or something similar. Would that be enough? Im sorry for the confusion.

http://stackoverflow.com/comment/37852528
has text: I edited the question with the solution. I feel so dumb now.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24459570
type: QuestionComment

http://stackoverflow.com/comment/43475792
type: AnswerComment
type: Comment
has text: I adopted the approach of logging the results of `getEnvironment().getActiveProfiles()`, as part of start-up logging in my application `main` method.
comment on: http://stackoverflow.com/a/25985710
score: 1

http://stackoverflow.com/comment/38002040
comment on: http://stackoverflow.com/q/24539648
type: Comment
type: QuestionComment
score: 0
has text: What directory are the actual source files in, and what directory are you in when you're trying to compile them? Before ruling out classpath as a problem, what, actually, is your classpath? Have you set a source path?

http://stackoverflow.com/comment/38053529
has text: @JB Nizet-I was asked this in an interview, so wanted to try it.
comment on: http://stackoverflow.com/a/24567287
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37970109
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24520997
has text: Is it because of many conditions?
type: Comment

http://stackoverflow.com/comment/37957865
type: AnswerComment
has text: @Neil: I agree this particular example is overengineered. but this does show the OP how to get this object working with a map.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24516003

http://stackoverflow.com/comment/37939689
comment on: http://stackoverflow.com/q/24506350
type: Comment
type: QuestionComment
has text: You'll need to place the code that is reliant on the return result within the `Runnable` context as well
score: 0

http://stackoverflow.com/comment/38000023
has text: Thank you for this explanation! It really helped clarify why Autocrab's response was correct. :)
comment on: http://stackoverflow.com/a/24538554
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37813254
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24438046
has text: i do not get it but thank you so i let everybody to have fun to vote me down or colse it cuz clearly nobody can understand my confusion

apache-pig
tags question: http://stackoverflow.com/q/24566799
tags question: http://stackoverflow.com/q/24430998
tags question: http://stackoverflow.com/q/24549808
tag name: apache-pig
tags question: http://stackoverflow.com/q/24447738
type: Tag

http://stackoverflow.com/comment/37925181
comment on: http://stackoverflow.com/a/24497946
type: AnswerComment
score: 0
type: Comment
has text: Blog beat me to the response. I've updated my answer and it shows how you can access the return calls and return the value without having an instance variable. You should not use an instance variable in this problem. I don't have the node class to test it, but that should work.

http://stackoverflow.com/a/24428826
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24428748
has body: You could use TDoubleArraList or guava's primitive list collection. You could also determine the size in advance in one loop and add the values in another.
downvote count: 0

split
tags question: http://stackoverflow.com/q/24502811
tag name: split
tags question: http://stackoverflow.com/q/24432247
tags question: http://stackoverflow.com/q/24431769
tags question: http://stackoverflow.com/q/24580328
tags question: http://stackoverflow.com/q/24565020
type: Tag
tags question: http://stackoverflow.com/q/24558099
tags question: http://stackoverflow.com/q/24492638
tags question: http://stackoverflow.com/q/24483332

http://stackoverflow.com/q/24448500
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3289319
linked to: http://stackoverflow.com/q/10384386
linked to: http://stackoverflow.com/q/5842037
has title: DLL Call From Java Returns an UnsatisfiedLinkError
linked to: http://stackoverflow.com/q/4813336
linked to: http://stackoverflow.com/q/6661506
linked to: http://stackoverflow.com/q/18173793
linked to: http://stackoverflow.com/q/2800629
linked to: http://stackoverflow.com/q/16518490
tagged with: dll
tagged with: java-native-interface
tagged with: java
linked to: http://stackoverflow.com/q/2284470
tagged with: eclipse
type: Question
score: 0
linked to: http://stackoverflow.com/q/538886
answer count: 1
has body: Edit: Problem solved I created a new project and imported the source files. (After trying too many options the project configuration was wrong.) It seems that I had confused the load and loadlibrary functions. load requires an absolute path including file postfix, e.g.: static { System.load("c:/windows/system32/jnpout32.dll");} When trying to call jnpout32.dll (http://www.hytherion.com/beattidp/comput/pport.htm) from Java in Eclipse (Windows 7, Java SE1.7) I receive the error: Exception in thread "main" java.lang.UnsatisfiedLinkError: EEGTrigger.ioPort.Out32(SS)V at EEGTrigger.ioPort.Out32(Native Method) at EEGTrigger.pPort.setAllDataBits(pPort.java:53) at EEGTrigger.pPort.&lt;init&gt;(pPort.java:19) at EEGTrigger.EEGTrigger.main(EEGTrigger.java:11) The dll file is located in System32, in the src folder, and in C:\Users[user]\AppData\Local (as indicated by System.getenv()) In the Classpath under User entries, the file is also loaded jnpout32.dll - \[Project]\src\[Project]\ and it is visible under Referenced Libraries in the Package Explorer Both these lines do not work: static { System.loadLibrary("jnpout32"); } static { System.load("c:/windows/system32/jnpout32"); } (.load as suggested in java.lang.UnsatisfiedLinkError - JNI) I have confirmed that (based on java.lang.UnsatisfiedLinkError) System.getProperty("java.library.path") returns the system32 path. The complete code of the java project (I have only authored the EEGTrigger class. The rest comes with the dll.): package EEGTrigger; public class EEGTrigger { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Starting trigger..."); pPort lpt1 = new pPort(); testProtocol(lpt1); } private static void testProtocol(pPort lpt1) { // TODO Auto-generated method stub short selectTrigger = 0; sendPulse(lpt1, selectTrigger); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } selectTrigger = 1; sendPulse(lpt1, sel…
has answer: http://stackoverflow.com/a/24456381

http://stackoverflow.com/q/24464812
tagged with: ebean
has body: I'm running to some problems with ebean (using play framework 2 version 2.2.1) I have two classes: my graph class: public class Graph extends Model { @Id @Column(name="id") private String id; @Column(name="type") private String type; @OneToMany(mappedBy="valGraph", cascade=CascadeType.ALL) private List&lt;Val&gt; valItems; and my value class (with Val.graphId foreign key Graph.id): public class Val extends Model @Id @Column(name="valId") private String valId; @Id @Column(name="graphId") private String graphId; @Column(name="Key") private String Key; @Column(name="Value") private String Value; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="graphId") private Graph valGraph; but when trying to save a new item i get this error: javax.persistence.PersistenceException: ERROR executing DML bindLog[] error[Column 'graphId' specified twice]
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/37863517
has answer: http://stackoverflow.com/a/24561688
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/24561688
has title: play framework 2 ebean @manytoone Column specified twice
tagged with: java
has comment: http://stackoverflow.com/comment/37863415
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37862920
linked to: http://stackoverflow.com/q/24377478
downvote count: 0
favorite count: 0
tagged with: one-to-many
has comment: http://stackoverflow.com/comment/37862936
has comment: http://stackoverflow.com/comment/37863223
type: Question
tagged with: many-to-one
has comment: http://stackoverflow.com/comment/37863276

php
tags question: http://stackoverflow.com/q/24451402
tags question: http://stackoverflow.com/q/24478997
tags question: http://stackoverflow.com/q/24542211
tags question: http://stackoverflow.com/q/24567588
tags question: http://stackoverflow.com/q/24502149
tags question: http://stackoverflow.com/q/24464888
tag name: php
tags question: http://stackoverflow.com/q/24557854
tags question: http://stackoverflow.com/q/24432134
tags question: http://stackoverflow.com/q/24585821
tags question: http://stackoverflow.com/q/24497392
tags question: http://stackoverflow.com/q/24525750
tags question: http://stackoverflow.com/q/24580576
tags question: http://stackoverflow.com/q/24460572
tags question: http://stackoverflow.com/q/24510975
tags question: http://stackoverflow.com/q/24442413
tags question: http://stackoverflow.com/q/24496114
tags question: http://stackoverflow.com/q/24547262
tags question: http://stackoverflow.com/q/24566278
tags question: http://stackoverflow.com/q/24492351
tags question: http://stackoverflow.com/q/24541112
tags question: http://stackoverflow.com/q/24525870
tags question: http://stackoverflow.com/q/24543361
tags question: http://stackoverflow.com/q/24429734
type: Tag

http://stackoverflow.com/a/24482832
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24482807
has body: Those two values can't be represented exactly as single-precision floats, and the approximations made when converting them from integers result in the two having the same value. Therefore, subtracting them yields 0.
answers question: http://stackoverflow.com/q/24482807
has comment: http://stackoverflow.com/comment/37896558
score: 5
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/37899863

http://stackoverflow.com/comment/37868207
has text: Use a [TreeTableView](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TreeTableView.html) for the data structure.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24467199
score: 0

http://stackoverflow.com/a/24565432
type: Answer
answers question: http://stackoverflow.com/q/24564011
score: 0
has body: In your more complicated example a.add(b).add(b).add(b).add(b).add(b).sub(c); you can eliminate most garbage by using a more powerful operation a.mulAdd(4, b, -1, c); I would be afraid of multiplication timing, but not much. You could also write specialized operations like a.addFourSubOne(b, c); which sounds rather idiotic as you can never implement all operations you can possibly use. OTOH you can easily implement all operations ypu really use. I'd probably recommend to use mutable objects. You can provide both mutating and copying operations for them, called something like add/addInPlace or plus/add. You could also implement both mutable and immutable versions (this gets boring soon, but you can manage it by not implementing anything you don't actually need).

http://stackoverflow.com/q/24570210
tagged with: sockets
tagged with: android
has body: From the android application, I am creating a socket connection using android services. The idea is that I am connecting to the server when the activity is started and I'am leaving socket connection open for me to reach in other parts of the application. Now what I'am trying to do is to is that I'am writing a command to the server using buffered writer. After the write I want to implement the check whether the response is already received or not. I'am trying to do this using while (inStream.available() == 0) loop. However this is not working. Any ideas how make the app wait for the response of the particular command until processing further code? Connecting to the socket: public class connectSocket implements Runnable { @Override public void run() { try { Log.v("DEV","SocketClass, connectSocket"); SocketAddress socketAddress = new InetSocketAddress(SERVERIP,SERVERPORT); command = "authorization"; try { socket = new Socket(); socket.setTcpNoDelay(true); socket.setSoTimeout(5000); socket.connect(socketAddress, 5000); if (socket.isConnected()) { Log.v("DEV","SocketClass successfully connected!"); out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); inStream = new DataInputStream(socket.getInputStream()); int bytesRead; int count = 1; while ((bytesRead = in.read()) &gt; 0 &amp;&amp; count != 3) { if (count == 1) { out.write(command + "\r\n"); out.flush(); } while (inStream.available() == 0) { Log.v("DEV", "sleep "+inStream.available()); android.os.SystemClock.sleep(100); } StringTokenizer filterToken = new StringTokenizer(in.readLine(), "^"); String temp = filterToken.nextToken(); Log.v("DEV", "SocketClass Tokenizer: "+temp); if (temp.equals("cmd_main")) { response = filterToken.nextToken(); Intent ret = new Intent(); ret.setAction(Testas.RECEIVE_AUTHORIZATION); ret.putExtra("response",response); sendBroadcast(ret); count = 2; } count++; } } } catch (Exception e) { Log.e("TCP…
has title: Making a socket connection wait for response after sending command
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/78181693
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/38058879
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/38059131
has answer: http://stackoverflow.com/a/24570829
accepted answer: http://stackoverflow.com/a/24570829
has comment: http://stackoverflow.com/comment/78157240

http://stackoverflow.com/a/24437134
type: Answer
answers question: http://stackoverflow.com/q/24436194
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37840586
upvote count: 1
has body: Your issue seems to be with: if (Surroundings[0][i] == 2) { myArray[locX][locY] = 1; return; } Perhaps this should be changed to: if (Surroundings[0][i] == 2) { // not sure why you need this if it's already 1 myArray[locX][locY] = 1; // go to next iteration of the "i" loop // and keep looking for next available path continue; } Your recursive method will automatically return when none of the surrounding cells satisfy the condition if (Surroundings[0][i] == 1). PS: It's conventional to name your variables using small letter as the first character. For example: surroundings, path, startX or myVar

http://stackoverflow.com/q/24531565
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
has title: Axis2 soap websevice - nullpointerexception
answer count: 0
tagged with: java
upvote count: 1
type: Question
tagged with: nullpointerexception
has body: I have one axis2 web service calling the other web service in java program. It works fine for first time, but if invoke the process for 2nd time, the axis2 web service will throw an exception as following: java.lang.NullPointerException org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167) org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135) org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130) org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:825) org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:271) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) Any idea?

http://stackoverflow.com/q/24481035
has title: JPanel does not refresh Graphics component on resize
tagged with: java
tagged with: jpanel
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24481214
has body: This program is supposed to draw a grid of Rectangles in a JPanel. I drew the grid onto the JPanel by overriding its paintComponent method so that every time the JPanel resizes, the size of the grid would change to fit the height of the JPanel. But when I change the size of the JFrame, the grid only resizes at certain intervals. Is there a better way to change the size of the grid? import java.awt.*; import java.awt.geom.Rectangle2D; import javax.swing.*; class TextFrame extends JPanel { int numOfCells = 99; int cellSize, xOffSet; Rectangle2D.Float[][] square = new Rectangle2D.Float[numOfCells][numOfCells]; public TextFrame() { setSize(400, 400); } public void paintComponent(Graphics comp) { Graphics2D comp2d = (Graphics2D)comp; cellSize = (int)getHeight()/numOfCells; if(getWidth()&lt;=cellSize*numOfCells) cellSize = getWidth()/numOfCells; xOffSet = (getWidth()-(cellSize*numOfCells))/2; Color black = new Color(0,0,0); Color grey = new Color(128,128,128); boolean col = true; for(int i=0; i&lt;square.length; i++) { for(int j=0; j&lt;square[i].length; j++) { if(col) comp2d.setPaint(black); else comp2d.setPaint(grey); col = !col; square[i][j] = new Rectangle2D.Float(xOffSet+j*cellSize, i*cellSize, cellSize, cellSize); comp2d.fill(square[i][j]); } } } public static void main(String[] args) { JFrame frame = new JFrame("Conway's Game Of Life"); TextFrame life = new TextFrame(); frame.add(life); frame.setSize(life.getHeight(), life.getWidth()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
tagged with: paintcomponent
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24481214
tagged with: swing
type: Question
tagged with: graphics

http://stackoverflow.com/comment/38019932
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24549547
has text: Post the error trace you are getting, it will help to solve the problem.
score: 0

http://stackoverflow.com/comment/38085817
comment on: http://stackoverflow.com/a/24561791
score: 0
type: Comment
type: AnswerComment
has text: To give an example. Imagine an object that has a velocity of 1m/s. Then we render that with a target FRAME_PERIOD of 0.1 seconds. Under the current code (with a variable frameRate) we might get the following results (time, position); (0,0) (0.1,0.1), (0.15,0.2), (0.28,0.3). You can see that all those data points are not only at a variable frame rate. The position is wrong. Where as by taking frame time into account you get (0,0), (0.15,0.15), (0.28,0.28). The frame rate is still wrong but the object is at least at the right place

http://stackoverflow.com/comment/37806472
has text: Classpath entries/resources are not necessarily files. You shouldn't be reading them as files.
comment on: http://stackoverflow.com/q/24434586
score: 0
type: Comment
type: QuestionComment

user-interface
tags question: http://stackoverflow.com/q/24479251
tags question: http://stackoverflow.com/q/24566111
tags question: http://stackoverflow.com/q/24432710
tags question: http://stackoverflow.com/q/24581548
tags question: http://stackoverflow.com/q/24441814
tags question: http://stackoverflow.com/q/24439536
tags question: http://stackoverflow.com/q/24445664
tags question: http://stackoverflow.com/q/24437155
tags question: http://stackoverflow.com/q/24472661
type: Tag
tags question: http://stackoverflow.com/q/24522498
tags question: http://stackoverflow.com/q/24464897
tags question: http://stackoverflow.com/q/24470903
tags question: http://stackoverflow.com/q/24472590
tags question: http://stackoverflow.com/q/24539475
tags question: http://stackoverflow.com/q/24558331
tags question: http://stackoverflow.com/q/24452893
tags question: http://stackoverflow.com/q/24571860
tags question: http://stackoverflow.com/q/24463144
tags question: http://stackoverflow.com/q/24437351
tags question: http://stackoverflow.com/q/24585777
tags question: http://stackoverflow.com/q/24496861
tags question: http://stackoverflow.com/q/24438030
tags question: http://stackoverflow.com/q/24442672
tags question: http://stackoverflow.com/q/24497295
tags question: http://stackoverflow.com/q/24559167
tags question: http://stackoverflow.com/q/24543377
tags question: http://stackoverflow.com/q/24462043
tags question: http://stackoverflow.com/q/24493236
tags question: http://stackoverflow.com/q/24577857
tags question: http://stackoverflow.com/q/24536503
tags question: http://stackoverflow.com/q/24515008
tags question: http://stackoverflow.com/q/24517426
tags question: http://stackoverflow.com/q/24536333
tags question: http://stackoverflow.com/q/24471832
tags question: http://stackoverflow.com/q/24537857
tag name: user-interface
tags question: http://stackoverflow.com/q/24435661
tags question: http://stackoverflow.com/q/24480237

http://stackoverflow.com/q/24525914
linked to: http://stackoverflow.com/q/2787548
favorite count: 0
has comment: http://stackoverflow.com/comment/37975562
has answer: http://stackoverflow.com/a/24526108
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37975702
score: 2
type: AnsweredQuestion
tagged with: java
has title: Get data from multiple tables using Content Provider
accepted answer: http://stackoverflow.com/a/24526108
type: Question
tagged with: android-contentprovider
has comment: http://stackoverflow.com/comment/37975604
has body: Hello everyone, I am using content provider and create a database with multiple tables. I already get , insert , update and delete the values of tables. Now I want to get data from multiple tables in a single query. I wounder how can I do it by content provider and cursor. Kindly help me on this. Thanks
downvote count: 0
answer count: 1

http://stackoverflow.com/q/24518179
downvote count: 0
tagged with: tomcat
linked to: http://stackoverflow.com/q/7145131
has comment: http://stackoverflow.com/comment/37962910
has title: How to create a client that triggers java.net.SocketTimeoutException on the server
tagged with: socket-timeout-exception
favorite count: 0
has comment: http://stackoverflow.com/comment/37965707
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37965290
has body: I have a Servlet in Tomcat that reads binary file upload in the doPost method. The server code simplifies to: protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("Received post request"); int read; byte[] buffer = new byte[10*1024]; try { InputStream inputStream = req.getInputStream(); while ((read = inputStream.read(buffer, 0, buffer.length)) != -1) { /* do stuff */ } resp.setStatus(200); } catch (Exception e) { resp.setStatus(500); } } There are client applications that use this to servlet to upload a file. Very frequently, I'm getting a java.net.SocketTimeoutException on inputStream.read() I would like to write a test client app to trigger this on the server side exception. I tried: public static void triggerTimeOut() { HttpURLConnection urlConn = null; try { URL me = new URL("http://localhost:8080/uploadData"); urlConn = (HttpURLConnection)me.openConnection(); urlConn.setDoOutput(true); urlConn.setDoInput(true); OutputStreamWriter sw = new OutputStreamWriter(urlConn.getOutputStream()); String[] data = new String[] {"line 1", "line 2"}; System.out.println(urlConn.getReadTimeout()); while(true) { sw.write(data[0]); sw.flush(); System.out.println(data[0]); Thread.sleep(120000); // break; } } catch (Exception e) { e.printStackTrace(); } finally { try { System.out.println(urlConn.getResponseCode()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }; } } But the timeout is never triggered, and in the server logs, I don't even get the "Received post request", even after i kill the client app. The debug line does get printed if I comment sleep, and uncomment break. What kind of adjustments (on either tomcat or client) need to be done so I can get the server read to throw SocketTimeoutException? The HTTP Connector is set to connectionTimeout="5000" in server.xml. It's deliberately set shorter than the default 20000. I'm trying to recreate the scenario for testin…
tagged with: servlets

http://stackoverflow.com/comment/38012305
has text: Oh my god, i finally understand. I had to import the java.io.* files, add the variable, which i now know can just be ignored and the rest of the file can be executed, and i also had issues because no one told me that i had to do /cd (folder path of class) to do "java -cp . Startbat". Thank you soo much, I could hug you through the monitor if i could! (hug hug)
comment on: http://stackoverflow.com/a/24544488
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/24509189
tagged with: jdatechooser
has answer: http://stackoverflow.com/a/24509341
possible better answer: http://stackoverflow.com/a/24509341
has title: JDateChooser focusListener
favorite count: 0
linked to: http://stackoverflow.com/q/17874717
upvote count: 2
has answer: http://stackoverflow.com/a/24512043
score: 0
downvote count: 2
tagged with: focuslistener
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: I'm trying to add a focusListener to JDateChooser, so that when the user chooses the dateOfBirth it displays age on the textfield when the focus is lost. But it is not working This is the way i've tried, import java.awt.BorderLayout; public class agecalc extends JFrame { private JTextField age; private JDateChooser dOB; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { agecalc frame = new agecalc(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public agecalc() { JPanel panel = new JPanel(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 290, GroupLayout.PREFERRED_SIZE) .addContainerGap(134, Short.MAX_VALUE)) ); groupLayout.setVerticalGroup( groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup() .addGap(20) .addComponent(panel, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE) .addContainerGap(47, Short.MAX_VALUE)) ); panel.setLayout(null); dOB = new JDateChooser(); dOB.setBounds(97, 52, 95, 20); panel.add(dOB); age = new JTextField(); age.setBounds(97, 83, 86, 20); panel.add(age); age.setColumns(10); getContentPane().setLayout(groupLayout); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); AGECalc ageCalc=new AGECalc(); dOB.addFocusListener(ageCalc); } private class AGECalc implements FocusListener{ @Override public void focusGained(FocusEvent e) { } @Override public void focusLost(FocusEvent e) { // TODO Auto-generated method stub Calendar fromDate; Calendar toDate; Date dateOfBirth= dOB.getDate(); Date now = new Date(); fromDate=Calendar.getInstance(); toDate=Calendar.getInstance(); fromDate.setTime(dateOfBirth); toDate.setTime(…
type: Question
accepted answer: http://stackoverflow.com/a/24512043
linked to: http://stackoverflow.com/q/7229226
answer count: 2
linked to: http://stackoverflow.com/q/5621338
linked to: http://stackoverflow.com/q/21946016

http://stackoverflow.com/q/24449523
has comment: http://stackoverflow.com/comment/42021254
answer count: 1
tagged with: android-support-library
favorite count: 0
linked to: http://stackoverflow.com/q/24809580
linked to: http://stackoverflow.com/q/21896990
has body: I am trying to implement a popup menu in my android application which is to be supported from android 2.2 . So i used the android-support-v7-appcompat support library to do it. But unfortunately i am getting java.lang.NoClassDefFoundError exception. Can't able to sort it out , so can anyone help me out? Thanks in advance! The logcat shows, 06-27 15:40:30.160: E/AndroidRuntime(26985): FATAL EXCEPTION: main 06-27 15:40:30.160: E/AndroidRuntime(26985): java.lang.NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.support.v7.widget.PopupMenu.&lt;init&gt;(PopupMenu.java:66) 06-27 15:40:30.160: E/AndroidRuntime(26985): at com.example.basic.MainActivity$4.onClick(MainActivity.java:401) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.view.View.performClick(View.java:4421) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.view.View$PerformClick.run(View.java:17903) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Handler.handleCallback(Handler.java:730) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Handler.dispatchMessage(Handler.java:92) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.os.Looper.loop(Looper.java:213) 06-27 15:40:30.160: E/AndroidRuntime(26985): at android.app.ActivityThread.main(ActivityThread.java:5225) 06-27 15:40:30.160: E/AndroidRuntime(26985): at java.lang.reflect.Method.invokeNative(Native Method) 06-27 15:40:30.160: E/AndroidRuntime(26985): at java.lang.reflect.Method.invoke(Method.java:525) 06-27 15:40:30.160: E/AndroidRuntime(26985): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) 06-27 15:40:30.160: E/AndroidRuntime(26985): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 06-27 15:40:30.160: E/AndroidRuntime(26985): at dalvik.system.NativeStart.main(Native Method)
upvote count: 5
type: UnansweredQuestion
tagged with: android
has title: NoClassDefFoundError when running PopupMenu using android-support-v7-appcompat library in android
downvote count: 0
has comment: http://stackoverflow.com/comment/41884481
tagged with: java
has answer: http://stackoverflow.com/a/27934102
has comment: http://stackoverflow.com/comment/37834361
type: Question
tagged with: android-layout
score: 5

http://stackoverflow.com/comment/37885740
type: QuestionComment
comment on: http://stackoverflow.com/q/24477296
has text: Something is null in the line 37 of Box.java. (inside tick method)
score: 0
type: Comment

http://stackoverflow.com/q/24487907
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37906103
has comment: http://stackoverflow.com/comment/37906062
tagged with: exception
has comment: http://stackoverflow.com/comment/37905871
favorite count: 0
score: 2
answer count: 0
has comment: http://stackoverflow.com/comment/37905896
upvote count: 2
type: UnansweredQuestion
has title: How to create checked and unchecked exceptions that extend a base class?
has comment: http://stackoverflow.com/comment/37906036
tagged with: java
has body: I am writing a java library. I want to use my own exceptions. I want to support both checked and unchecked exceptions, but I want both of them to derive from the same custom base class. For example: MyCheckedException MyUncheckedException I want both of them to extend MyBaseException which provides additional functionality. The problem is that the only way I know to make unchecked exception is extending the RuntimeException class. So here comes the task: how to make unchecked exception without extending RuntimeException, because my class must extend MyBaseException and therefore can not extend another class?

http://stackoverflow.com/comment/37995973
has text: Without seeing the page, any answer you get is going to be pure guesswork.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24527977
type: Comment

http://stackoverflow.com/comment/37844825
type: QuestionComment
has text: Perhaps processing the whole line and only then printing it would be faster than decoding and printing each character separately.
comment on: http://stackoverflow.com/q/24455255
score: 0
type: Comment

http://stackoverflow.com/comment/38080664
score: 0
has text: @redFIVE: it has little to do with Threads. A KeyListener needs to listen to a Swing or AWT GUI component that has focus in a GUI that has focus, something that isn't true for the original poster's question. In other words, a KeyListener simply cannot be used here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24581886

http://stackoverflow.com/comment/38018109
has text: your java string would be `"\\+CUSD:\\s*(\\d+)(?:,\\s*\\\"([^,]*)\\\"(?:,(\\d+))?)?"`
comment on: http://stackoverflow.com/a/24547664
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/24580766
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24580686
accepted answer of: http://stackoverflow.com/q/24580686
has comment: http://stackoverflow.com/comment/38078497
type: Answer
upvote count: 4
has body: but why, to run "bowBack()" it should first wait the end of the "bow()", if they don't interfere with each other When bowBack() is called - the lock that the running thread tries to acquire is the lock on the Object whose method it is trying to call. Here - Alphonse is an object and Gaston is second object. Alphonse.bow()--->trying to call-->Gaston.bowBack() In above , the first call takes lock on Alphonse , and while that lock is still held , tries to aquire lock on Gaston. So , in Thread 1 : Lock ( Alp) AND try to Lock( Gaston) WITHOUT RELEASING Lock(Apl) Gaston.bow()--->trying to call-->Alphonse.bowBack() In here , the first bow() aquires lock on Gaston object , and then tries to acquire lock on Alphonse. So ,in Thread 2 : Lock ( Gaston) and try Lock(Apl) WITHOUT RELEASING Lock(Gaston) If the first step in thread 1 and thread 2 are both complete , then you can work out that the second step can never complete - hence the Deadlock
type: AcceptedAnswer

http://stackoverflow.com/q/24527534
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24533358
has title: How to test org.hibernate.Session?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: Hi I have tested this code with junit 4: public class UserDaoTest { /** * Runs before all test methods */ @BeforeClass public static void createDB() { sessionFactory = HibernateUtil.getSessionFactory(); userDao = new UserDaoImpl(); languageDao = new LanguageDaoImpl(); requestDao = new RequestDaoImpl(); feedbackDao = new FeedbackDaoImpl(); hostelDao = new HostelDaoImpl(); imageDao = new ImageDaoImpl(); } /** * Runs after all test methods */ @AfterClass public static void closeSessionFactory() { HibernateUtil.shutdown(); } /** * Runs before each test method * * @return */ @Before public void beginTransaction() { session = sessionFactory.getCurrentSession(); transaction = session.beginTransaction(); } /** * Runs after each test method */ @After public void rollbackTransaction() { if (transaction != null &amp;&amp; transaction.isActive()) { System.out.println("Rolling back trasnaction after @Test method"); // rollback transaction so that tests don't modify database transaction.rollback(); } } @Test public void testSaveUser() { User user1 = new User("Ostap", "Stashyshyn", Gender.MALE); // save user. It delegates to `session.save(user1)` method. userDao.create(user1); Integer userId = user1.getUserId(); Assert.assertNotNull(userId); // causes persistent entities to be saved into persistent context session.flush(); // read languages from db List&lt;User&gt; users = userDao.readAll(); Assert.assertThat(users.size(), CoreMatchers.is(1)); // next method annotated with @After is running. // It rollbacks transaction causing hibernate not to store data into database. Thus database state is the same as when entering this test method } It tests successfully, but when I set breakpoint after session.flush() and go to db from command line I see that there is no row for user. Calling userDao.readAll(); causes hibernate to issue select statement and return users? I see insert and select statements on console but nothing in db. But when I call transaction.commit() instead of session.flu…
possible better answer: http://stackoverflow.com/a/24533611
type: Question
has answer: http://stackoverflow.com/a/24533611
has answer: http://stackoverflow.com/a/24533358
tagged with: junit4
tagged with: session

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/24487641
tags question: http://stackoverflow.com/q/24480450
type: Tag

http://stackoverflow.com/a/24469840
upvote count: 2
answers question: http://stackoverflow.com/q/24469669
type: Answer
score: 2
downvote count: 0
has body: I am pretty sure it never "hits the time equal to a value within the HashMap" as you say. Provided your standard output is working (console for System.out to write to), your if condition is never evaluated as true. Method containsValue definitely has enough time to be evaluated. Something like interrupting a method in the middle of it's evaluation is not possible (at least in your case), unless you interrupt the whole thread. Possible solutions to look for: a) In debug mode, check what kind of string values are in your hashmap and how your currentTime string looks like. There may be a formatting issue. From your code, there is no way to tell what values callLog contains. b) Do not compare time as strings. I understand you need to achieve resolution in seconds (millis or nanos could cause problems with "hitting the equals time"), but doing so by converting Date into a string is resource-heavy and slow way of doing this. What you can actually do is to create your own class, e.g. ScheduleTime with few primitive attributes (hour, minute, second ) and override hashCode() and equals() methods. There are tons of tutorials on how to do this properly, it is very easy. c) run() method is not called as often as it should be. If you want to have time resolution in seconds, make sure this method is fired every second. Also consider using Thread.sleep() instead of creating and destroying the thread over and over again. But this way, you have to reference your hashmap as an attribute of the thread object. But HashMap is not ThreadSafe, for thread safety there is ConcurrentHashMap. But this is just a reccomendation.

http://stackoverflow.com/comment/37905898
comment on: http://stackoverflow.com/q/24478326
score: 0
type: Comment
has text: First put syso in your method to confirm if you are reaching to correct url. See console to check if controller for your request is resolved or not.
type: QuestionComment

http://stackoverflow.com/q/24501813
has answer: http://stackoverflow.com/a/24501980
has comment: http://stackoverflow.com/comment/37931709
has comment: http://stackoverflow.com/comment/37931685
answer count: 1
linked to: http://stackoverflow.com/q/6295084
accepted answer: http://stackoverflow.com/a/24501980
favorite count: 0
score: 0
tagged with: http://stackoverflow.com/tag/png
type: AnsweredQuestion
tagged with: fonts
has title: Java use PNG Image as Font (Java.awt.graphics)
upvote count: 1
downvote count: 1
type: Question
has body: I am currently making a game in Eclipse, and have a specific font I wish to use, however, it's a PNG. How can I do this in Java 8? (I am an Intermediate in Java) Here's the Image: I have no code because I have no Idea how to approach this. Thanks in advance.
tagged with: java
tagged with: image

http://stackoverflow.com/comment/38062784
comment on: http://stackoverflow.com/q/24564578
score: 0
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).

nexus
type: Tag
tags question: http://stackoverflow.com/q/24505035
tag name: nexus

http://stackoverflow.com/comment/37896898
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24482900
type: Comment
has text: @goutam it wont work because into the servlet Case u need to provide urlpattern as that name that which HttpServlet Action means that servlet will be called that time. u can not give other as url pattern.

http://stackoverflow.com/comment/38088599
has text: That's because you have `keyIn.nextLine()` twice each time, `keyIn.nextInt()` twice each time, etc.
comment on: http://stackoverflow.com/q/24586544
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/124722571
has text: I'm trying to achieve what you did, but your code seems faulty. For instance you don't have a return value for `AppDescriptorconfigure` yet you return something in the method body. Also it shouldn't start with a capital A. Tried searching for this method in the JerseyTest source code and also couldn't find anything.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/48922350
type: Comment

http://stackoverflow.com/q/24452107
upvote count: 1
accepted answer: http://stackoverflow.com/a/24452273
possible better answer: http://stackoverflow.com/a/24452402
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24452402
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37838705
tagged with: date
type: Question
tagged with: jodatime
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37838602
has answer: http://stackoverflow.com/a/24452450
has answer: http://stackoverflow.com/a/24452273
has body: Following code using Joda-Time library Long timestamp = DateTime.parse(dateInString,DateTimeFormat.shortTime()).getMillis(); generates: java.lang.IllegalArgumentException: Invalid format: "12.05.2014 11:42:35.808" is malformed at ".05.2014 11:42:35.808" I tryed all DateTimeFormat.* but each format produces error. How to fix it?
answer count: 3
has title: Joda-Time, How to pick up format for string parsing?
tagged with: parsing
tagged with: time

http://stackoverflow.com/comment/61277031
comment on: http://stackoverflow.com/a/24494149
has text: I can't find a [Duration](http://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) API to do this. So I follow this answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24518024
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24518145
has comment: http://stackoverflow.com/comment/37961032
has comment: http://stackoverflow.com/comment/37961329
upvote count: 1
has title: Passing generic type using string (text) (Reflection ?)
type: Question
has comment: http://stackoverflow.com/comment/37961174
score: 1
tagged with: java
answer count: 1
downvote count: 0
tagged with: generics
has comment: http://stackoverflow.com/comment/37961080
favorite count: 0
has body: I store all my configurations in an xml file, and when I load them, I want each config rule to be stored in an Configuration object. public class Configuration<T> { private String name; private T value; public Configuration(String configName, T value) { this.name = configName; this.value = value; } public String getName() { return this.name; } public T getValue() { return this.value; } } In the XML I have a node that looks like it for each config: Integer . This node holds the generic type that the Configuration's T will be, it will be used for the value. When I load the node, I get a string with value "Integer". It can be anything, Object, MyClazz, but for example I wrote "Integer". Is it possible to use a String value to initialize a class's generic type? i.e in this case, Configuration object would be Configuration<Integer>
has comment: http://stackoverflow.com/comment/37961137

http://stackoverflow.com/a/24434833
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24434578
has comment: http://stackoverflow.com/comment/37807237
score: 1
has body: Subtotal is set to 0 at the begining. If you select option 2, Subtotal is still 0 so Subtotal*0.10 =0 And if you write Apayment = (short) Subtotal * (short) .10; payment = Apayment + Subtotal; it means payment = Subtotal * 0.10 + Subtotal * 0.10 So it will still be 0.
has comment: http://stackoverflow.com/comment/37807080
downvote count: 0
has comment: http://stackoverflow.com/comment/37807024

http://stackoverflow.com/a/24580789
type: Answer
answers question: http://stackoverflow.com/q/24580720
downvote count: 0
score: 1
upvote count: 1
has body: They are completely different. Strings are immutable and comparable, therefore can be safely used as elements of a set for example. StringBuilder is mutable and not comparable, but it can be used to manipulate its contents. You must never use mutable objects in sets or as keys of maps, and should avoid using them in many other situations. StringBuffer is like StringBuilder, but it's also thread-safe. Since string manipulation is rarely spread across multiple threads anyway, StringBuffer is indeed less useful in practice than StringBuilder and is mainly there for historical reasons.

http://stackoverflow.com/a/24459196
downvote count: 0
has body: Change public void calcAvgSpeed(double distance, long time) { to public void calcAvgSpeed(double distance, double time) { Since long is an integer, if you divide a long by 3600000, you'll get 0 (because it's rounded to the integer part). And here you get a Division By Zero: avgSpeed = (double) (distance / time); Which is infinite
answers question: http://stackoverflow.com/q/24459136
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/37971617
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24523764
has text: @dibya - He will still get that error .

auto-increment
type: Tag
tag name: auto-increment
tags question: http://stackoverflow.com/q/24504101
tags question: http://stackoverflow.com/q/24567633

http://stackoverflow.com/q/24560078
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/38039889
linked to: http://stackoverflow.com/q/451647
has comment: http://stackoverflow.com/comment/38040003
has comment: http://stackoverflow.com/comment/38039982
has body: I don't know why the following program is generating this error-> clone has protected access in Object. Can't the derived class access the protected methods of the Object class? If I skip this statement cloned.id=(String)id.clone(); the program compiles successfully! class Example implements Cloneable{ String id; void display(){ System.out.println("ID="+id); } public Example clone() throws CloneNotSupportedException{ Example cloned; cloned=(Example)super.clone(); cloned.id=(String)id.clone(); //troublemaker return cloned; } } class CloneInterface{ public static void main(String args[]){ try { Example e1=new Example(); e1.id="a"; Example e2=e1.clone(); e2.id="b"; e1.display(); e2.display(); } catch(CloneNotSupportedException e) { e.printStackTrace(); } } }
duplicate of: http://stackoverflow.com/q/451647
tagged with: java
has title: Clone has protected access in Object
upvote count: 1
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38039862
downvote count: 0
score: 1

http://stackoverflow.com/a/24444844
upvote count: 1
has body: For loop never executed because 1&lt;1 is always false, therefore it will return false you can determine prime number as simple as this: public static boolean isPrime(int p){ for(int y = 2 ; y &lt; p ; y++){ if(p % y == 0){ return false; } } return true; }
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24444719

http://stackoverflow.com/q/24530719
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-tld
tagged with: java
has answer: http://stackoverflow.com/a/24531340
type: Question
has title: Get value of a property inside jstl tag
has body: I'm developing a simple tag library in order to centralize the creation of form components. In my custom tag I need to get the value of the backing object mapped field. Here is how I pass the field name value to my library: &lt;jsp:directive.attribute name="field" type="java.lang.String" required="true" rtexprvalue="true" description="The field exposed from the form backing object" /&gt; Inside my tag library, using &lt;form:hidden path="${field}.id" /&gt; from spring tag library works, but how can I get same value not using that library? I do not want to have an input type hidden mapped in my form, but only retrieve the value of that field name. Thanks for any hints.
score: 0
tagged with: jstl
answer count: 1
accepted answer: http://stackoverflow.com/a/24531340

http://stackoverflow.com/comment/38014502
score: 0
comment on: http://stackoverflow.com/q/24544361
type: Comment
type: QuestionComment
has text: I also found that code on this webside: http://stackoverflow.com/questions/10284708/android-make-animated-video-from-list-of-images When I try to use jcodec-0.1.0.jar, the functions: NIOUtils.writableFileChannel(out); does not appear. I use jcodec-0.1.3.jar everything seem to be ok but when I run the code, it cause an error: "Source not found" when reach the line of code: muxer = new MP4Muxer(ch, Brand.MP4);

http://stackoverflow.com/comment/37882277
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24475281
has text: Ahhh lol I see what happened now! Just had a look at the demo it sorted the problem :D. I spent about 2 hours trying to get that to work :)). Was even considering turning my laptop off and on to see if it would fix it lol. Cheers Scis :D
type: AnswerComment

http://stackoverflow.com/comment/37909627
score: 0
comment on: http://stackoverflow.com/q/24485147
type: QuestionComment
type: Comment
has text: As mention use `setCachable(true)` on the query object.

http://stackoverflow.com/comment/38083804
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24583742
has text: then I can simply remove the if condition in the receiving while loop, right? And some says (in other answers) flush is not needed in both reading and sending. so I should only close?
type: AnswerComment

http://stackoverflow.com/a/24540083
type: Answer
has comment: http://stackoverflow.com/comment/38005416
upvote count: 3
answers question: http://stackoverflow.com/q/24539885
accepted answer of: http://stackoverflow.com/q/24539885
score: 3
has comment: http://stackoverflow.com/comment/38003648
has comment: http://stackoverflow.com/comment/38005142
type: AcceptedAnswer
has body: There is no library needed, you just have to use maths. static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); static final long EPOCH = new Date(2015 - 1900, Calendar.JANUARY, 1).getTime(); // 2015/1/1 in GMT public static int secondSinceEpoch() { return (int) ((System.currentTimeMillis() - EPOCH) / 1000); } public static String epochToString(int secsSince2015) { return SDF.format(new Date(secsSince2015 * 1000 + EPOCH)); } public static void main(String... ignored) { System.out.println(new Date(EPOCH)); System.out.println("Epoch is " + epochToString(0)); System.out.println("Today is " + secondSinceEpoch() + " secs"); System.out.println("Today is " + secondSinceEpoch() / 86400 + " days"); } prints Thu Jan 01 00:00:00 GMT 2015 Epoch is 2015/01/01 00:00:00 Today is -15732850 secs Today is -182 days
downvote count: 0
has comment: http://stackoverflow.com/comment/38003763

http://stackoverflow.com/q/24431609
tagged with: quicksort
has body: I have written code of Quick Sort but it is showing Exception Array Index Out of bound.This works properly when written in C but in Java it is not working.Please tell what is the problem with it.Any Suggestion is appreciated.It is two way partition standard CLRS algorithm. package Sorting; public class QuickSort { public static void main(String arg[]) { int a[] = { 9, 8, 7, 6, 5, 4, 3, 2, 1 }; Sort(a, 0, a.length - 1); for (int i = 0; i &lt; 9; i++) { System.out.print(" " + a[i]); } } private static void Sort(int[] a, int i, int j) { // TODO Auto-generated method stub if (i &lt; j) { int k = Partition(a, i, j); Sort(a, i, k - 1); Sort(a, k + 1, j); } } private static int Partition(int[] a, int i, int j) { // TODO Auto-generated method stub int temp; int x = a[j]; int l = i - 1; for (int n = i; n &lt; j; n++) { if (a[n] &gt;= x) { l++; temp = a[l]; a[l] = a[n]; a[n] = temp; } } temp = a[x]; a[x] = a[l + 1]; a[l + 1] = temp; return l + 1; } } Output: 9 3 5 7 4 1 6 2 8
has comment: http://stackoverflow.com/comment/37804497
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24446841
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24431897
downvote count: 1
has title: Quick Sort Algorithm showing Wrong Output
tagged with: sorting
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37801117
tagged with: data-structures
has comment: http://stackoverflow.com/comment/37807008
favorite count: 0
has comment: http://stackoverflow.com/comment/37800950
has comment: http://stackoverflow.com/comment/37807066
type: Question
has answer: http://stackoverflow.com/a/24431830
has comment: http://stackoverflow.com/comment/37801119

http://stackoverflow.com/comment/38031494
type: QuestionComment
has text: Since gradle loads android.jar and InetAddress is presente both in android.jar and rt.jar, which one will the jvm load first?
comment on: http://stackoverflow.com/q/24553890
score: 0
type: Comment

http://stackoverflow.com/q/24495916
tagged with: corruption
tagged with: java
tagged with: inputstream
type: Question
tagged with: usb
tagged with: ascii
score: 0
has answer: http://stackoverflow.com/a/24496661
answer count: 1
accepted answer: http://stackoverflow.com/a/24496661
has title: Java reading from continuous USB stream showing corruption
has body: I've got an application which records data from a USB device to a local file, however the data being received is corrupted. The data is encoded as ASCII and has 4 columns of information separated by spaces. There are 2 sensors attached to the device, with the first column indicating the sensor. The data is sent at a frequency of 60Hz, with both sensor data being transmitted at the same time. The ideal output should be in the form 01 value1 value2 value3 02 value1 value2 value3 01 value1 value2 value3 etc... However the first 2 lines are correct, but subsequent alternate lines have a lot of blank spaces (in Windows, in gEdit in Ubuntu it's shown as \00s and Vim shows it as sequences of ^@). Here's how it looks in gEdit (note there are sensor values after all the \00s) 01 0.109 5.933 1.803 02 5.550 6.027 1.714 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\0001 0.109 5.933 1.803 02 5.553 6.027 1.713 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\0001 0.108 5.933 1.803 I'm testing recording for 5 seconds and by the end the written lines have less data and more \00s. The data is sent as ASCII streams with carriage return followed by line feed separating sensor values. The reading is is done in the run() method of a thread class. The constructor instantiates a PrintWriter to the destinati…
type: AnsweredQuestion

http://stackoverflow.com/comment/38087039
type: AnswerComment
score: 0
type: Comment
has text: If would be great if you can share both the jsp files location along with code.
comment on: http://stackoverflow.com/a/24585547

dom
tags question: http://stackoverflow.com/q/24490037
type: Tag
tags question: http://stackoverflow.com/q/24437251
tags question: http://stackoverflow.com/q/24512655
tags question: http://stackoverflow.com/q/24528125
tags question: http://stackoverflow.com/q/24450103
tags question: http://stackoverflow.com/q/24515257
tag name: dom

http://stackoverflow.com/a/24480431
type: Answer
score: 1
upvote count: 1
has body: One thread is locking the ReentrantLock and not releasing it. What "reentrant" means is you can call lock many times, but you must call unlock() the same number of times. You lock twice, and unlock once so you are not actually unlocking the lock, thus no other process gets a chance.
answers question: http://stackoverflow.com/q/24480382
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37892405
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24480382

http://stackoverflow.com/comment/38042656
score: 0
type: AnswerComment
has text: Changing the ObjectOutputStream to a DataOutputStream and then using writeBytes(""); works like a charm. Thanks
comment on: http://stackoverflow.com/a/24561674
type: Comment

http://stackoverflow.com/q/24572767
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24572848
tagged with: java
tagged with: eclipse
has title: How to use Mongo Database URI in eclipse
has body: I am new to MongoDb, i am using it in eclipse Birt Report but i am not getting what is Mongo Database URI in this.??? How to use it.??
score: 0
tagged with: mongodb
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24572848
type: AnsweredQuestion

http://stackoverflow.com/a/24522414
has body: You can always simply try such things. For instance using jdoodle As you can see it is perfectly possible. It is advisable to use a long to store the result, but not necessary. In case of overflow in the latter case, Java will simply use the 32 least significant bits, thus: 6666555555555544444444443333333333222222222211111111110000000000 (index) 3210987654321098765432109876543210987654321098765432109876543210 ---------------------------------------------------------------- 0101010101010010000011110010101111101010101111101011101011011101 (value) will be stored as: 33222222222211111111110000000000 (index) 10987654321098765432109876543210 -------------------------------- 11101010101111101011101011011101 (value)
answers question: http://stackoverflow.com/q/24522355
score: 0
type: Answer

http://stackoverflow.com/a/24529429
answers question: http://stackoverflow.com/q/24529378
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37983785
accepted answer of: http://stackoverflow.com/q/24529378
type: Answer
has body: Append to the file: FileWriter fw = new FileWriter("fortune.txt", true);

http://stackoverflow.com/comment/37802920
has text: @Jayaprasad Of course my FXMLMain.fxml is in the same directory where I have the java class. I also tried Parent root = (Parent) loader.load(getClass().getResource("FXMLMain.fxml").toExternalForm()); but it shows me an error "no suitable method found for load(String)"
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24429809

http://stackoverflow.com/q/24477995
score: 0
has answer: http://stackoverflow.com/a/24478025
has title: image paths not right when deploying .war on Tomcat
tagged with: deployment
has body: After developing a Java web project, I used maven to create a war package, which I later deployed on Tomcat. My deployment was done by uploading the war file to the webapps folder in tomcat. When I restart the Tomcat server, however, I found the image path and css/js file paths are not right. I am a newbie to Tomcat thing, and I've tried to read some online help/documents but found not much helpful answer. I named my war file to admin.war, and a new folder named 'admin' was created after Tomcat restarted. So I access my web app using localhost:8080/admin I use the Ninja framework for developing my web app, and the following is the content of my web.xml file: <?xml version="1.0" encoding="UTF-8"?> ninja ninja.servlet.NinjaServletListener guiceFilter com.google.inject.servlet.GuiceFilter guiceFilter /* In my templates (Freemarker), I have the following urls for serving static files, as I understand, it's absolute path, which might be the reason for my problem with Tomcat(?)
type: UnansweredQuestion
tagged with: war
tagged with: java
has answer: http://stackoverflow.com/a/24579629
type: Question
answer count: 2
tagged with: tomcat

http://stackoverflow.com/comment/37947339
type: QuestionComment
comment on: http://stackoverflow.com/q/24510712
score: 0
has text: I would love if the compiler would flag `9/5` at least as a warning, was there is hardly a reason where you want this to become 1.
type: Comment

http://stackoverflow.com/q/24565278
has title: java.util.Comparator.naturalOrder takes a <T extends Comparable<? super T>> and returns a Comparator<T> - why?
tagged with: java-8
has body: (If this is a duplicate please point me to the right answer! I searched and read several (>5) related questions but none seemed on the mark. Also looked at the Generics FAQ and other sources...) It is apparently proper practice that when a collection class takes a comparator it should have the type Comparator&lt;? super T&gt; for your parameterized type T. And you can see that lots of places, e.g., TreeMap. Okay. My problem is working with Comparator.naturalOrder() which is parameterized on T extends Comparable&lt;? super T&gt; but returns a Comparator&lt;T&gt;. I'm trying to have a field in my collection class that holds either the user-specified comparator or the Comparator.naturalOrder comparator. I can't get it to work. My questions, all related, are: How is Comparator.naturalOrder properly used? And can I do what I want which is have a field where I store either a user-supplied comparator or the naturalOrder comparator? Given that most collection classes (in the framework) are parameterized on T not T implements Comparable&lt;? super T&gt;, so that's the design pattern chosen, how is naturalOrder useful since it requires the latter bounded wildcard, not the unconstrained type parameter? Thanks! Here follows the actual examples with compiler errors: So: If I have code like this in some class where T has no bounds (as in all existing collection classes): class Foo&lt;T&gt; { private Comparator&lt;? super T&gt; comparator; public void someMethod(Comparator&lt;? super T&gt; comparator) { this.comparator = comparator; // no compile error this.comparator = Comparator.naturalOrder(); // incompatible types } } with this error: Error:(331, 50) java: incompatible types: inferred type does not conform to upper bound(s) inferred: T upper bound(s): java.lang.Comparable&lt;? super T&gt; So if I decide to forgo the advantages of ? super T then I have: class Foo&lt;T&gt; { private Comparator&lt;T&gt; comparator; public void someMethod(ComparatorT&gt; comparator) { this.compara…
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24565436
accepted answer: http://stackoverflow.com/a/24565436
has answer: http://stackoverflow.com/a/24565447
score: 9
type: Question
tagged with: bounded-wildcard
upvote count: 9
tagged with: comparator
answer count: 2
downvote count: 0
tagged with: generics
possible better answer: http://stackoverflow.com/a/24565447
favorite count: 0

http://stackoverflow.com/comment/38011945
score: 0
has text: As an aside, please don't build an SQL statement like this. Use [`SQLiteDatabase.update()`](http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#update%28java.lang.String,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[]%29) instead.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24545017

http://stackoverflow.com/a/24566814
has comment: http://stackoverflow.com/comment/38068780
upvote count: 8
has body: The answer really depends on how hard you want to try to convert the code. Since Java and Scala are both turing complete, any program in one can trivially be converted to the other, but this isn't really interesting or useful. What you really want is to convert the results to readable, idiomatic code. From this perspective, even Java code can't automatically be converted to Java because compilation loses information (though relatively little compared to C) and machines aren't as good as humans at writing human readable code anyway. If you got a Java and Scala expert, they could probably rewrite your Scala codebase in Java and end up with reasonably idiomatic Java code. But it wouldn't be as readable as Scala due to the simple fact that Scala is a language designed to improve on Java. Scala tries to remove the warts from Java and provide powerful high level programming features, removing the need for all the classic Java boilerplate. So the Java equivalent codebase will not be as readable. From this perspective, the answer is "any feature in Scala that is not in Java".
answers question: http://stackoverflow.com/q/24566566
type: Answer
score: 8
downvote count: 0

open-closed-principle
tag name: open-closed-principle
type: Tag
tags question: http://stackoverflow.com/q/24547012

http://stackoverflow.com/comment/37871592
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24469752
has text: So... what's the question?

http://stackoverflow.com/comment/38043992
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24561985
has text: I figured it was as the game never ends up completing the function that it's running through. That or it takes longer than the 30 minutes I was willing to wait.
score: 0

http://stackoverflow.com/a/24444091
answers question: http://stackoverflow.com/q/24440547
has body: Is your timed EJB a singleton bean? By default singletons use container managed concurrency with write locks that guarantee exclusive access for all methods. The openejb.xml configures the AccessTimeout for a singleton EJB. After that timeout the exception you have seen will be thrown. Please see here as well: http://tomee.apache.org/singleton-beans.html Solutions might be: Use a stateless session bean as the timer bean Define a read lock on the timer method Don't use a repeating timer but schedule the next execution of your timer at the end of the current execution.
type: Answer
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/comment/38141789
type: Comment
type: QuestionComment
has text: I did it myself, so it is not a proper certificate. I thought that it would ask to the user to trust or not on my certificate, and then, let my app run depending on the choice.
score: 0
comment on: http://stackoverflow.com/q/24573008

http://stackoverflow.com/comment/37853568
comment on: http://stackoverflow.com/q/24460103
score: 0
type: QuestionComment
type: Comment
has text: [Date and time patterns](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)

http://stackoverflow.com/comment/37878372
comment on: http://stackoverflow.com/a/24473283
type: Comment
has text: "Interfaces should only be used when you expect multiple classes to implement them" Just to clarify: in many Java libraries there are interfaces that only have one implementation. However, these will be cases in which it would be reasonable to have a different implementation. "You don't" is probably too strong.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/38076523
type: QuestionComment
comment on: http://stackoverflow.com/q/24579288
has text: @Broonix Thanks, now `getTime()` is returning an integer. @peeskillet, I read this guide again and I improve my code in some parts, please, read again my code and tell me if you can't understand something. What you don't understand?
score: 0
type: Comment

http://stackoverflow.com/a/41105736
has comment: http://stackoverflow.com/comment/120790324
upvote count: 2
has body: I know it's late to answer but There are 2 ways more to do it: You can also send broadcast from adapter and register it in fragment. Use interface. Refer this SO question for details.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24502394
type: Answer

http://stackoverflow.com/a/24538924
score: 3
answers question: http://stackoverflow.com/q/24538857
upvote count: 3
has body: When you call a method in java, even if it's cast to the super type, it always looks for the most overridden method to call. From http://docs.oracle.com/javase/tutorial/java/IandI/override.html The distinction between hiding a static method and overriding an instance method has important implications: The version of the overridden instance method that gets invoked is the one in the subclass. The version of the hidden static method that gets invoked depends on whether it is invoked from the superclass or the subclass.
type: Answer
downvote count: 0

hadoop
tags question: http://stackoverflow.com/q/24450253
tag name: hadoop
tags question: http://stackoverflow.com/q/24517264
tags question: http://stackoverflow.com/q/24530045
type: Tag
tags question: http://stackoverflow.com/q/24545645
tags question: http://stackoverflow.com/q/24519288
tags question: http://stackoverflow.com/q/24555350
tags question: http://stackoverflow.com/q/24481439
tags question: http://stackoverflow.com/q/24445671
tags question: http://stackoverflow.com/q/24548699
tags question: http://stackoverflow.com/q/24575639
tags question: http://stackoverflow.com/q/24445473
tags question: http://stackoverflow.com/q/24554625
tags question: http://stackoverflow.com/q/24440443
tags question: http://stackoverflow.com/q/24566799
tags question: http://stackoverflow.com/q/24547281
tags question: http://stackoverflow.com/q/24495986
tags question: http://stackoverflow.com/q/24444561
tags question: http://stackoverflow.com/q/24537973
tags question: http://stackoverflow.com/q/24486002
tags question: http://stackoverflow.com/q/24583029
tags question: http://stackoverflow.com/q/24556461
tags question: http://stackoverflow.com/q/24520427
tags question: http://stackoverflow.com/q/24430998
tags question: http://stackoverflow.com/q/24453515
tags question: http://stackoverflow.com/q/24435554
tags question: http://stackoverflow.com/q/24468402
tags question: http://stackoverflow.com/q/24464267

http://stackoverflow.com/q/24584754
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/24584776
has body: I was doing a simple exercise, my code should output a 5x5 board of #. It outputs vertical lines instead of horizontal. public class SqareBoared_with_NestedLoops { public static void main(String[] args) { for (int i = 0; i &lt;= 5; i++) { for (int j = 0; j &lt;= 5; j++) { System.out.println("# "); } System.out.println(); } } } It outputs 5 vertical lines of #.
score: -1
has answer: http://stackoverflow.com/a/24584783
has answer: http://stackoverflow.com/a/24584974
downvote count: 1
tagged with: nested
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/24584808
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24584776
upvote count: 0
possible better answer: http://stackoverflow.com/a/24584783
has title: Not getting the right output with nested for loops in java

http://stackoverflow.com/comment/37864763
has text: Simple oop make a function return a value try searching getters and setters java
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24465979

http://stackoverflow.com/q/24499783
has title: How to apply a @XmlJavaTypeAdapter rule to all fields of a specific type at once in JAXB?
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xmladapter
downvote count: 0
tagged with: date-format
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24500820
accepted answer: http://stackoverflow.com/a/24500820
tagged with: jaxb
type: Question
answer count: 1
has body: I want to change the way XML date format is written, but I don't want to put annotations in every getter of the entire project. Is there a way to set the XmlAdapter globally to all fields of a specific type? Or at least in each class and not in each method. Obs: My models aren't generated, they are hand written. Thanks!
upvote count: 1

http://stackoverflow.com/comment/38048272
comment on: http://stackoverflow.com/q/24564603
has text: Because of this kind of confusion, you really shouldn't do this in real code.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/37861517
type: Comment
has text: Well, seems like you took a stab at it at least. Is there anything wrong with what you have?
type: QuestionComment
comment on: http://stackoverflow.com/q/24464432
score: 0

http://stackoverflow.com/comment/38076547
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24579822
has text: @committedandroider: I do not know why you are getting that message. When you run the `draw9patch.bat` (or `draw9patch.cmd`) file, such as by double-clicking on it in Windows Explorer, what happens?
type: AnswerComment

jitsi
type: Tag
tag name: jitsi
tags question: http://stackoverflow.com/q/24436201

http://stackoverflow.com/comment/38015557
type: AnswerComment
has text: Just to amend the above said, it is not necessary to checkout the branch first. Irrespective of the current branch, you can show the log starting with a certain commit like this: `new Git( repository ).log().add( commit-id ).call();` To resolve a commit-id, you can use repository.resolve( name-of-branch )
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24537938

http://stackoverflow.com/comment/38076180
score: 1
has text: Is there a reason you're no using the `$exists` operator ? http://docs.mongodb.org/manual/reference/operator/query/exists/ You may also want to check out: http://docs.mongodb.org/manual/faq/developers/#faq-developers-query-for-nulls
type: QuestionComment
comment on: http://stackoverflow.com/q/24578726
type: Comment

http://stackoverflow.com/a/24522534
answers question: http://stackoverflow.com/q/24521902
type: AcceptedAnswer
downvote count: 0
has body: I suggest to first make sure the activity is in the AndroidManifest file. Second is to change your intent from this: Intent songPickedActivity = new Intent("me.lemmy.portablemusic.app.SONGPICKED"); into: Intent songPickedActivity = new Intent(this, SongPicked.class); Do it as well on the songPickedActivity when going back to MainActivity. You can use putExtra to send data to next intent. For more information click this link.
accepted answer of: http://stackoverflow.com/q/24521902
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/24467904
answer count: 1
favorite count: 0
upvote count: 2
tagged with: fonts
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24467927
tagged with: java
type: Question
has title: Custom font in Android app and ActionBar
downvote count: 0
has body: I've been busting my head all afternoon on implementing a custom font in my Android app. First, I had troubles with a custom font in my navigation drawer. That doesn't seem to work. So I decided to try the Actionbar title, but I'm having equal problems. I found this website http://www.tristanwaddington.com/2013/03/styling-the-android-action-bar-with-a-custom-font/ and decided to try it. I created a custom java file with the code below: package vimen.vimenlogin; import android.content.Context; import android.graphics.Paint; import android.graphics.Typeface; import android.text.TextPaint; import android.text.style.MetricAffectingSpan; import android.util.LruCache; public class TypefaceSpan extends MetricAffectingSpan { /** An LruCache for previously loaded typefaces. */ private static LruCache<String, Typeface> sTypefaceCache = new LruCache<String, Typeface>(12); private Typeface mTypeface; /** * Load the {@link Typeface} and apply to a {@link}. */ public TypefaceSpan(Context context, String typefaceName) { mTypeface = sTypefaceCache.get(typefaceName); if (mTypeface == null) { mTypeface = Typeface.createFromAsset(context.getApplicationContext() .getAssets(), String.format("fonts/%s", typefaceName)); // Cache the loaded Typeface sTypefaceCache.put(typefaceName, mTypeface); } } @Override public void updateMeasureState(TextPaint p) { p.setTypeface(mTypeface); // Note: This flag is required for proper typeface rendering p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); } @Override public void updateDrawState(TextPaint tp) { tp.setTypeface(mTypeface); // Note: This flag is required for proper typeface rendering tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); } } Afther that, I put the method in my main.java file: public void restoreActionBar() { actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); SpannableString s = new SpannableString("testing"); s.setSpan(new TypefaceSpa…
accepted answer: http://stackoverflow.com/a/24467927
tagged with: android

http://stackoverflow.com/q/24434586
has answer: http://stackoverflow.com/a/38880036
linked to: http://stackoverflow.com/q/1429172
tagged with: resources
type: Question
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/11012819
upvote count: 3
has body: In my project I have a resources directory with a my_directory inside. my_directory contains text files. I want to loop this directory with: URL resource = Resources.class.getResource("/my_directory"); File directory = new File(resource.getPath()); Collection&lt;File&gt; files = FileUtils.listFiles(directory, new String[]{"txt"}, true); files collection contains all .txt files. It works well if I run this project in debugger. However if I build project to jar file, it gives an error: java.lang.IllegalArgumentException: Parameter 'directory' is not a directory directory file path is: /home/hsz/.../lib/my_project.jar!/my_directory How can I use Apache's FileUtils on resources directory ?
has answer: http://stackoverflow.com/a/24434755
accepted answer: http://stackoverflow.com/a/24434755
tagged with: apache-commons-io
possible better answer: http://stackoverflow.com/a/38880036
downvote count: 0
has comment: http://stackoverflow.com/comment/37806581
has title: FileUtils.listFiles() on resources directory
has comment: http://stackoverflow.com/comment/37806654
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37806472
score: 3
tagged with: java

http://stackoverflow.com/q/24478480
has body: How to System.Out.println stored procedure witch i have created in Oracle database. As you can see, stored precedure returns database version banner. Now i want to print that banner in java console. My stored procedure is: CREATE OR REPLACE PROCEDURE getVersion (out_cursor OUT SYS_REFCURSOR) AS BEGIN OPEN out_cursor FOR SELECT * FROM V$VERSION; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line (SQLERRM); WHEN OTHERS THEN DBMS_OUTPUT.put_line (SQLERRM); END getVersion; Java code: System.out.println("Connecting to a selected database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully..."); //CREATE procedure Statement stmtpr = conn.createStatement(); // Create the stored function stmtpr.execute("CREATE OR REPLACE PROCEDURE getVersion (out_cursor OUT SYS_REFCURSOR) AS BEGIN OPEN out_cursor FOR SELECT * FROM V$VERSION; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line (SQLERRM); WHEN OTHERS THEN DBMS_OUTPUT.put_line (SQLERRM);END getVersion;"); // Close the statement System.out.println("PROCEDURE created!!! "); stmtpr.close(); //Execute a query System.out.println("Creating statement..."); CallableStatement stmtpro = conn.prepareCall("BEGIN getVersion(?); END;"); stmtpro.registerOutParameter(1, OracleTypes.CURSOR); stmtpro.execute(); ResultSet rs = ((OracleCallableStatement) stmtpro).getCursor(1); while (rs.next()) { System.out.println(rs)); //How to print BANNER data } rs.close(); stmtpro.close(); conn.close();
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/24491530
favorite count: 0
type: Question
upvote count: 1
answer count: 1
has title: Java: How to print stored procedure data from Oracle
tagged with: java
tagged with: oracle11g
has answer: http://stackoverflow.com/a/24491530

http://stackoverflow.com/q/24456446
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37847293
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37847100
tagged with: java
score: 7
has title: javax.servlet.* cannot be resolved to a type
has body: I am running ubuntu 14.04 and eclipse Kepler (with java ee modules preloaded) , I am developing Dynamic Web App for first time, it always says javax.servlet.xyz cannot be resolved to a type please help I am including a screen snapshot for my error page!
has comment: http://stackoverflow.com/comment/37846831
has comment: http://stackoverflow.com/comment/37847012
type: Question
has comment: http://stackoverflow.com/comment/37846937
has comment: http://stackoverflow.com/comment/37846850
tagged with: eclipse
has answer: http://stackoverflow.com/a/24456776
accepted answer: http://stackoverflow.com/a/24456776
has comment: http://stackoverflow.com/comment/37847154
has comment: http://stackoverflow.com/comment/37846898
tagged with: servlets
upvote count: 7
linked to: http://stackoverflow.com/q/860022

http://stackoverflow.com/comment/37883462
comment on: http://stackoverflow.com/q/24476054
score: 0
has text: Eugh rawtypes. Please please never use them.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38007780
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24542816
has text: possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)
type: QuestionComment

http://stackoverflow.com/comment/111197844
type: AnswerComment
comment on: http://stackoverflow.com/a/24481672
type: Comment
has text: When I have encountered this type of problem (not so often as I am relatively new to java.streams!) my initial instinct was to go for Option A. However I always felt uneasy about this, it seems like we are moving out of the streams world, then back in again ... just for the sake of duplication. I *think* I'm much in favour of option B. I'm using it in my project and it looks to be working as desired. On the face of it maybe processing has to be duplicated, I guess this is more a question for the authors of the Streams API??
score: 1

http://stackoverflow.com/q/24512166
favorite count: 0
has title: Error While parsing in JSP
has body: I am trying to Store some values in MySql database. The value are taken from a jsp page.But there seem to be some problem with parsing which I can't figure out. Here's my code JSP &lt;%@page import="register.register"%&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;PenguinSoft(India)&lt;/title&gt; &lt;meta name="keywords" content="" /&gt; &lt;meta name="description" content="" /&gt; &lt;link href="default.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;%//**The Problem is Somewhere in this part of code** String stdname = request.getParameter("student"); String batch = request.getParameter("batch"); String email = request.getParameter("email"); String contact = request.getParameter("contact"); String msg; String fees=request.getParameter("fees"); int stdcontact=Integer.parseInt(contact); int stdfees=Integer.parseInt(fees); if (stdname!= null ) { register objadd = new register(); boolean flag = objadd.InsertNew(stdname,batch,email,stdcontact,stdfees); if (flag) { request.getRequestDispatcher("success.jsp").forward(request, response); } else { msg = "Invalid data entered!"; } } %&gt; &lt;form action="Register.jsp" method="POST"&gt; &lt;div id="header"&gt; &lt;div id="logo"&gt; &lt;h1&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/h1&gt; &lt;h3&gt;&lt;a href="#"&gt;PenguinSoft&lt;/a&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div id="menu"&gt; &lt;ul&gt; &lt;li class="first"&gt;&lt;a href="#" title=""&gt;New Batch&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="Login.jsp" title=""&gt;Register Student&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="AddEmployeeData.jsp" title=""&gt;Fees Record&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="AddKeywords.jsp" title=""&gt;Manage Student&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="StopWordDetectionForm.jsp" title=""&gt;All Details&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/di…
type: AnsweredQuestion
tagged with: java
tagged with: mysql
downvote count: 1
has answer: http://stackoverflow.com/a/24512218
accepted answer: http://stackoverflow.com/a/24512218
type: Question
score: 0
upvote count: 1
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/24551177
favorite count: 0
possible better answer: http://stackoverflow.com/a/53157606
answer count: 5
has answer: http://stackoverflow.com/a/53157606
accepted answer: http://stackoverflow.com/a/24551530
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/77082199
tagged with: grails
tagged with: hql
has answer: http://stackoverflow.com/a/77307119
type: Question
has body: I'm trying to write an HQL query to grab a list of users that belong to a particular organisation, or any franchisee from a list of franchisees, however hibernate isn't able to parse it. I can't figure out why. Here is the HQL: from User u where (u.parentOrganisation = :topLevelOrganisation or u.parentOrganisation in :franchisees) and u.parentOrganisation.deleted = false and u.active = true This is the error that hibernate spits out: unexpected AST node: {vector} [from com.myapp.User u where (u.parentOrganisation = :topLevelOrganisation or u.parentOrganisation in :franchisees0_, :franchisees 1_, :franchisees2_) and u.parentOrganisation.deleted = false and u.active = true]. Stacktrace follows: Message: unexpected AST node: {vector} [from com.myapp.User u where (u.parentOrganisation = :topLevelOrganisation or u.parentOrganisation in :franchisees0_, :fr anchisees1_, :franchisees2_) and u.parentOrganisation.deleted = false and u.active = true] If I take out the or u.parentOrganisation in :franchisees bit, so my query looks like this: from User u where (u.parentOrganisation = :topLevelOrganisation) and u.parentOrganisation.deleted = false and u.active = true Then it works fine. What's wrong with my syntax? Why is hibernate complaining about that extra clause?
score: 20
has title: HQL unexpected AST node: {vector}
upvote count: 20
downvote count: 0
has answer: http://stackoverflow.com/a/24551530
has answer: http://stackoverflow.com/a/36588414

http://stackoverflow.com/comment/38018334
type: Comment
type: QuestionComment
has text: @coreJavare u r right. I was wrong woth coloumn order. Nut now it is giving exception as ORA-01843: not a valid month
comment on: http://stackoverflow.com/q/24548563
score: 0

http://stackoverflow.com/comment/38046109
score: 0
type: Comment
has text: it fixed it the dependencies
comment on: http://stackoverflow.com/a/24563353
type: AnswerComment

http://stackoverflow.com/comment/38036353
comment on: http://stackoverflow.com/a/24558258
score: 0
type: Comment
has text: That's a good suggestion, let me check on that.
type: AnswerComment

http://stackoverflow.com/q/24466059
tagged with: javadoc
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37884043
has comment: http://stackoverflow.com/comment/37864778
type: UnansweredQuestion
type: Question
has body: When i fetched qt jambi jars from maven repository i found that there is no javadocs in it. Downloading javadocs in maven didn't help. My pom.xml: net.sf.qtjambi qtjambi 4.6.3 net.sf.qtjambi qtjambi-maven-plugin src/main/java <noObsoleteTranslations>true</noObsoleteTranslations> qtjambi qtjambi http://qtjambi.sourceforge.net/maven2/ qtjambi qtjambi http://qtjambi.sourceforge.net/maven2/ I've tried to download jar manually, but there is still no javadoc in it.
has answer: http://stackoverflow.com/a/24466225
has comment: http://stackoverflow.com/comment/37864689
tagged with: maven
answer count: 1
tagged with: qt
has title: Qt Jambi Javadoc missing
score: 0
tagged with: java

http://stackoverflow.com/comment/38032718
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24555834
score: 0
has text: Got the issue. It was the problem with field name. updated my answer.. :)

http://stackoverflow.com/a/24562101
upvote count: 2
has body: Try with Swing Timer if you are looking for some animation. Please have a look at How to Use Swing Timers Here is the sample code: int delay = 1000; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... } }; new Timer(delay, taskPerformer).start(); Find a Sample code here Sample code: (Move Hello World message 10px horizontally left to right at interval of 200 ms) private int x = 10; ... final JPanel panel = new JPanel() { @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawString("Hello World", x, 10); } }; int delay = 200; // milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { x += 10; if (x &gt; 100) { x = 10; } panel.repaint(); } }; new Timer(delay, taskPerformer).start();
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24561449

http://stackoverflow.com/comment/37899210
has text: Since only the Collections API is forbidden, you could use `Arrays.sort`. Since you're not allowed to write a `compareTo` method you can use a lambda expression in place of the `Comparator<String[]>`. In the lambda expression you can use `Objects.compare` with `String.CASE_INSENSITIVE_ORDER` as comparator. That way neither a single class from the `Collections` API nor `compareTo` will appear in your code and you don't have to implement any difficult logic yourself. Mission accomplished.
comment on: http://stackoverflow.com/q/24483495
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24573936
answers question: http://stackoverflow.com/q/24429557
type: Answer
has body: Try this in the html:
score: 0

http://stackoverflow.com/q/24565397
favorite count: 0
has comment: http://stackoverflow.com/comment/38049849
answer count: 3
has comment: http://stackoverflow.com/comment/38049815
has title: Bug in converting from a large long to a float in Java on OSX?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24565464
has answer: http://stackoverflow.com/a/24565456
type: Question
has comment: http://stackoverflow.com/comment/38049837
has body: I'm running JDK 1.7 on OS/X, 64-bit. This is, I think, a bug... because it does not occur on Android nor on an Ubuntu Linux box. Maybe it's specific to my x86 processor (just purchased earlier this year)...not sure. Basically, I want a time... in either nanoseconds or milliseconds... expressed as a float. When I run the below code, and cast the long returned by System.nanoTime() to a float, the float stays constant. The same problem occurs with System.currentTimeMillis(). The time (a long) is changing of course... but the cast to a float is completely and utterly failing. It even fails with a large long that I manually enter as 1404434478024L. for (int i=0; i&lt;10; i++) { // long timeL = 1404434478024L; long timeL = java.lang.System.nanoTime(); // long timeL = java.lang.System.currentTimeMillis(); float timeF = timeL; System.out.printf("%d: TimeL is %d. timeF is %f. ", i, timeL, timeF); Long pTimeL = new Long(timeL); float timeF2 = pTimeL.floatValue(); System.out.printf(" And timeF2 is %f.\n", timeF2); } Output: 0: TimeL is 1404435840046330000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 1: TimeL is 1404435840046601000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 2: TimeL is 1404435840046870000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 3: TimeL is 1404435840047149000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 4: TimeL is 1404435840047417000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 5: TimeL is 1404435840047690000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 6: TimeL is 1404435840047959000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 7: TimeL is 1404435840048230000. timeF is 1404435888972234750.000000. And timeF2 is 1404435888972234750.000000. 8: TimeL is 1404435840048517000. timeF is 1404435888972234750.000000. And t…
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/38072312
score: 0
has comment: http://stackoverflow.com/comment/38049787
tagged with: casting
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24565461
has comment: http://stackoverflow.com/comment/38049894

http://stackoverflow.com/a/24451961
downvote count: 0
type: Answer
has body: maybe your application should check the jre version and print a message to the user? get java version like this: String st = System.getProperty("java.version");
upvote count: 2
answers question: http://stackoverflow.com/q/24451865
score: 2
has comment: http://stackoverflow.com/comment/37838310
has comment: http://stackoverflow.com/comment/37838878

http://stackoverflow.com/q/24504479
has body: I have a form to set values for bean. This form has a List, every address consist of street, city, zip. How to set value of street for example to street ? Piece of code //List List&lt;Address&gt; addressList ; //with getter and setter //Address POJO with getters and setters private String city; private String zipCode; private String street; //JSP &lt;form:form id="form" commandName="form" acceptCharset="UTF-8"&gt; &lt;c:forEach items="${form.addressList}" var="ad"&gt; &lt;input value="${ad.street}" id="addressList"name="addressList.street" type="text" /&gt; &lt;/c:forEach&gt; &lt;/form:form&gt; $.ajax({ type : "POST", url : url, data : $('#form').serialize(), contentType : "application/x-www-form-urlencoded;charset=UTF-8", I'm sending form by ajax to controller. With List of Strings I'm getting in controller expected results, but with this POJO I'm getting null value. How to solve this problem ?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24504637
score: 0
tagged with: java
has title: Setting property of POJO from List in JSP
tagged with: jsp
type: UnansweredQuestion

http://stackoverflow.com/comment/37860472
type: QuestionComment
comment on: http://stackoverflow.com/q/24463687
score: 4
has text: Questions asking for code must **demonstrate a minimal understanding of the problem being solved**. Include attempted solutions, why they didn't work, and the *expected* results. See also: [Stack Overflow question checklist](http://meta.stackoverflow.com/questions/156810/stack-overflow-question-checklist)
type: Comment

http://stackoverflow.com/a/24545840
answers question: http://stackoverflow.com/q/24544763
has body: Try this one if it helps (for Gmail). Some of the below lines may not be required, but I have not tested each line just used these key-value pairs and working fine. Properties props = new Properties(); props.put("mail.smtp.user", senderEmailAddress); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.socketFactory.port", port_port); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); //SecurityManager security = System.getSecurityManager(); For my local Email I have used this one (non SSL) System.setProperty("sun.security.ssl.allowUnsafeRenegotiation","true"); Properties props = new Properties(); props.put("mail.smtp.user", senderEmailAddress); props.put("mail.smtp.host", host_name); //for me : mail.mydomain.com props.put("mail.smtp.port", smtp_port); //mine is "25" props.put("mail.transport.protocol", "smtp"); props.setProperty("mail.smtp.quitwait", "false"); props.put("mail.smtp.auth", "true"); //props.put("mail.smtp.starttls.enable","true"); //props.put("mail.smtp.socketFactory.port", smtp_port); //props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); //props.put("mail.smtp.socketFactory.fallback", "false"); //SecurityManager security = System.getSecurityManager();
score: 0
type: Answer

http://stackoverflow.com/comment/53376730
has text: @Raghav yes every time view is being bind a new click listener is assigned, but this is the standard flow. But the mOnItemClickListener is created only once for the adapter just the view and its position are different on each item click ;)
type: AnswerComment
comment on: http://stackoverflow.com/a/28304164
type: Comment
score: 1

http://stackoverflow.com/comment/37951996
type: Comment
type: QuestionComment
score: 0
has text: @chrylis I do actually have a module that packages the WAR (let's say that it's `component_b`). But it uses context configuration from XML files inside both itself and the `common` module. Is that a bad practice?
comment on: http://stackoverflow.com/q/24513033

http://stackoverflow.com/comment/37982401
score: 1
comment on: http://stackoverflow.com/a/24506746
type: AnswerComment
has text: Thank, well after some test i put the file in base64 in the client side and after in the server side change the base64 to file
type: Comment

http://stackoverflow.com/q/24533962
tagged with: java
has comment: http://stackoverflow.com/comment/37991338
has title: Compare a remote file with a local file in java
has comment: http://stackoverflow.com/comment/37991001
type: Question
tagged with: remote-server
has comment: http://stackoverflow.com/comment/38026810
score: 0
tagged with: file-upload
has body: I'm testing a web app with selenium and I run the test on a remote XP VM. In my test, I douwnload a file and I want to compare this file with a local one. Can I compare these two files : This is a part of the code : //the local file path File file1 = new File("C:/export_transaction.csv"); //the remote file path File file2 = new File("C:/Documents and Settings/Export_Transaction.csv"); Properties prop1 = new Properties(); Properties prop2 = new Properties(); prop1.load(new FileReader(file1)); prop2.load(new FileReader(file2)); Assert.assertEquals(prop1, prop2); The problem is that I can't access to the remote file path. Is there a way to specify the path of the remote file ? Please help !
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37991176
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/37997834
answer count: 0

http://stackoverflow.com/comment/37881742
comment on: http://stackoverflow.com/a/24474984
score: 0
type: Comment
has text: ok now i have another new question. how can loop back the application to the beginning? i mean right after getting all the intended inputs from the user. how can i loop back the application to where it prompts the user for another room attributes again? thanks!
type: AnswerComment

http://stackoverflow.com/q/24554084
has answer: http://stackoverflow.com/a/24554681
type: Question
linked to: http://stackoverflow.com/q/8803517
tagged with: arrays
tagged with: encapsulation
linked to: http://stackoverflow.com/q/696782
answer count: 3
has comment: http://stackoverflow.com/comment/38028181
has body: I have a very common encapsulation problem. I am querying a table through jdbc and needs to hold the records in memory for sometime for processing.I dont have any hibernate POJO for the same table to create any objects and save.I am talking about a load of say 200 million in a single query. The common approach is to create an object array and do casting when I need to use them. (Assume, I can get the table details like column name and data type which will be saved in some reference tables..) But this approach will be very expensive (Time) I guess when the load is taken into consideration.. Any good approach will be appreciated...
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24554534
tagged with: resultset
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38028102
tagged with: jdbc
has answer: http://stackoverflow.com/a/24554237
has comment: http://stackoverflow.com/comment/38041273
has title: Encapsulating JDBC resultset
has comment: http://stackoverflow.com/comment/38028380
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/38065277
score: 0
has text: Read [this][1] Article. This has a solution I think. [1]: http://stackoverflow.com/questions/7428039/java-constructor-method-with-optional-parameters
comment on: http://stackoverflow.com/q/24573918
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24501843
has comment: http://stackoverflow.com/comment/37931925
score: -1
accepted answer of: http://stackoverflow.com/q/24501590
has comment: http://stackoverflow.com/comment/37932109
answers question: http://stackoverflow.com/q/24501590
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/37931778
has body: You can try this: HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setReadTimeout(VERSION_CHECK_READ_TIMEOUT); RestTemplate template = new RestTemplate(requestFactory); Person person = restTemplate.getForObject("http://localhost:8080/Library/rest/person/1", Person.class); If above doesn't work you can try using a Entity approach like: RestTemplate restTemplate = new RestTemplate(); // Prepare acceptable media type List&lt;MediaType&gt; acceptableMediaTypes = new ArrayList&lt;MediaType&gt;(); acceptableMediaTypes.add(MediaType.APPLICATION_XML); // Set what you need // Prepare header HttpHeaders headers = new HttpHeaders(); headers.setAccept(acceptableMediaTypes); HttpEntity&lt;Person&gt; entity = new HttpEntity&lt;Person&gt;(headers); // Send the request as GET try { ResponseEntity&lt;PersonList&gt; result = restTemplate.exchange("http://localhost:8080/Library/rest/person/1", HttpMethod.GET, entity, PersonList.class); // Add to model model.addAttribute("persons", result.getBody().getData()); } catch (Exception e) { logger.error(e); } There are many useful examples here. Hope to help

http://stackoverflow.com/a/24560449
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24560322
has comment: http://stackoverflow.com/comment/38044621
downvote count: 0
has comment: http://stackoverflow.com/comment/38040486
type: Answer
has comment: http://stackoverflow.com/comment/38040687
has body: The RelativeLayout class has no add() method. buttons is an ArrayList of RelativeLayouts. When you call buttons.get(i), you get a single RelativeLayout object. Since RelativeLayout has no add() method, you get this error. It isn't entirely clear what your intent is with this code, but I am assuming that you are trying to add each of your RelativeLayouts to the buttons list. If this is correct, you just need to remove the get(i) call, making that line into buttons.add((RelativeLayout) findViewById(resID));
has comment: http://stackoverflow.com/comment/38040792

http://stackoverflow.com/a/48256689
answers question: http://stackoverflow.com/q/24510940
has body: you can do like this： ClusterState state = client.admin().cluster().prepareState().get().getState(); ImmutableOpenMap&lt;String, MappingMetaData&gt; mappings = state.getMetaData().index("your-index-name").getMappings(); for (ObjectObjectCursor&lt;String, MappingMetaData&gt; mapping : mappings) { Object o = JSONObject.toJSON(mapping.value.getSourceAsMap()); System.out.println(o); }
score: 0
type: Answer

http://stackoverflow.com/comment/38075636
type: Comment
has text: Is there a reason why `BanriProcessor` should be a Stateless Session Bean rather than just a CDI Bean? I'm not 100% sure but I think that if you remove the `@Stateless` annotation, the injection will work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24578646

http://stackoverflow.com/q/24583563
score: 0
tagged with: javacv
has comment: http://stackoverflow.com/comment/38163401
has comment: http://stackoverflow.com/comment/38160405
has comment: http://stackoverflow.com/comment/38203531
has comment: http://stackoverflow.com/comment/38086765
has comment: http://stackoverflow.com/comment/38083549
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/38203370
has body: OK, I have no idea what is going on here, I have read many threads about this case and followed the reviews but unfortunately I have got no clue. I have already read the openCV documentation about static initialization. So I have copied openCV native libs to my libs folder. Then I added this line to my code: static { if (!OpenCVLoader.initDebug()) { // Handle initialization error } } and finally, I added this line: mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); inside onCreate method. Now, When I run my app I have got these errors: 07-05 10:34:44.926: E/AndroidRuntime(9548): FATAL EXCEPTION: main 07-05 10:34:44.926: E/AndroidRuntime(9548): Process: org.opencv.javacv.facerecognition, PID: 9548 07-05 10:34:44.926: E/AndroidRuntime(9548): java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: com.googlecode.javacv.cpp.opencv_calib3d 07-05 10:34:44.926: E/AndroidRuntime(9548): at com.googlecode.javacpp.Loader.load(Loader.java:455) 07-05 10:34:44.926: E/AndroidRuntime(9548): at com.googlecode.javacv.cpp.opencv_contrib.&lt;clinit&gt;(opencv_contrib.java:104) 07-05 10:34:44.926: E/AndroidRuntime(9548): at org.opencv.javacv.facerecognition.PersonRecognizer.&lt;init&gt;(PersonRecognizer.java:42) 07-05 10:34:44.926: E/AndroidRuntime(9548): at org.opencv.javacv.facerecognition.FdActivity$1.onManagerConnected(FdActivity.java:153) 07-05 10:34:44.926: E/AndroidRuntime(9548): at org.opencv.javacv.facerecognition.FdActivity.onCreate(FdActivity.java:232) 07-05 10:34:44.926: E/AndroidRuntime(9548): at android.app.Activity.performCreate(Activity.java:5451)07-05 10:34:44.926: E/AndroidRuntime(9548): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 07-05 10:34:44.926: E/AndroidRuntime(9548): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359) 07-05 10:34:44.926: E/AndroidRuntime(9548): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453) 07-05 10:34:44.926: E/AndroidRuntime(9…
has comment: http://stackoverflow.com/comment/38083506
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/38203612
has comment: http://stackoverflow.com/comment/38083456
type: Question
tagged with: opencv
has comment: http://stackoverflow.com/comment/38202795
has comment: http://stackoverflow.com/comment/38086821
has title: Static Initialization of openCV in android app

http://stackoverflow.com/q/24484370
tagged with: taskmanager
upvote count: 5
answer count: 1
downvote count: 0
has title: multiple java.exe's when restarting android studio
tagged with: windows
has answer: http://stackoverflow.com/a/24620308
favorite count: 0
tagged with: android-studio
score: 5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24620308
tagged with: java
type: Question
has body: I ve noticed that when you exit android-studio and look in taskmgr - you will see that process studio64.exe is terminated , while java.exe is still running (probably doing nothing 0% cpu use) and consuming about 400Mb of ram. So when you start android studio again it launches another java.exe and if you close android-studio - the second java.exe stays in memory along with the first one, consuming memory but not loading cpu. If you repeat steps it just adds another java.exe Question is, is it safe to terminate old java.exe processes? EDIT looks like google fixed that strange behaviour/bug.

http://stackoverflow.com/a/24483255
type: Answer
has body: You are essentially asking to duplicate the type knowledge that is available at compile-time with which the compiler generates the correct conversion. The runtime doesn't have this knowledge, so you will have to provide it by building a matrix of types and coding all the conversions you want, explicitly. You can define this as a matrix indexed by type along both axes (from-type and to-type) or more likely as a Map whose key is a ConversionType object each instance of which defines fromType, toType and a convert() method.
answers question: http://stackoverflow.com/q/24483176
score: 0

http://stackoverflow.com/q/24532133
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24558622
has comment: http://stackoverflow.com/comment/38036425
linked to: http://stackoverflow.com/q/17287018
type: Question
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24558622
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24532252
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/24532252
linked to: http://stackoverflow.com/q/18328730
has comment: http://stackoverflow.com/comment/37986905
tagged with: android
has title: How to rebuild Android app in release mode with another package name by command line interface?
has body: Hello im making an generic app that is configurable by xmls and files on res. Im trying to make differents apks from the same source of code. The problem is that im triying to do this by command line interface and i still dont find a way to change the package name and then build it in release mode. I created my custom build.xml ant file and I tryed this solution,it generates 2 apks: MainActivity-debug.apk and MainActivity-debug-unaligned.apk but didnt work for me since the apk just built on debug mode and didnt even ran on emulator throwing [ INSTALL_FAILED_INVALID_APK]. So is there a way of doing this? The main problem isnt about debug or release mode since i think i just will have to use ant release command, is about creating an apk with different packages names so i can have both signed and running in same device. Thank you!

http://stackoverflow.com/comment/37812821
comment on: http://stackoverflow.com/a/24438046
score: 0
type: AnswerComment
type: Comment
has text: no hold on lemme share the another question I posted

http://stackoverflow.com/q/24433908
tagged with: filter
score: 2
has body: I have following files in directory: error.log error1.log Somename.log.trololo AnotherName.logarifm I want that following files will be in array: error.log error1.log Somename.log.trololo I wrote following code: FileFilter fileFilter = new WildcardFileFilter("*.log.*|*.log$"); File[] files = source.listFiles(fileFilter); But my array is empty. How to write right wildcard? UPDATE public class Test { public static void main(String[] args) { File source = new File("D:"); if (source.isDirectory()) { FileFilter fileFilter = new WildcardFileFilter(Arrays.asList("*.log.*", "*.log")); File[] files = source.listFiles(fileFilter); for (int i = 0; i &lt; files.length; i++) { System.out.println(files[i]); } } } }
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24434150
upvote count: 2
tagged with: io
type: AnsweredQuestion
tagged with: java
type: Question
has title: apache commons I/O. How to filter files by wildcard?
has answer: http://stackoverflow.com/a/24434150
downvote count: 0
tagged with: wildcard

http://stackoverflow.com/comment/37827705
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24445963
has text: that could be helpful
score: 0

http://stackoverflow.com/q/24539959
answer count: 1
has body: OS: Linux RedHat App Server: Weblogic 12.1.1 When attempting to access Jenkins on after deploying the WAR, I received the following error: javax.servlet.ServletException: there's no "app" attribute in the application context. I followed the instructions outlined at jenkins-ci.org, and ensured that JENKINS_HOME was set properly. In Addition, due to environment constraints I have to deploy this as a WAR. Unfortunately, apt-get and yum are not options for me.
has title: 500 Error "no app attribute" when accessing Jenkins on weblogic 12.1.1
tagged with: linux
tagged with: jenkins
type: UnansweredQuestion
tagged with: weblogic
tagged with: weblogic12c
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/24539960

http://stackoverflow.com/comment/37953304
has text: As like excel, if we change content type to response.setHeader("Content-Type", "application/vnd.ms-excel"); it will write the table contents in excel. Likewise, how to do it in pdf?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24513981

http://stackoverflow.com/q/24548656
favorite count: 0
upvote count: 5
tagged with: json-simple
has body: I have the following function that uses org.json.simple to create JSON object. public JSONObject createJSONRequest() { // /* Create JSON Objects */ JSONObject jsonObject = new JSONObject(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(ACCESS_TOKEN_KEY, mAccessToken); map.put(SESSION_ID_KEY, mSessionId); map.put(SNAPZ_ID_KEY, mSnapzId); map.put(EMAIL_KEY, mEmail); map.put(EMAIL_PWD_KEY, mEmailPwd); JSONArray list = new JSONArray(); list.add(map); jsonObject.put("parameters", list); jsonObject.put("function", "verifyEmail"); return jsonObject; } However, I keep getting this warning when I use lint checker. [unchecked] unchecked call to add(E) as a member of the raw type ArrayList list.add(map); ^ where E is a type-variable: E extends Object declared in class ArrayList warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap jsonObject.put("parameters", list); ^ where K,V are type-variables: K extends Object declared in class HashMap V extends Object declared in class HashMap warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap jsonObject.put("function", "verifyEmail"); I have tried to use the generic type. HashMap uses generics, but the other objects JSONObject JSONArray don't. Many thanks for any suggestions,
has comment: http://stackoverflow.com/comment/38019594
has comment: http://stackoverflow.com/comment/38019119
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38018479
downvote count: 0
tagged with: java
has title: unchecked call to add(E) as a member of the raw type ArrayList and HashMap
type: Question
score: 5
has comment: http://stackoverflow.com/comment/38018795
has answer: http://stackoverflow.com/a/24549593
accepted answer: http://stackoverflow.com/a/24549593
answer count: 1

http://stackoverflow.com/q/24573688
tagged with: struts2
has comment: http://stackoverflow.com/comment/38082433
has comment: http://stackoverflow.com/comment/38086586
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/38073925
has comment: http://stackoverflow.com/comment/38064769
has comment: http://stackoverflow.com/comment/38082441
favorite count: 0
has comment: http://stackoverflow.com/comment/38064871
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38074995
has comment: http://stackoverflow.com/comment/38070555
has comment: http://stackoverflow.com/comment/38075571
score: 1
tagged with: java
has title: Struts 2.3 error: Unable to load configuration and similar errors
upvote count: 1
has answer: http://stackoverflow.com/a/26650349
type: Question
has body: Just started to learn struts 2.x and setup the project in eclipse, i have referred some tutorials site and struts documentation, but while i try to run a simple HelloWorld application. I get resource Not found error in browser. Here is the console output of what is going wrong. Jul 04, 2014 5:13:57 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_25\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\MySQL\MySQL Server 5.6\bin;C:\Python33\Lib\site-packages\PyQt4;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Groovy\Groovy-2.1.6\bin;C:\Python33;G:\python\work;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin\;C:\Program Files\TortoiseSVN\bin;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Program Files (x86)\Bitvise SSH Client;C:\Program Files\MySQL\MySQL Server 5.6\bin;. Jul 04, 2014 5:13:57 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsDemo' did not find a matching property. Jul 04, 2014 5:13:57 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jul 04, 2014 5:13:57 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jul 04, 2014 5:13:57 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 688 ms Jul 04, 2014 5:13:58 PM …
linked to: http://stackoverflow.com/q/22616684
tagged with: eclipse

http://stackoverflow.com/comment/37903943
comment on: http://stackoverflow.com/a/24484984
score: 0
type: AnswerComment
type: Comment
has text: i mean its showing only once and when i hover it still its dispose :(

http://stackoverflow.com/comment/37928125
comment on: http://stackoverflow.com/q/24490853
score: 0
type: QuestionComment
type: Comment
has text: May be the [Parallel Pipeline pattern](http://www.amazon.com/Software-Pipelines-SOA-Multi-Core-Processing/dp/0137137974) can help you in this case.

http://stackoverflow.com/comment/38040041
comment on: http://stackoverflow.com/a/24560241
score: 0
type: Comment
has text: This is told to me as a part of question that Employee instance will be passed only.
type: AnswerComment

http://stackoverflow.com/comment/37923070
comment on: http://stackoverflow.com/a/24497021
score: 0
type: AnswerComment
has text: @jamesgates1: see edit. but again, you don't want to cheat yourself out of experimentation. That's where the fun and learning of programming begins.
type: Comment

http://stackoverflow.com/comment/38085290
type: Comment
comment on: http://stackoverflow.com/a/24584634
type: AnswerComment
has text: ok, but I think the path is correct. I tryed with your code but the result is same.
score: 0

http://stackoverflow.com/comment/37826440
score: 4
has text: Seriously? I would nearly not even go for a `Set`, but a whole `Map`? And then, your map doesn't contain values for the other ints and will return `null` instead of true or false.
type: Comment
comment on: http://stackoverflow.com/a/24445430
type: AnswerComment

http://stackoverflow.com/q/24432461
has answer: http://stackoverflow.com/a/24432587
type: Question
has comment: http://stackoverflow.com/comment/37802432
has body: This week I started Android programming, and this is what I'd like to achieve through my first application. I'm new to both Java and Android, but I have some Python experience. I have a python server running on my raspberryPi that, depending on the commands received, fades a bunch of RGB leds. I'm now trying to build an Android app that sends commands to the server through sockets. There is an input box and a button: when the button is pressed, i want the entered data to be sent to the server. I wrote it and it works, but I believe there is something wrong with my implementation. I want the app to open a socket connection and, while keeping it open, send commands to the server. When clicked, the button passes the entered command and server address to ASyncTask, which then opens the connection to the server and sends the command. However, to send a new command, the connection has to be closed and opened again, and ASyncTask called another time. I don't need this: the connection should stay open all the time. Here's my code (the important bits): This gets the input and sends it to ASyncTask when the button is clicked: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText inputText = (EditText) findViewById(R.id.editText2); final Button sendButton = (Button) findViewById(R.id.button); final TextView text = (TextView) findViewById(R.id.textView3); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String outputText = inputText.getText().toString().concat("\n"); text.append(outputText); ConnectTask task = new ConnectTask(); task.execute("192.168.1.3:1322", inputText.getText().toString()); } }); And this is my ASyncTask subclass: private class ConnectTask extends AsyncTask&lt;String, Void, Void&gt;{ @Override protected Void doInBackground(String... strings){ String[] spl = strings[0].split(":"); String address = spl[0]; int port = In…
answer count: 1
accepted answer: http://stackoverflow.com/a/24432587
tagged with: android-asynctask
has title: Keeping a socket connection open while sending commands on Android
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/37802475
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/24522377
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/24522751
answer count: 5
possible better answer: http://stackoverflow.com/a/24522455
has body: The warning eclipse gives me is an unsued import warning on the View.OnClickListener, but i am using it... I am pretty confident this is where my error lies. Please take a look at my code and correct all errors. This is my first attempt to write an app from scratch. Thank you for your time! This is my main but it is called SICalculatorActivity package com.codeherenow.sicalculator; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; public class SICalculatorActivity extends Activity { private Button calcButton; private SeekBar yearsSeek = null; private EditText principalAmount; private EditText interestRate; private TextView scaleReadout; private TextView resultText; float totalAmount; float iRate; float pAmount; float years; String result; // public int progressChanged=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sicalculator); resultText = (TextView) findViewById(R.id.resultText); result=resultText.getText().toString(); scaleReadout = (TextView) findViewById(R.id.scaleReadout); years=Float.parseFloat(scaleReadout.getText().toString()); calcButton = (Button) findViewById(R.id.Calc_button); yearsSeek = (SeekBar) findViewById(R.id.seekBar1); principalAmount= (EditText) findViewById(R.id.editPrincipalAmount); pAmount=Float.parseFloat(principalAmount.getText().toString()); interestRate = (EditText) findViewById(R.id.editIntrestRate); iRate = Float.parseFloat(interestRate.getText().toString()); yearsSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { // int progressChanged = 0; public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { yearsSeek.setMax(50); scaleReadout.setText(progress + " Years"); } public voi…
has answer: http://stackoverflow.com/a/24522455
has answer: http://stackoverflow.com/a/24543607
has answer: http://stackoverflow.com/a/24522862
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
tagged with: android-layout
has title: I am building an interest calculating app, my project builds fine with 1 warning, but it will not open on my device
has answer: http://stackoverflow.com/a/24522648
accepted answer: http://stackoverflow.com/a/24522648

http://stackoverflow.com/a/24433034
downvote count: 0
has comment: http://stackoverflow.com/comment/37829760
has body: <include name="**/dictionary_*.properties"/> <pathconvert pathsep="," property="my_files" refid="xyz"/> ${my_files} will contain the address of all files named in the pattern dictionary_XX.properties.
type: Answer
has comment: http://stackoverflow.com/comment/37805432
score: 1
answers question: http://stackoverflow.com/q/24431728
upvote count: 1
has comment: http://stackoverflow.com/comment/37829705

http://stackoverflow.com/q/24552906
has comment: http://stackoverflow.com/comment/38025936
has answer: http://stackoverflow.com/a/24553771
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/38026790
tagged with: servlet-filters
tagged with: cookies
type: UnansweredQuestion
has title: Tomcat filter to manage sessions
tagged with: java
type: Question
has body: I have two web application. Application A needs to call rest services of Application B. I wanted to put some security on rest services of Application B, so I came out with this workflow: When the user authenticate on Application A it performs also an authentication on Application B with a servlet on B that returns a cookie. The servlet is something like: authenticate(postData): // throw Exceptions HttpSession session = request.getSession(true); Cookie cookie = new Cookie("JSESSIONID", session.getId()); cookie.setDomain(request.getContextPath()); cookie.setDomain(request.getServerName()); response.addCookie(cookie); Application A stores the cookie value in the user session, and then when needed Application A use the stored cookie to calls B. On B I have a filter in front of my rest services that is assuming to handle requests to check if these are authenticated or not. The filter do something like: HttpServletRequest servletRequest = (HttpServletRequest) request; HttpSession session = servletRequest.getSession(false); if (null == session) { LOGGER.error("KO"); HttpServletResponse servletResponse = (HttpServletResponse) request; servletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); } else { // OK chain.doFilter(request, response); } now, I was expecting that request.getSession(false); will returned previously created session, cause it were tomcat who created the session in the authenticate, but it isn't working. What I'm missing?
tagged with: session
score: 0

http://stackoverflow.com/comment/37976024
score: 0
comment on: http://stackoverflow.com/q/24428433
has text: possible duplicate of [maven jboss-as:start A required class was missing ... org/sonaty.../ArtifactResolutionException](http://stackoverflow.com/questions/18609590/maven-jboss-asstart-a-required-class-was-missing-org-sonaty-artifactreso)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24563463
has body: return new ArrayList&lt;List&lt;Integer&gt;&gt;(); The outer list type needs to be a concrete type like ArrayList or LinkedList, but the inner list type should be List. On more recent Java versions, you can do return new ArrayList&lt;&gt;();
type: Answer
has comment: http://stackoverflow.com/comment/38046104
score: 2
has comment: http://stackoverflow.com/comment/38046048
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24563454
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24563454

http://stackoverflow.com/comment/38085089
type: Comment
has text: I add `<bean id="mainUI" class="com.example.test.springvaadin.vaadin.MainUI" />` to `spring-servlet.xml` and I still get NullPointerException. Vaddin class without any spring autowired works good.
type: AnswerComment
comment on: http://stackoverflow.com/a/24532596
score: 0

http://stackoverflow.com/q/24556110
type: Question
has comment: http://stackoverflow.com/comment/38039743
has answer: http://stackoverflow.com/a/24556480
answer count: 3
has comment: http://stackoverflow.com/comment/38031866
possible better answer: http://stackoverflow.com/a/24556819
has answer: http://stackoverflow.com/a/24556263
has answer: http://stackoverflow.com/a/24556819
favorite count: 0
accepted answer: http://stackoverflow.com/a/24556263
tagged with: multithreading
score: 2
type: AnsweredQuestion
has body: How can I implement FIFO queue of threads(tasks to do) and executing the threads one by one? I mean for example, take the first thread and run it, and the second must wait for the end of execution of the first thread. At the same time I must be able to add threads(tasks) to the queue.
has comment: http://stackoverflow.com/comment/38033632
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/38031820
downvote count: 1
has title: How can I implement FIFO queue of threads?

shell
tags question: http://stackoverflow.com/q/24450708
tags question: http://stackoverflow.com/q/24472116
tag name: shell
tags question: http://stackoverflow.com/q/24487514
tags question: http://stackoverflow.com/q/24555014
tags question: http://stackoverflow.com/q/24450253
tags question: http://stackoverflow.com/q/24566278
tags question: http://stackoverflow.com/q/24445942
tags question: http://stackoverflow.com/q/24483784
tags question: http://stackoverflow.com/q/24542149
type: Tag
tags question: http://stackoverflow.com/q/24490751
tags question: http://stackoverflow.com/q/24524154
tags question: http://stackoverflow.com/q/24439656
tags question: http://stackoverflow.com/q/24586010
tags question: http://stackoverflow.com/q/24454596

self-signed
type: Tag
tags question: http://stackoverflow.com/q/24520833
tag name: self-signed

conflict
tag name: conflict
type: Tag
tags question: http://stackoverflow.com/q/24463781

http://stackoverflow.com/q/24503299
tagged with: treemap
has answer: http://stackoverflow.com/a/24503350
has comment: http://stackoverflow.com/comment/37937180
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24503498
answer count: 3
downvote count: 0
has body: I need a container that contains [key, Value] pair. Here, key = Integer, Value = User Defined class object. Mutiple threads are trying to add [key, Value] pair in above container. If key already present in the container, I want to update the value by checking some condition. At the end I want container in sorted order, according to Key. My efforts - I used this synchronizedSortedMap and Sorted Map for above task. SortedMap&lt;Integer, USER_DEFINED_OBJECT&gt; m = Collections.synchronizedSortedMap(new TreeMap&lt;Integer, USER_DEFINED_OBJECT&gt;()); This helps me to add pairs concurrently on above container. And, yes If key already present, then I check some condition, then proceed. Is my approach always thread safe ? If not, please correct me. Updated USER_DEFINED_OBJECT has some field index. At the time of adding, I am checking if key is already present, then compare current USER_DEFINED_OBJECT with already present USER_DEFINED_OBJECT on the basis of above mentioned(in point 1) filed "index". If currect "index" is greater than update.
has comment: http://stackoverflow.com/comment/37934350
favorite count: 0
linked to: http://stackoverflow.com/q/5942474
has title: Thread safe container for <key, value> pair
has comment: http://stackoverflow.com/comment/37934554
score: 2
accepted answer: http://stackoverflow.com/a/24505336
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37937451
possible better answer: http://stackoverflow.com/a/24503350
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24505336
has comment: http://stackoverflow.com/comment/37934357
tagged with: java

http://stackoverflow.com/a/26034270
answers question: http://stackoverflow.com/q/24549808
score: 0
has body: Before compiling your UDF(java class) make sure you have mentioned package name properly. for example if you have mentioned package name- package com.pig.udf; It means you need to take care of directory in your linux box as well. you can follow below mentioned steps to create jar - Create directory using mkdir -p com/pig/udf Create your java class with package com.pig.udf Compile your java source code using command javac -cp /usr/lib/pig-0.12.0.2.0.6.0-76.jar YourClass.java Then go to the directory where you want to create jar for now - cd ../../.. Now create jar using below command jar -cvf yourJarName.jar com/ Register the jar in your script using keyword "register" followed by path of the jar Now use your jar with keyword com.pig.udf.YourJavaClassName for your scenerio - REGISTER /home/bigdata/NetBeansProjects/UserDefined/dist/UserDefined.jar a = load '/user/bigdata/json' using TextLoader() as (input:chararray); b = foreach a GENERATE com.pig.udf.PartsOfSpeech(input);
type: Answer

http://stackoverflow.com/a/24545993
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24545947
answers question: http://stackoverflow.com/q/24545947
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/38052291
has body: In general, a class should be abstract when you have absolutely no reason to create an instance of that class. For example, suppose you have a Shape class that is the superclass of Triangle, Square, Circle, etc. Since "Shape" is so general, there shouldn't be any reason to construct a Shape object, so it should be abstract (or perhaps even an interface).
has comment: http://stackoverflow.com/comment/38119584

http://stackoverflow.com/q/24451026
has answer: http://stackoverflow.com/a/30538439
upvote count: 49
linked to: http://stackoverflow.com/q/30969455
has answer: http://stackoverflow.com/a/27355999
has body: Did Google already released a defined style or a component for this new circular FAB button or should I implement the design on my own? The button is described here: Google Design | Floating Action Buttons EDIT (05/2015): Check Lukas' answer / Gabriele's answer showing an easy way to implement it with the design support library.
favorite count: 0
possible better answer: http://stackoverflow.com/a/24548910
has comment: http://stackoverflow.com/comment/38648207
has answer: http://stackoverflow.com/a/24548910
tagged with: android
linked to: http://stackoverflow.com/q/27653781
linked to: http://stackoverflow.com/q/30769080
has comment: http://stackoverflow.com/comment/38622077
has answer: http://stackoverflow.com/a/24455956
answer count: 4
accepted answer: http://stackoverflow.com/a/24455956
has comment: http://stackoverflow.com/comment/38636856
type: AnsweredQuestion
downvote count: 0
score: 49
tagged with: java
tagged with: material-design
has comment: http://stackoverflow.com/comment/42664769
tagged with: android-5.0-lollipop
tagged with: android-design-library
type: Question
has title: Android L - Floating Action Button (FAB)
linked to: http://stackoverflow.com/q/24459352

http://stackoverflow.com/comment/38014825
has text: Show your code, please
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24546534
score: 0

arraylist
tags question: http://stackoverflow.com/q/24580239
tags question: http://stackoverflow.com/q/24518116
tags question: http://stackoverflow.com/q/24553414
tags question: http://stackoverflow.com/q/24496691
tags question: http://stackoverflow.com/q/24482003
tags question: http://stackoverflow.com/q/24534630
tags question: http://stackoverflow.com/q/24579740
tags question: http://stackoverflow.com/q/24579849
tags question: http://stackoverflow.com/q/24443659
tags question: http://stackoverflow.com/q/24438373
tags question: http://stackoverflow.com/q/24461130
tags question: http://stackoverflow.com/q/24477111
tags question: http://stackoverflow.com/q/24476968
tags question: http://stackoverflow.com/q/24488809
tags question: http://stackoverflow.com/q/24494962
tags question: http://stackoverflow.com/q/24526019
tags question: http://stackoverflow.com/q/24542335
tags question: http://stackoverflow.com/q/24472685
tags question: http://stackoverflow.com/q/24548299
tags question: http://stackoverflow.com/q/24475036
tags question: http://stackoverflow.com/q/24454250
tags question: http://stackoverflow.com/q/24517175
tags question: http://stackoverflow.com/q/24482004
tags question: http://stackoverflow.com/q/24518606
tags question: http://stackoverflow.com/q/24432194
tags question: http://stackoverflow.com/q/24508401
tags question: http://stackoverflow.com/q/24476119
tags question: http://stackoverflow.com/q/24584687
tags question: http://stackoverflow.com/q/24563891
tags question: http://stackoverflow.com/q/24488050
tags question: http://stackoverflow.com/q/24524157
tags question: http://stackoverflow.com/q/24562029
tags question: http://stackoverflow.com/q/24514841
tags question: http://stackoverflow.com/q/24581662
tags question: http://stackoverflow.com/q/24585237
tags question: http://stackoverflow.com/q/24500962
tags question: http://stackoverflow.com/q/24575492
tags question: http://stackoverflow.com/q/24560753
tags question: http://stackoverflow.com/q/24485348
tags question: http://stackoverflow.com/q/24442805
tags question: http://stackoverflow.com/q/24554755
tags question: http://stackoverflow.com/q/24466173
tags question: http://stackoverflow.com/q/24579268
tags question: http://stackoverflow.com/q/24519889
tags question: http://stackoverflow.com/q/24534142
tags question: http://stackoverflow.com/q/24486952
tags question: http://stackoverflow.com/q/24468614
tags question: http://stackoverflow.com/q/24432095
tags question: http://stackoverflow.com/q/24493233
tags question: http://stackoverflow.com/q/24439536
tags question: http://stackoverflow.com/q/24441868
tags question: http://stackoverflow.com/q/24553536
tags question: http://stackoverflow.com/q/24470491
tags question: http://stackoverflow.com/q/24446578
tags question: http://stackoverflow.com/q/24577599
tags question: http://stackoverflow.com/q/24442086
tags question: http://stackoverflow.com/q/24523032
tags question: http://stackoverflow.com/q/24535323
type: Tag
tags question: http://stackoverflow.com/q/24490634
tags question: http://stackoverflow.com/q/24509615
tags question: http://stackoverflow.com/q/24552392
tags question: http://stackoverflow.com/q/24508824
tags question: http://stackoverflow.com/q/24579455
tags question: http://stackoverflow.com/q/24525970
tags question: http://stackoverflow.com/q/24547507
tags question: http://stackoverflow.com/q/24460480
tag name: arraylist
tags question: http://stackoverflow.com/q/24558781
tags question: http://stackoverflow.com/q/24472035
tags question: http://stackoverflow.com/q/24481982
tags question: http://stackoverflow.com/q/24452186
tags question: http://stackoverflow.com/q/24574804
tags question: http://stackoverflow.com/q/24583364
tags question: http://stackoverflow.com/q/24493130
tags question: http://stackoverflow.com/q/24526962

http://stackoverflow.com/comment/37946981
type: AnswerComment
type: Comment
has text: @Alderath I agree with you. I already said this is not a full implementation. This might be a way to implement what OP needs.
comment on: http://stackoverflow.com/a/24510037
score: 0

http://stackoverflow.com/a/24563900
has body: Running the application without declaring the activity in the manifest will usually result in Eclipse telling you exactly that. The manifest is called AndroidManifest.xml and you should be able to see it from the project explorer.
answers question: http://stackoverflow.com/q/24563783
score: 0
type: Answer

http://stackoverflow.com/comment/37931926
type: Comment
has text: Ahhh thanks that is exactly what I was looking for! Now where you say it it is pretty obvious, that I dont have to name the package, since it is already in my classpath! This working fine now! Thanks again! One more question is left: How does the application launcher knows which version of junit I want to launch, since all v4 versions have the same "architecture". I am even more surprised by the fact that my example was run with JUnit 3.8, whereby the class org.junit.runner.JUnitCore doesnt exist in the package of v3.8 o.O
comment on: http://stackoverflow.com/a/24501721
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37959048
score: 0
type: QuestionComment
has text: The problem is here TimelineActivity.java:38
type: Comment
comment on: http://stackoverflow.com/q/24516880

http://stackoverflow.com/comment/37969251
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24522458
has text: I am only drawing things to the screen so that they look rotated, the image files themselves are not rotated, so scaling in a negative direction won't work. (I believe)

http://stackoverflow.com/q/24511380
has title: Map a image file through Spring controller
upvote count: 2
has answer: http://stackoverflow.com/a/28121275
tagged with: spring
has body: Is there any way to map a image file using a spring controller? In my spring application, I want store the images in the directory src/main/resources (i'm using maven) and access them with a method like this: @RequestMapping(value="image/{theString}") public ModelAndView image(@PathVariable String theString) { return new ModelAndView('what should be placed here?'); } the string theString it's the image name (without extension). With this approach, I should be able to access my images this way: /webapp/controller_mapping/image/image_name Anyone can point a direction to do that?
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/28121275
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24514683
accepted answer: http://stackoverflow.com/a/24514683
answer count: 2
has comment: http://stackoverflow.com/comment/37948689
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37951921

http://stackoverflow.com/q/24488586
has comment: http://stackoverflow.com/comment/37907192
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37907181
has comment: http://stackoverflow.com/comment/37907105
has comment: http://stackoverflow.com/comment/37911254
has answer: http://stackoverflow.com/a/24488895
has comment: http://stackoverflow.com/comment/37907155
tagged with: android
has title: Android how to speed up reading from a file to create Java objects using Buffered Input/Output?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24490756
linked to: http://stackoverflow.com/q/4504291
tagged with: java
has answer: http://stackoverflow.com/a/24490756
type: Question
accepted answer: http://stackoverflow.com/a/24488895
has comment: http://stackoverflow.com/comment/37907041
has body: I have this method that takes a json file from storage and turns it into a bunch of java objects. How do I add bufferred output/input streams in order to speed it up? Or is there another way to optimize the speed? EDIT: Im not only going to use this for reading from JSON files, so I dont need json to java parsers, I actually need to speed up file oprations using buffers :) public static ArrayList&lt;String&gt; convertJSONtoArrayList(File jsonStrings) { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(jsonStrings); } catch (FileNotFoundException e1) { e1.printStackTrace(); } return convertJSONtoArrayList(fileInputStream); } public static ArrayList&lt;String&gt; convertJSONtoArrayList(InputStream fileInputStream) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ArrayList&lt;String&gt; arrayListString = new ArrayList&lt;String&gt;(); int ctr; try { if (fileInputStream != null) { ctr = fileInputStream.read(); while (ctr != -1) { byteArrayOutputStream.write(ctr); ctr = fileInputStream.read(); } } fileInputStream.close(); } catch (IOException e) { e.printStackTrace(); } try { // Parse the data into jsonobject to get original data in form of // json. JSONArray jsonArray = new JSONArray(byteArrayOutputStream.toString()); int arrayLength = jsonArray.length(); for (int i = 0; i &lt; arrayLength; i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); arrayListString.add(jsonObject.getString(Tags.VALUE)); } } catch (Exception e) { e.printStackTrace(); } return arrayListString; } My idea for this being possible comes from here: How to speed up unzipping time in Java / Android? - in the answers becomes clear that if BufferedInputStream is added, the operation is sped up really good.
has comment: http://stackoverflow.com/comment/37907224

http://stackoverflow.com/a/24559466
answers question: http://stackoverflow.com/q/24549046
score: 0
type: Answer
has body: They don't have an XPCOM module to talk to erlang. If you want, you can make a DLL for windows (and etc for other OS) then use js-ctypes to talk to your DLL to talk to erlang. Do you know how to make DLL?

http://stackoverflow.com/q/24520879
has comment: http://stackoverflow.com/comment/37966616
type: UnansweredQuestion
answer count: 0
has title: Does full GC imply runFinalization()
tagged with: java
tagged with: garbage-collection
type: Question
has comment: http://stackoverflow.com/comment/37966432
has comment: http://stackoverflow.com/comment/37966386
has comment: http://stackoverflow.com/comment/37966677
has comment: http://stackoverflow.com/comment/37966330
has body: I need to take a clean live object heap dump. I'm currently using the HotSpotDiagnosticMXBean to take the heap dump: final String DIAGNOSTIC_MBEAN_NAME = "com.sun.management:type=HotSpotDiagnostic"; final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); diagnosticMBean = ManagementFactory.newPlatformMXBeanProxy(server, DIAGNOSTIC_MBEAN_NAME, HotSpotDiagnosticMXBean.class); diagnosticMBean.dumpHeap(fileName, true); This method takes only live objects by invoking a full GC first. However, occasionally, when I analyze the heap dump in YourKit, I notice a lot of unreachable java.lang.Object have "Pending Finalization" annotation. I do not want them to be shown in the heap dump. My question is, should I explicitly call System.runFinalization() before diagnosticMBean.dumpHeap(fileName, true), or the full GC already implies that? In the latter case, how do I know if all unreachable objects have been finalized? Sleeping for 10 seconds suffices? Thanks!
score: 0

http://stackoverflow.com/q/24443219
has body: This is a completely newbie question from a Java programmer trying to learn Erlang. What's the equivalent of a Java JAR file in Erlang by which 3'rd party libraries can be included in an Erlang application? The other day I made a copy of the mochijson2.erl in my project and it worked, but I am wondering if there's a better/more formal way of discovering and including libraries in the Erlang world.
favorite count: 0
has comment: http://stackoverflow.com/comment/37822552
has answer: http://stackoverflow.com/a/24451486
type: UnansweredQuestion
upvote count: 5
tagged with: java
tagged with: erlang
type: Question
score: 5
answer count: 1
downvote count: 0
tagged with: jar
has title: Equivalent of Java JAR files in Erlang

http://stackoverflow.com/q/24526583
has answer: http://stackoverflow.com/a/24526847
answer count: 4
tagged with: jvm
favorite count: 0
has title: what exactly happen in jvm when i create an object in java?
upvote count: 2
has answer: http://stackoverflow.com/a/24526662
has answer: http://stackoverflow.com/a/24526835
tagged with: pass-by-reference
possible better answer: http://stackoverflow.com/a/24526662
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24526701
accepted answer: http://stackoverflow.com/a/24526835
tagged with: java
type: Question
score: 2
has comment: http://stackoverflow.com/comment/37976742
downvote count: 0
tagged with: call-by-value
has body: To my understanding if i am writing Car a3=new Car() This statement will create a handle named a3 in jvm stack with all its properties in JVM heap. IF this is correct i am wondering how call by value works. So, if i create a method checkMethod(Car c) and call it by saying checkMethod(a3); suppose our car is public class Car{ int a=0; public int getpar(){ return a; } } in checkMethod i try to access a using a3.a = 5; so i changed the value of a3.a it will show me in the calling class as well as it was pointing to the same fields that jvm created in the heap. But when i do a3= null; in the calling method and go back again in the method from which i was calling checkMethod(a3) and try to see this object it is not null? Why it behaved differently as compared to property of object that is a???

http://stackoverflow.com/comment/37805096
comment on: http://stackoverflow.com/a/24433334
type: AnswerComment
score: 0
has text: Good suggestion, I thought of using left and right hashcodes too, but didn't know how to use them best way. Anyway I'll better stick to native java implementation.
type: Comment

http://stackoverflow.com/q/24466620
has title: How can I wait for a constructor to finish before moving on in Java?
linked to: http://stackoverflow.com/q/20423980
has comment: http://stackoverflow.com/comment/37865771
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37875701
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/37865587
tagged with: java
has body: In my program, I am calling a constructor for a JFrame and several components and immediately afterwards, I am calling a method doing heavy computing and locking the CPU for several seconds. Because of this and because both the JFrame and that method are in the same Thread, the JFrame will not composite properly until after the method is finished. Window window = new Window(); //Window extends JFrame and adds several components to it calculatePiOrWhatever();
linked to: http://stackoverflow.com/q/940913
has comment: http://stackoverflow.com/comment/37866089
duplicate of: http://stackoverflow.com/q/940913
has comment: http://stackoverflow.com/comment/37866090
has comment: http://stackoverflow.com/comment/37865941

http://stackoverflow.com/a/24597213
has comment: http://stackoverflow.com/comment/38146180
upvote count: 1
type: Answer
downvote count: 0
has body: Sometimes MediaPlayer objects have to be declared as a public variable or they will be deleted by the Dalvik Heap. public final MediaPlayer mediaPlayer = new MediaPlayer();
score: 1
answers question: http://stackoverflow.com/q/24496671

http://stackoverflow.com/comment/38134207
score: 0
type: Comment
has text: What is not clear for me is the link between the first sentence (However, these treatments, if they are executed in the same thread, can participate in the same transaction as that of the sender) and the second sentence (This means that if treatments listeners are only operations database, they will also be transactional).
type: AnswerComment
comment on: http://stackoverflow.com/a/24574719

http://stackoverflow.com/q/24441831
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/24441874
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/338206
has comment: http://stackoverflow.com/comment/37864772
has title: My expression is illegal and I don't know why
type: UnansweredQuestion
has body: When I compile this line 74 comes up as an illegal start of expression, why is this? I have been utterly unable to figure this out and any help would be greatly appreciated Thank you. import java.awt.*; import javax.swing.*; public class NumericKeypadPanel2 extends JPanel { public NumericKeypadPanel2() { String num = " "; JPanel panel_main = new JPanel(); panel_main.setLayout(new BorderLayout()); JPanel keypad = new JPanel(); keypad.setLayout(new GridLayout (4, 3)); keypad.setBorder (BorderFactory.createLineBorder (Color.black, 3)); JButton b1 = new JButton ("1"); JButton b2 = new JButton ("2"); JButton b3 = new JButton ("3"); JButton b4 = new JButton ("4"); JButton b5 = new JButton ("5"); JButton b6 = new JButton ("6"); JButton b7 = new JButton ("7"); JButton b8 = new JButton ("8"); JButton b9 = new JButton ("9"); JButton b10 = new JButton ("*"); JButton b11 = new JButton ("0"); JButton b12 = new JButton ("#"); NumListener listener = new NumListener(); b1.addActionListener (listener); keypad.add (b1); keypad.add (b2); keypad.add (b3); keypad.add (b4); keypad.add (b5); keypad.add (b6); keypad.add (b7); keypad.add (b8); keypad.add (b9); keypad.add (b10); keypad.add (b11); keypad.add (b12); panel_main.add(keypad, BorderLayout.CENTER); JButton clear = new JButton ("Clear"); JLabel display = new JLabel(num); panel_main.add(clear, BorderLayout.SOUTH); panel_main.add(display, BorderLayout.NORTH); display.setBorder (BorderFactory.createLineBorder (Color.black, 3)); add(panel_main); private class NumListener implements ActionListener { public void actionPerformed (ActionEvent event) { Object source = event.getSource(); switch (source) { case b1: display.setText(display.getText()+"1"); break; case b2: display.setText(display.getText()+"2"); break; case b3: display.setText(display.getText()+"3"); break; case b4: display.setText(display.getText()+"4"); break; case b5: display.setText(display.getText()+"5"); break; case b6: display.setText(display.getText()+"6"); break; case b7…
has answer: http://stackoverflow.com/a/24441977
tagged with: syntax
tagged with: expression
tagged with: java

http://stackoverflow.com/a/24585271
has comment: http://stackoverflow.com/comment/38086688
has body: Not sure why you don't use List&lt;E&gt; instead of Vector&lt;E&gt;, anyway it's as simple as: Vector&lt;Vector&lt;Float&gt;&gt; data = new Vector&lt;&gt;(); for (int rowIdx = 0; rowIdx &lt; ROWS_COUNT; rowIdx++) { Vector&lt;Float&gt; row = new Vector&lt;&gt;(); data.add(row); for (int colIdx = 0; colIdx &lt; COL_COUNTS; colIdx++) { row.add(1.0f); } } And then you can access an element with float val = data.get(row).get(col); Note that if it's for a program where performance matter, and especially if the wrapped time is a primitve (float), you'd better use a plain array.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38086570
has comment: http://stackoverflow.com/comment/38087042
type: Answer
answers question: http://stackoverflow.com/q/24585223
accepted answer of: http://stackoverflow.com/q/24585223
has comment: http://stackoverflow.com/comment/38086361
has comment: http://stackoverflow.com/comment/38086428

http://stackoverflow.com/q/24473479
score: -2
has comment: http://stackoverflow.com/comment/37878619
has comment: http://stackoverflow.com/comment/37880762
has body: I have a big doubt. How I can save the data of an XML file to a list or array in JAVA? It's a school project, I can not use special libraries like JDOM or JParser etc. If only you could help me with the idea on saving would appreciate it very much. I was using indexOf and lastIndexOf. Also how I can convert XML files to JSON or JSON to XML? No special libraries.
accepted answer: http://stackoverflow.com/a/24473518
has comment: http://stackoverflow.com/comment/37933683
downvote count: 4
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37878650
has comment: http://stackoverflow.com/comment/37878663
has comment: http://stackoverflow.com/comment/37878579
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24473518
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How I can convert XML to JSON? without special libraries. >JAVA
type: Question

http://stackoverflow.com/comment/37935580
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24488006
type: AnswerComment
has text: Can u please send some SSCCE for doing this (setting param/property) and using them?

http://stackoverflow.com/q/24438714
accepted answer: http://stackoverflow.com/a/24438790
has body: How can I format a string phone number to remove special characters and spaces? The number is formatted like this (123) 123 1111 I am trying to make it look like this: 1231231111 So far I have this: phone = phone.replaceAll("\\s",""); phone = phone.replaceAll("(",""); The first line will remove the spaces. Then I am having trouble removing the parentheses. Android studio underlines the "(" and throws the error unclosed group.
tagged with: java
tagged with: replace
upvote count: 4
answer count: 4
type: AnsweredQuestion
downvote count: 0
has title: Remove spaces and special characters from string
tagged with: string
possible better answer: http://stackoverflow.com/a/24438766
type: Question
has answer: http://stackoverflow.com/a/24438900
tagged with: android
has answer: http://stackoverflow.com/a/24438766
tagged with: regex
favorite count: 0
score: 4
has answer: http://stackoverflow.com/a/24438739
has answer: http://stackoverflow.com/a/24438790

http://stackoverflow.com/a/24540865
has body: I think the main issue you're having is that your Views aren't inflated and don't have any sizes yet so your "scrollTo" is always going to be 0. First, you need to wait until the ScrollView and it's contents are inflated. The next thing is you can't use the ScrollView's width because it's the size of the screen. You need to use the child's with (carousel) which is unbound (alternatively you may be able to use getMaxScrollAmount()). The easiest thing to do is post a Runnable to it like so: private class ScrollToCenter implements Runnable { @Override public void run() { hsv.scrollTo(carousel.getWidth()/2, 0); } } hsv.post(new ScrollToCenter()); Posting to a View will wait until the View is visible before doing executing. If the View is already visible, then it will execute almost immediately.
has comment: http://stackoverflow.com/comment/38005615
downvote count: 0
has comment: http://stackoverflow.com/comment/38004307
has comment: http://stackoverflow.com/comment/38004250
has comment: http://stackoverflow.com/comment/38004794
has comment: http://stackoverflow.com/comment/38004163
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24540666
score: 2
has comment: http://stackoverflow.com/comment/38004841
has comment: http://stackoverflow.com/comment/38005182
has comment: http://stackoverflow.com/comment/38004362

http://stackoverflow.com/comment/37989264
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24533163
type: Comment
has text: this looks very promising! I'll try it tomorrow - if I run into any problems, I'll comment again. Thanks!

http://stackoverflow.com/comment/37860403
has text: All down voters provide him solution for that. He started learning of java. Running first program is tuff for him as similar your tuffest task
comment on: http://stackoverflow.com/q/24463523
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24496405
has comment: http://stackoverflow.com/comment/37921962
has comment: http://stackoverflow.com/comment/37922073
has answer: http://stackoverflow.com/a/24498219
favorite count: 0
has body: I have these Base64 in a text file: [binary] I need to be able to take those base 64 charecters from the text file and output a new XML File. Currently, the InputStream is not being correctly converted to base 64 public static void main(String[] args) { try { File file = new File("C:\\Users\\khurt\\Desktop\\xml.txt"); InputStream myScan = new FileInputStream(file); byte[] b = new byte[(int)file.length()]; myScan.read(b); String cowo = myScan.toString(); String decoded = DatatypeConverter.printBase64Binary(b); String cat = b.toString(); System.out.println(decoded); byte[] bArray = cat.getBytes(); OutputStream out = new FileOutputStream("C:\\Users\\gdfurt\\Desktop\\cow.xml"); out.write(b); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } I used the System.out.println(decode); to check to see if the charecters matched the ones in the file and they do not. I can't figure out why, I have tried using a scanner and that throws it off more.
has comment: http://stackoverflow.com/comment/37921760
answer count: 2
accepted answer: http://stackoverflow.com/a/24496859
possible better answer: http://stackoverflow.com/a/24498219
upvote count: 1
has comment: http://stackoverflow.com/comment/37924191
has comment: http://stackoverflow.com/comment/37928244
score: 0
tagged with: java
tagged with: inputstream
downvote count: 1
tagged with: fileinputstream
tagged with: arrays
has comment: http://stackoverflow.com/comment/37921991
has answer: http://stackoverflow.com/a/24496859
has comment: http://stackoverflow.com/comment/37921880
has comment: http://stackoverflow.com/comment/37921841
has title: how to convert text file of base64 into xml file(or any other type of file)
tagged with: byte
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/37850625
score: 0
has text: We cannot see your set-up -- we don't know what the images are or where they are or what format they are. Please provide more information on image / photo array. We are willing to help, but as such, in the dark.
type: QuestionComment
comment on: http://stackoverflow.com/q/24458299
type: Comment

http://stackoverflow.com/comment/38025890
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24552723
has text: If the number of set is always know (3 in your question), you could simply do it with 3 nested for loops.
score: 0

http://stackoverflow.com/q/24460302
tagged with: string
has title: Why is this equality to another object check in String.java?
has comment: http://stackoverflow.com/comment/37853836
has comment: http://stackoverflow.com/comment/37853867
has comment: http://stackoverflow.com/comment/37854112
has answer: http://stackoverflow.com/a/24460318
has answer: http://stackoverflow.com/a/24461084
answer count: 3
has answer: http://stackoverflow.com/a/24460355
has body: In String.java, this code is at the beginning of the .equals() method: public boolean equals(Object anObject) { if (this == anObject) { return true; } // ... check if instance of String, etc. } Is this check purely for performance reasons (i.e. not including it will check the characters of this against itself)?
favorite count: 0
has comment: http://stackoverflow.com/comment/37855543
has comment: http://stackoverflow.com/comment/37857318
upvote count: 2
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24460355
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24460318
has comment: http://stackoverflow.com/comment/37854013
downvote count: 0

http://stackoverflow.com/comment/37825224
type: QuestionComment
type: Comment
has text: Yes,by mistake i wrote static in the set method! set is a non-static method!
score: 0
comment on: http://stackoverflow.com/q/24432620

http://stackoverflow.com/comment/37922860
score: 0
type: Comment
type: QuestionComment
has text: "check if the player collides with any of them" yes, and HOW to do THIS, was the actual question xD
comment on: http://stackoverflow.com/q/24439040

http://stackoverflow.com/a/24543293
type: Answer
accepted answer of: http://stackoverflow.com/q/24543250
has comment: http://stackoverflow.com/comment/105729708
answers question: http://stackoverflow.com/q/24543250
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/105728177
has comment: http://stackoverflow.com/comment/38010179
has comment: http://stackoverflow.com/comment/38008804
has comment: http://stackoverflow.com/comment/105697580
type: AcceptedAnswer
has body: You can achieve this by extending Spinner and overriding methods that are responsible for setup and showing the list of values in the drop down: public class CustomSpinner extends Spinner { private boolean mToggleFlag = true; public CustomSpinner(Context context, AttributeSet attrs, int defStyle, int mode) { super(context, attrs, defStyle, mode); } public CustomSpinner(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomSpinner(Context context, AttributeSet attrs) { super(context, attrs); } public CustomSpinner(Context context, int mode) { super(context, mode); } public CustomSpinner(Context context) { super(context); } @Override public int getSelectedItemPosition() { if (!mToggleFlag) { return 0; // Gets to the first element } return super.getSelectedItemPosition(); } @Override public boolean performClick() { mToggleFlag = false; boolean result = super.performClick(); mToggleFlag = true; return result; } }
downvote count: 0

http://stackoverflow.com/comment/115034186
comment on: http://stackoverflow.com/a/54209442
score: 1
type: AnswerComment
type: Comment
has text: It's `http` by default on my Jenkins v2.249.3 here but it doesn't work.

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24547335

http://stackoverflow.com/a/24453553
type: Answer
answers question: http://stackoverflow.com/q/24453376
has body: Try file:///FederationMetadata.xml instead of classpath:FederationMetadata.xml
score: 0

http://stackoverflow.com/comment/37869556
type: Comment
has text: The other post's file has contents that are viewable too. At this point I believe the problem is in the `EOF` (end of file). Somehow I think it is in a corrupted state causing issues.
score: 1
comment on: http://stackoverflow.com/a/24464369
type: AnswerComment

http://stackoverflow.com/q/24455144
tagged with: java
has comment: http://stackoverflow.com/comment/37847919
has comment: http://stackoverflow.com/comment/37847370
type: Question
has comment: http://stackoverflow.com/comment/37865537
has comment: http://stackoverflow.com/comment/37847786
score: 0
has comment: http://stackoverflow.com/comment/37847561
has comment: http://stackoverflow.com/comment/37844405
has comment: http://stackoverflow.com/comment/37847155
tagged with: serialization
has comment: http://stackoverflow.com/comment/40496279
has title: If serialver outputs a serialVersionUID, then all is well?
answer count: 0
has comment: http://stackoverflow.com/comment/37847283
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37863032
has body: If I run serialver on a class and it outputs a serialVersionUID, does that necessarily and automatically mean that all is well, that the class is truly serializable, that I don't have to check anything else?

http://stackoverflow.com/q/24444028
score: 0
tagged with: android
has title: I am trying to build a sample App from a Third Party SDK. I am getting a class not found exception and I am not able to figure out why?
has comment: http://stackoverflow.com/comment/37823961
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37825340
type: Question
linked to: http://stackoverflow.com/q/21896990
tagged with: java
has body: Below is my logcat : 06-26 21:31:41.352: D/AndroidRuntime(9911): Shutting down VM 06-26 21:31:41.352: W/dalvikvm(9911): threadid=1: thread exiting with uncaught exception (group=0x4114b930) 06-26 21:31:41.372: E/AndroidRuntime(9911): FATAL EXCEPTION: main 06-26 21:31:41.372: E/AndroidRuntime(9911): java.lang.RuntimeException: Unable to instantiate application com.counterpath.sdkdemo.audiocall.PhoneApp: java.lang.ClassNotFoundException: Didn't find class "com.counterpath.sdkdemo.audiocall.PhoneApp" on path: /data/app/com.counterpath.sdkdemo.audiocall-1.apk 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.app.LoadedApk.makeApplication(LoadedApk.java:504) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.app.ActivityThread.access$1300(ActivityThread.java:141) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.os.Handler.dispatchMessage(Handler.java:99) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.os.Looper.loop(Looper.java:137) 06-26 21:31:41.372: E/AndroidRuntime(9911): at android.app.ActivityThread.main(ActivityThread.java:5039) 06-26 21:31:41.372: E/AndroidRuntime(9911): at java.lang.reflect.Method.invokeNative(Native Method) 06-26 21:31:41.372: E/AndroidRuntime(9911): at java.lang.reflect.Method.invoke(Method.java:511) 06-26 21:31:41.372: E/AndroidRuntime(9911): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 06-26 21:31:41.372: E/AndroidRuntime(9911): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 06-26 21:31:41.372: E/AndroidRuntime(9911): at dalvik.system.NativeStart.main(Native Method) 06-26 21:31:41.372: E/AndroidRuntime(9911): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.counterpath.sdkdemo.audiocall.PhoneApp" on path: /data/ap…

http://stackoverflow.com/q/24491060
has answer: http://stackoverflow.com/a/24491238
has comment: http://stackoverflow.com/comment/37912678
tagged with: java
has comment: http://stackoverflow.com/comment/37912718
has answer: http://stackoverflow.com/a/24492038
type: Question
has answer: http://stackoverflow.com/a/24491120
has title: Why am I getting the wrong output?
has answer: http://stackoverflow.com/a/24492016
tagged with: eclipse
score: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24491133
has body: I wrote this program to exchange first and last characters in a string. I created two classes (abc and BackFront). There are no errors in Eclipse but I do not get any output. When I click run I get output of some other class. What am I doing wrong? Class abc with main: package puneeth; import java.lang.*; public class abc { public void main(String[] args) { BackFront object1 = new BackFront(); String str = "chocolate"; object1.frontBack(str); } } Class BackFront: package puneeth; import java.lang.*; public class BackFront { public String frontBack(String str) { String mid = str.substring(1,str.length()); String first = str.substring(0,3); String last = str.substring(str.length()); return last + mid + first; } }

text
tags question: http://stackoverflow.com/q/24521830
tags question: http://stackoverflow.com/q/24473427
tags question: http://stackoverflow.com/q/24442086
tags question: http://stackoverflow.com/q/24501042
type: Tag
tags question: http://stackoverflow.com/q/24431269
tags question: http://stackoverflow.com/q/24477491
tags question: http://stackoverflow.com/q/24575353
tags question: http://stackoverflow.com/q/24582595
tags question: http://stackoverflow.com/q/24557584
tags question: http://stackoverflow.com/q/24558674
tag name: text

http://stackoverflow.com/comment/37868866
has text: Why don't you just invert the rule from `c` to `a` ("multiply `a` by 200" instead of "divide `c` by 200"). That involves fewer steps.
score: 0
comment on: http://stackoverflow.com/q/24468242
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37908721
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24489163
type: Comment
has text: I gone through link you gave, and they said no implementation for that method,Anyways appreciate your help Jens

http://stackoverflow.com/a/24457687
score: 174
accepted answer of: http://stackoverflow.com/q/24441411
has comment: http://stackoverflow.com/comment/58601295
has comment: http://stackoverflow.com/comment/108959965
answers question: http://stackoverflow.com/q/24441411
has body: This method name should do the trick: Page&lt;QueuedBook&gt; findByBookIdRegion(Region region, Pageable pageable); More info on that in the section about query derivation of the reference docs.
has comment: http://stackoverflow.com/comment/118428763
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/89804912
downvote count: 0
upvote count: 174
type: Answer

http://stackoverflow.com/a/24502940
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37934601
has comment: http://stackoverflow.com/comment/37934543
has body: "No dummy variables" sounds like a recursive solution is sought. Is this a Scheme class? Here's a Perl solution. C++11 is sufficiently high-level to provide most of the facilities demonstrated here: my @tests = ( '010.011.100.000.111', '010.011.100.000.111.001.011.000.101.110' ); foreach ( @tests ) { print "$_ =&gt; ", rotate($_), "\n"; # Call our rotate routine, and show results. } sub rotate { # Split the string into components, reverse their order, join them with '.' return join('.', reverse split /(?:^|\.)000(?:\.|$)/, shift); } No dummy variables. In fact, no explicit variables either. Here's how the split regex works: (?:^|\.) # Match either start of string, or a dot. 000 # Match three zeros. (?:\.|$) # Match either a dot, or the end of string. This permits the 000 to appear anywhere in the string (including beginning or end). If it appears at the beginning, there will not need to be a leading dot. If it appears at the end, a trailing dot will not be required. Anywhere else, dots must surround the 000. Update: Here is a recursive solution using Perl. From what I've read of the Java solutions (I'm not a Java guy), it seems like translation should be straightforward for someone with some Java background. my @tests = ( '010.011.100.000.111', '010.011.100.000.111.001.011.000.101.110' ); foreach ( @tests ) { print "($_) =&gt; (", rotate($_), ")\n"; } sub rotate { my( $ok, $rest ) = split /(?:^|\.)000(?:\.|$)/, $_[0], 2; return $ok unless defined $rest; return join( '.', rotate($rest), $ok); } Update2: And here's another Perl solution that eliminates any explicit variables, using only subroutine parameters: my @tests = ( '010.011.100.000.111', '010.011.100.000.111.001.011.000.101.110' ); foreach ( @tests ) { print "($_) =&gt; (", rotate($_), ")\n"; } sub rotate { return sub { return $_[0] unless defined $_[1]; return join( '.', rotate($_[1]), $_[0]); }-&gt;( split /(?:^|\.)000(?:\.|$)/, shift, 2 ); } I have no idea how one would translate that Java. I suspect transl…
answers question: http://stackoverflow.com/q/24502811

http://stackoverflow.com/comment/37827700
has text: Yes, that post solved my problem. Sorry for duplicate :)
comment on: http://stackoverflow.com/q/24445923
score: 0
type: Comment
type: QuestionComment

wait
tags question: http://stackoverflow.com/q/24535720
tag name: wait
type: Tag
tags question: http://stackoverflow.com/q/24523650
tags question: http://stackoverflow.com/q/24517891

http://stackoverflow.com/q/24484185
has comment: http://stackoverflow.com/comment/37899119
has comment: http://stackoverflow.com/comment/37899258
has title: Sorting based on compareTo() in SortedSet
upvote count: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37899138
favorite count: 0
linked to: http://stackoverflow.com/q/11068350
has body: Hi this is a question that I found from a book. I am not exactly clear with thing happens in compareTo() method. Tree set is a sorted class. So does it always call to compareTo()? And inside compareTo() how does sorting is done based on, return age-((Person)0).age ? package javaapplication1; import java.util.NavigableSet; import java.util.SortedSet; import java.util.TreeSet; public class _157 { public static void main(String args[]){ NavigableSet s=new TreeSet(); for(int i=50;i&lt;55;++i){ s.add(new Person(i)); } SortedSet s2=s.tailSet(new Person(52)); System.out.println(s2); } } class Person implements Comparable{ private int age; @Override public int compareTo(Object t) { return ((Person)t).age-age; } Person(int age){ this.age=age; } public String toString(){ return "Person("+age+")"; } }
accepted answer: http://stackoverflow.com/a/24484342
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24484342
has comment: http://stackoverflow.com/comment/37899325
tagged with: java
has comment: http://stackoverflow.com/comment/37899127
type: Question

http://stackoverflow.com/q/24555525
type: Question
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/24555677
has body: I am trying to understand volatile usage by the below example. I expect it to print 10 first and then 15 second. But most of the time i end getting 10 and 10. Is some thing with the below code itself. class T implements Runnable { private volatile int x = 10; @Override public void run() { if(x==10) { System.out.println(x); x = x+ 5; } else if(x==15) { System.out.println(x); } } } public class Prep { public static void main(String [] args) { T t1 = new T(); new Thread(t1).start(); new Thread(t1).start(); } }
tagged with: volatile
downvote count: 0
favorite count: 0
has title: Java Volatile Variable
possible better answer: http://stackoverflow.com/a/24555763
has answer: http://stackoverflow.com/a/24555763
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/24555677

http://stackoverflow.com/a/24650401
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42699146
has comment: http://stackoverflow.com/comment/42699101
has comment: http://stackoverflow.com/comment/38213608
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24450540
answers question: http://stackoverflow.com/q/24450540
type: Answer
has body: Finally I got it resolved after much fight. Problem is newHadoopAPI requires a class which extends org.apache.hadoop.mapreduce.InputFormat and org.apache.cassandra.hadoop.cql3.CqlInputFormat does not extend InputFormat directly, instead it extends org.apache.cassandra.hadoop.AbstractColumnFamilyInputFormat which in turn extends InputFormat. Eclipse uses groovy compiler which is smart enough to resolve this but Java's default compiler is unable to resolve this. Also Groovy compiler resolves K,V values properly which java compiler finds incompatible. You need to add following changes to pom.xml file to use groovy compiler: 1.8.6 <maven-comipler-plugin-version>2.5.1</maven-comipler-plugin-version> <groovy-eclipse-compiler-version>2.7.0-01</groovy-eclipse-compiler-version> <maven-clover2-plugin-version>3.1.7</maven-clover2-plugin-version> <groovy-eclipse-batch-version>1.8.6-01</groovy-eclipse-batch-version> Add groovy as a dependency org.codehaus.groovy groovy-all ${groovy-version} Add grovvy plugin under build to use it as compiler for our code org.apache.maven.plugins maven-compiler-plugin ${maven-comipler-plugin-version} groovy-eclipse-compiler ${jdk-version} ${jdk-version} org.codehaus.groovy groovy-eclipse-batch ${groovy-eclipse-batch-version} org.codehaus.groovy groovy-eclipse-compiler ${groovy-eclipse-compiler-version} org.codehaus.groovy groovy-eclipse-compiler ${groovy-eclipse-compiler-version} true com.atlassian.maven.plugins maven-clover2-plugin ${maven-clover2-plugin-version} true .cloverhistory This should solve it.
has comment: http://stackoverflow.com/comment/42699164

http://stackoverflow.com/comment/38033926
type: QuestionComment
comment on: http://stackoverflow.com/q/24556601
score: 0
has text: I hate that about Java.
type: Comment

http://stackoverflow.com/comment/37897432
type: Comment
type: QuestionComment
has text: *Why* is the ResultSet-derived object of type Integer while the target field is of type Long? (NB I suspect it's actually the other way around.) The ***real*** solution here is to make sure your Java and SQL data models match.
comment on: http://stackoverflow.com/q/24483176
score: 0

http://stackoverflow.com/a/24474109
score: 2
has comment: http://stackoverflow.com/comment/37879912
has comment: http://stackoverflow.com/comment/37880172
has comment: http://stackoverflow.com/comment/37880030
has comment: http://stackoverflow.com/comment/37879975
has comment: http://stackoverflow.com/comment/37879803
accepted answer of: http://stackoverflow.com/q/24473999
has comment: http://stackoverflow.com/comment/37879813
downvote count: 0
answers question: http://stackoverflow.com/q/24473999
has body: You are putting all the values from first to output by passing it to the constructor. Map&lt;String, Integer&gt; output = new HashMap&lt;String, Integer&gt;(first); // you are passing first to the constructor. You don't need to create another Set, keySet() method returns set so the below lines not required. Set&lt;String&gt; keyFirst = new HashSet&lt;String&gt;(); // stores all the keys for first for (String key: first.keySet()) { // goes through each key in input keyFirst.add(key); // adds all keys from first into keyFirst } Here's the correct implemetataion. // we need to store the keys, then get the values in common, then put the key/map into map public static Map&lt;String, Integer&gt; intersect(Map&lt;String, Integer&gt; first, Map&lt;String, Integer&gt; second) { Map&lt;String, Integer&gt; output = new HashMap&lt;String, Integer&gt;(); // combined output // goes through each key in common and checks to see if they reference to the same value Iterator&lt;String&gt; keyFirstItr = first.keySet().iterator(); while (keyFirstItr.hasNext()) { String keyTemp = keyFirstItr.next(); if (first.get(keyTemp).equals(second.get(keyTemp))) { // If same key, same value mapped output.put(keyTemp, first.get(keyTemp)); // add key value to map } } return output; }
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/comment/37887512
type: QuestionComment
comment on: http://stackoverflow.com/q/24478068
has text: Try disabling your software firewall on the Ubuntu system temporarily.
score: 0
type: Comment

http://stackoverflow.com/q/24559415
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38038959
has answer: http://stackoverflow.com/a/24559566
has comment: http://stackoverflow.com/comment/38038517
has title: Error with declaring a variable?
has body: I am probably just being stupid, but I am attempting to create a variable and am getting this error: Syntax error on token "continue", invalid VariableDeclaratorId The line of code is static boolean continue = false; For some reason if I change the variable name it seems to work, however I would really prefer to use the variable name "continue" because it is easier to remember than "cont" or any other variation, which is important to me. So, is there any way that I can declare this variable?
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24559444
has answer: http://stackoverflow.com/a/24559433
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24436661
has comment: http://stackoverflow.com/comment/37810209
has comment: http://stackoverflow.com/comment/37810044
upvote count: 2
has comment: http://stackoverflow.com/comment/37810533
downvote count: 0
has comment: http://stackoverflow.com/comment/37810109
has comment: http://stackoverflow.com/comment/37810265
has comment: http://stackoverflow.com/comment/37810844
has body: So, firstly, controller will always be null in onCreate(). The reason you're seeing controller as null in the child activity is because you're logging it's value before you're calling super.onCreate() (which calls the parent's onCreate() and initializes the controller).
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24436466
has comment: http://stackoverflow.com/comment/37810427

http://stackoverflow.com/comment/37960598
comment on: http://stackoverflow.com/q/24511068
has text: You understand there is no standard "calendar date picker", right? There are like thousands of implementations. You need to post a link to the site you are testing. Also some code to show what have you tried so far.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37866185
comment on: http://stackoverflow.com/a/24466679
type: AnswerComment
score: 0
has text: How i can get the last output of absent,present and pending.
type: Comment

http://stackoverflow.com/q/24506426
has comment: http://stackoverflow.com/comment/37940590
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24509504
has comment: http://stackoverflow.com/comment/37940309
favorite count: 0
type: UnansweredQuestion
tagged with: wicket
has body: I'm trying to refresh a DataView thanks to onSubmit function in ajaxButton. I create a form with two DropDownChoice and an AjaxButton. When i click on ajaxButton in the onSubmit function i call DAO function and i would like to replace my ListDataProvider, which was null before, with the new list from DAO. final private WebMarkupContainer wmc = new WebMarkupContainer("wmc"); private ListDataProvider<ComparePhoto> dataP = new ListDataProvider<ComparePhoto>(); dataView = (DataView<ComparePhoto>)new DataView<ComparePhoto>("vcomponents", dataP){ private static final long serialVersionUID = 1L; @Override protected void populateItem(final Item<ComparePhoto> item) { ComparePhoto c = item.getModelObject(); System.out.println("idCarto : "+c.getIdCarto()); RepeatingView repeatingView = new RepeatingView("dataRow"); repeatingView.add(new Label(repeatingView.newChildId(), c.getIdCarto())); [...] item.add(repeatingView); } }; dataView.setOutputMarkupId(true); wmc.setOutputMarkupId(true); wmc.add(dataView); add(wmc); AjaxButton b = new AjaxButton("btnSubmit") { protected void onSubmit(AjaxRequestTarget target, Form<?> form) { dataP = new ListDataProvider<ComparePhoto>(lstComparePhoto); target.add(wmc); } } form.add(b); add(form); my HTML code : compare id id Absolutely Nothing happen... thanks for your help
has title: WICKET - DataView refresh with ajaxButton
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: refresh

http://stackoverflow.com/comment/38056014
has text: Using `setContentView()` multiple times is not the best idea but well android doesnt stop you from doing so ;)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24568614

http://stackoverflow.com/q/24465746
tagged with: java
tagged with: eclipse
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4
has body: Is it possible to automatically reload a Java AppEngine project (which uses Maven) after making changes to the code? I.e. after making a change to the code (such as a JSP) I'd like to see those changes straight away in a web browser without having to re-run the project. Is this possible? I have done the following: Created a Maven project using the Google's tutorial Imported it into Eclipse using Google's instructions. Enabled the "Build Automatically" setting on my project in Eclipse (which this article suggests is required). Run the dev server inside the ear project (mvm appengine:devserver) However, changes to JSPs aren't automatically reflected when I view the page in a web browser. I can only see the changes by installing (mvn clean install) and then re-running the dev server. Projects created using the Google Eclipse plugin reload automatically however, I'd prefer to use Maven as it'll make it easier to install other software (such as the Spring Framework).
has comment: http://stackoverflow.com/comment/49639244
has title: Automatically reload Java AppEngine Maven project after making changes
tagged with: google-app-engine
favorite count: 0
has comment: http://stackoverflow.com/comment/37869485
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/25161816

http://stackoverflow.com/comment/37891348
score: 0
comment on: http://stackoverflow.com/q/24480119
type: QuestionComment
has text: Please spell out a little clearer exactly what you're trying to do, what you've tried in code so far, etc... Have you created your own SpinnerModel one that extends AbstractSpinnerModel?
type: Comment

http://stackoverflow.com/q/24441757
type: UnansweredQuestion
tagged with: indexing
tagged with: java
tagged with: file
downvote count: 1
type: Question
has title: How to index a sequential file in java?
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/24441898
has body: I have a file and an index: for example: (the file) ----Id number 03 alex 02 juancho 01 homer ----(index) Id (It means, I've to read the file by Id, ascendant way) My question is the next one, how make an structure that index the file to read it according to the index? (or key, in this case i'd be the Id) If you can, drop some example in java. Thank you.
answer count: 1
has comment: http://stackoverflow.com/comment/37820214
favorite count: 0
tagged with: sequential

http://stackoverflow.com/comment/37938320
has text: You told that it crashed. And now it does not respond? Why not tell better what is all happening? Which protocol is used? MTP? You should really tell more about the setup.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24504193

http://stackoverflow.com/a/24472123
downvote count: 0
has body: I haven't moved over to Android Studio, yet. I've used it for a few tests and really like it. Just haven't been able to switch over yet. I've had this sort of issue in Eclipse and that's obviously a different solution, but looking through one of my test projects, this appears to be how you go about it: Open your project and go to File->Settings. Under the Project Settings, expand Compiler and go to the Java Compiler option. You want to use javac and set the project bytecode version to 1.7. Hopefully that'll do it.
type: Answer
answers question: http://stackoverflow.com/q/24472020
upvote count: 5
score: 5

http://stackoverflow.com/a/24478311
upvote count: 1
answers question: http://stackoverflow.com/q/24478027
has body: I would start by writing a routine to count the consecutive occurances of a character in the array, private static int countOccur(char[] arr, int st, int end) { final char ch = arr[st]; // 'st' is start. int count = 1; for (; count &lt; end - st; count++) { // &lt;-- don't exceed the array boundary if (ch != arr[st + count]) { // &lt;-- break if not the same character break; } } return count; // &lt;-- return the count } Next, I'd modify codieren(String) to return a String (instead of being void, make the caller display the result - e.g. separation of concerns), static String codieren(String s) { if (s == null) { // &lt;-- handle corner cases. return null; } StringBuilder sb = new StringBuilder(); // &lt;-- for building the return String. char[] a = s.toUpperCase().toCharArray(); for (int i = 0; i &lt; a.length;) { // &lt;-- we will increment by occurrences. int occur = countOccur(a, i, a.length); // &lt;-- get the occurrences count. if (occur &gt; 2) { // &lt;-- 3 or more are LETTER then COUNT. sb.append(a[i]).append(occur); } else { // &lt;-- Must be 2 or fewer. for (int t = 0; t &lt; occur; t++) { sb.append(a[i]); } } i += occur; // &lt;-- increment 'i'. } return sb.toString(); // &lt;-- return the result. }
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/37908129
type: AnswerComment
type: Comment
has text: exactly Jens, its retuning blank (empty string) for me, some guys are able to get tableName from same method, but for my side it doesnt work, Any other solution Jens?
score: 0
comment on: http://stackoverflow.com/a/24489163

http://stackoverflow.com/a/40212870
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24488825
accepted answer of: http://stackoverflow.com/q/24488825
has body: Why do you want to create new Stage? You can easily create different scenes as you need. And change the scene as you require. Try the code below Main class package application; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; public class Main extends Application { BorderPane root = new BorderPane(); Button btn=new Button("Click Here"); Stage primaryStage; Scene scene ; public Main() { btn.setPrefWidth(75); btn.setPrefHeight(15); btn.setOnAction((e)-&gt; { SubClass s=new SubClass(primaryStage); }); } @Override public void start(Stage primaryStage) { try { this.primaryStage=primaryStage; // root.getChildren().add(btn); scene = initStage(); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } } private Scene initStage() { root.setCenter(btn); return new Scene(root,150,150); } public static void main(String[] args) { launch(args); } } Sub Class package application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class SubClass { StackPane root = new StackPane(); Stage stage; public SubClass(Stage stage) { Scene scene=new Scene(root,300,300); stage.setScene(scene); stage.show(); } } I would suggest you to try changing the scene rather than the stage. All the best
upvote count: 1

http://stackoverflow.com/comment/37929906
type: Comment
has text: If you are targeting Eclipse and your file names are consistent: you could edit the `.classpath` file with something like sed to add the `sourcepath` attributes.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24500845

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/24480469
tags question: http://stackoverflow.com/q/24498739
tags question: http://stackoverflow.com/q/24482293
tags question: http://stackoverflow.com/q/24541874
tags question: http://stackoverflow.com/q/24542764
tags question: http://stackoverflow.com/q/24498011

http://stackoverflow.com/q/24437138
has body: I have a doubt in the following piece of code.although i saved the file as Newclass.java.It is not prompting me to make a public Newclass which it should since we always say the public class containing the main function should be the name of the file name. Why the converse doesnt hold? P.S. no errors in this code. works fine,output->called. I also understand that MAIN itself is a class. It has its class file in a package. abstract class Base { void fun()`{ } } class Derived extends Base { void hello() { System.out.println("derived called"); } void fun() { System.out.println(" called"); } } class MAIN { public static void main(String args[]) { Base b = new Derived(); b.fun(); } }
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24437153
tagged with: java
has title: file compilation without the existence of a class having the same name as the name of file
type: Question
tagged with: compilation
score: 0

http://stackoverflow.com/comment/37971359
comment on: http://stackoverflow.com/q/24523342
score: 0
has text: Given `Animal anInstanceOfADog = new Dog();`. The compile time type of the variable `anInstanceOfADog` is `Animal`. At run time, the run time type of the object referenced by the variable `anInstanceOfADog` is `Dog`.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24548931
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: The problem is that you are instantiating PersonBaseDao on your own (using new), and there for letting Spring manage it's lifecycle. You need to use @Autowired on PersonBaseDao and make PersonBaseServiceImpl and Spring managed component using a stereotype annotation (probably @Service). The same of course applies for the way you use PersonBaseServiceImpl inside whatever component calls it
accepted answer of: http://stackoverflow.com/q/24548056
type: Answer
answers question: http://stackoverflow.com/q/24548056
score: 2

http://stackoverflow.com/comment/37978806
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24526890
has text: Yes I've run the same setup in Linux-Mint 13 without any issues, the past year.
type: AnswerComment

http://stackoverflow.com/comment/38104690
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24570100
has text: Yes. You didn't apply the if (param.canWriteCompressed()) line. And more importantly, you don't have JAI properly installed, so you are still not using CLibPNGImageWriter. Try printing the class of writer, or use a debugger to verify.

http://stackoverflow.com/comment/37887615
type: QuestionComment
comment on: http://stackoverflow.com/q/24478296
score: 1
has text: See also [*Initial Threads*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).
type: Comment

http://stackoverflow.com/a/24433380
score: 0
has comment: http://stackoverflow.com/comment/37804415
has comment: http://stackoverflow.com/comment/37806580
type: Answer
answers question: http://stackoverflow.com/q/24433206
has body: I want to replace the string-label 'Gar_1' by 'noGar' only for those strings that have both labels (namely '[rotura de lunas]' in the above ex.). You can do: String repl = str.replaceAll("(?&lt;=\\[rotura de lunas\\])Gar_1", "noGar"); Online Demo Edit: To support various phrases in square brackets use this: String repl = str.replaceAll("(?&lt;=\\[(blabla|rotura de lunas)\\])Gar_1", "noGar"); OR else if you want to avoid replacements for certain phrases then use negative lookbehind: String repl = str.replaceAll("(\\[(?&lt;!bleble)[^\\]]*\\])Gar_1", "$1noGar");
has comment: http://stackoverflow.com/comment/37806831
has comment: http://stackoverflow.com/comment/37806093
has comment: http://stackoverflow.com/comment/37805916

http://stackoverflow.com/q/24576115
tagged with: java
has answer: http://stackoverflow.com/a/24576199
type: Question
tagged with: jersey
accepted answer: http://stackoverflow.com/a/24576199
score: 0
has title: Adding POST Method within Jersey Class
answer count: 1
has body: Let's say I have a Jersey JAX-RS api end-point for handling http://&lt;some_path&gt;/foo. Ignore the .... @Path("foo") public class FooResource @GET @Produces("application/json") public response getMethod(...) I want to create POST end-point for foo/{id}/bar, where id is a path parameter and there's a body associated with the HTTP POST. Example: HTTP POST foo/1/bar with body: { data : "...." }. How can I add this POST method within the FooResource class? I tried an inner class, but it didn't work when I tested with Postman.
type: AnsweredQuestion

sql
tags question: http://stackoverflow.com/q/24475683
tags question: http://stackoverflow.com/q/24502234
tags question: http://stackoverflow.com/q/24518052
tags question: http://stackoverflow.com/q/24475194
tags question: http://stackoverflow.com/q/24519111
tags question: http://stackoverflow.com/q/24471378
tags question: http://stackoverflow.com/q/24488154
tags question: http://stackoverflow.com/q/24509713
tags question: http://stackoverflow.com/q/24505131
tags question: http://stackoverflow.com/q/24548563
tags question: http://stackoverflow.com/q/24554049
tags question: http://stackoverflow.com/q/24495573
tags question: http://stackoverflow.com/q/24445928
tags question: http://stackoverflow.com/q/24440774
tags question: http://stackoverflow.com/q/24500664
tags question: http://stackoverflow.com/q/24564272
tags question: http://stackoverflow.com/q/24481429
tags question: http://stackoverflow.com/q/24484709
tag name: sql
tags question: http://stackoverflow.com/q/24548258
tags question: http://stackoverflow.com/q/24453275
type: Tag
tags question: http://stackoverflow.com/q/24427693
tags question: http://stackoverflow.com/q/24507893
tags question: http://stackoverflow.com/q/24434466
tags question: http://stackoverflow.com/q/24441944
tags question: http://stackoverflow.com/q/24541559
tags question: http://stackoverflow.com/q/24482763
tags question: http://stackoverflow.com/q/24533493
tags question: http://stackoverflow.com/q/24548945
tags question: http://stackoverflow.com/q/24458931
tags question: http://stackoverflow.com/q/24450929
tags question: http://stackoverflow.com/q/24446731
tags question: http://stackoverflow.com/q/24563385
tags question: http://stackoverflow.com/q/24494656
tags question: http://stackoverflow.com/q/24527883
tags question: http://stackoverflow.com/q/24550190
tags question: http://stackoverflow.com/q/24456350
tags question: http://stackoverflow.com/q/24510114
tags question: http://stackoverflow.com/q/24537911
tags question: http://stackoverflow.com/q/24543752
tags question: http://stackoverflow.com/q/24581258
tags question: http://stackoverflow.com/q/24492874
tags question: http://stackoverflow.com/q/24531957
tags question: http://stackoverflow.com/q/24478747
tags question: http://stackoverflow.com/q/24543086
tags question: http://stackoverflow.com/q/24584138
tags question: http://stackoverflow.com/q/24570005
tags question: http://stackoverflow.com/q/24471562
tags question: http://stackoverflow.com/q/24509224
tags question: http://stackoverflow.com/q/24528597
tags question: http://stackoverflow.com/q/24458204
tags question: http://stackoverflow.com/q/24486777
tags question: http://stackoverflow.com/q/24488134
tags question: http://stackoverflow.com/q/24557298
tags question: http://stackoverflow.com/q/24501440
tags question: http://stackoverflow.com/q/24533419
tags question: http://stackoverflow.com/q/24429553
tags question: http://stackoverflow.com/q/24566831
tags question: http://stackoverflow.com/q/24448373
tags question: http://stackoverflow.com/q/24559911
tags question: http://stackoverflow.com/q/24447636

http://stackoverflow.com/comment/69831069
comment on: http://stackoverflow.com/a/24574242
type: Comment
type: AnswerComment
score: 0
has text: @rolfl thanks, at least I know that now.. I spent some time banging my head against the keyboard trying to figure it out. I just use a 1 letter prefix now

http://stackoverflow.com/comment/138273551
has text: How did you determine which connect call *returned* first?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24440851
type: AnswerComment

http://stackoverflow.com/comment/38146261
comment on: http://stackoverflow.com/a/24529297
score: 0
type: AnswerComment
type: Comment
has text: You should mark the question as answered if you don't have questions anymore.

http://stackoverflow.com/comment/37901341
type: QuestionComment
score: 2
has text: Do you have any other threads that may be accessing the currentOrders list returned by the strategy.process() method?
comment on: http://stackoverflow.com/q/24485348
type: Comment

http://stackoverflow.com/comment/38036613
has text: What have you done so far?
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24558549

http://stackoverflow.com/a/24524321
has comment: http://stackoverflow.com/comment/37994962
has comment: http://stackoverflow.com/comment/38003685
answers question: http://stackoverflow.com/q/24438953
has body: Make sure your MyClass_ class goes into your classpath and eventually in your jar. When using Maven this is how you can do it: Generate the meta-model: org.bsc.maven maven-processor-plugin process process generate-sources ${basedir}/target/generated-sources/java/ org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor Now your meta-model is located in target/generated-sources/java/ so in order to add them to your src/main/java you need to: org.codehaus.mojo build-helper-maven-plugin add-source generate-sources add-source ${basedir}/target/generated-sources/java
score: 0
has comment: http://stackoverflow.com/comment/37999476
type: Answer
has comment: http://stackoverflow.com/comment/37995844
has comment: http://stackoverflow.com/comment/37996989

http://stackoverflow.com/a/24520587
answers question: http://stackoverflow.com/q/24520445
has comment: http://stackoverflow.com/comment/37965929
type: Answer
downvote count: 0
score: 1
has body: Since Java does not have tuples, one way to solve it would be using a tuple - class Pair&lt;L,R&gt; { private final L left; private final R right; Pair(L left, R right) { this.left = left; this.right = right; } L getLeft() { return left; } R getRight() { return right; } @Override public int hashCode() { return left.hashCode() ^ right.hashCode(); } @Override public boolean equals(Object o) { if (o == null) return false; if (!(o instanceof Pair)) return false; Pair pairo = (Pair) o; return this.left.equals(pairo.getLeft()) &amp;&amp; this.right.equals(pairo.getRight()); } }
upvote count: 1

http://stackoverflow.com/comment/37946314
has text: like this = Cursor cursor = sqlDatabase.rawQuery("SELECT performance_month, AVG(performance_rate_one) as col1, AVG(performance_rate_two) as col2, AVG(performance_rate_three) as col3, AVG(performance_rate_four) as col4, AVG(performance_rate_five) as col5 FROM performance where "+ "Emp_id" + " = ? " +" GROUP BY performance_month",new String[]{String.valueOf(strSeparated_Id)});
comment on: http://stackoverflow.com/a/24509601
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37987297
comment on: http://stackoverflow.com/q/24532295
type: Comment
type: QuestionComment
has text: This is likely because the tomcat process is running as root
score: 2

http://stackoverflow.com/comment/38049961
type: Comment
has text: That was my confusion all right. Looking in the sources for the collections (like TreeMap) which are only declared with `T` I see they're casting to Comparable to get a comparator at run time. Thanks for explaining that!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24565436

http://stackoverflow.com/q/24450011
answer count: 2
has title: With a DrawerLayout, how can I close the app on pressing Back no matter which screen is active?
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24450074
type: AnsweredQuestion
has body: I'm using a DrawerLayout for the navigation of my app: Taking this menu for the example: I'd like the Home button to launch the HomeActivity and so on. But clearing the activity stack, that is: If I press People, then Photos, then Locations and then the back button, the app should close. I'm trying intent flags when launching the activities but I always get the same behaviour: People->Photos->Location->Back goes to Photos instead closing the app How can I achieve that?
has answer: http://stackoverflow.com/a/24450492
has comment: http://stackoverflow.com/comment/37834616
tagged with: java
accepted answer: http://stackoverflow.com/a/24450074
type: Question
possible better answer: http://stackoverflow.com/a/24450492

http://stackoverflow.com/comment/38019491
type: QuestionComment
comment on: http://stackoverflow.com/q/24548102
has text: it works when I increase it but if I create a jar out of it and run on other machines. It fails. A permanent solution?
score: 0
type: Comment

http://stackoverflow.com/comment/37882465
type: Comment
type: QuestionComment
has text: When you used Traceview to determine where your problem is, what did you learn? When you enabled `StrictMode` to see if you're doing network or disk I/O on the main application thread, what did you learn?
comment on: http://stackoverflow.com/q/24475533
score: 0

http://stackoverflow.com/comment/37808823
has text: @Stratosgear We ware able to do it :) but not in efficient way :(
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24434927

http://stackoverflow.com/comment/94345258
comment on: http://stackoverflow.com/a/35055535
has text: @EricB. On further thought, `MockUp` should no longer allow `@Mock`s for private methods/constructors. Every time I see this done, it's for a bad reason. Privates are mere implementation details, and tests shouldn't directly depend on them; a reasonable test can always mock/fake a dependency external to the class being tested, or fake a non-private method which calls the private one.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37835598
has text: @mkl they want Transparency.. not Strocked one, they want filled one, like first screenshot, with Transparent.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24444265

http://stackoverflow.com/a/24444977
score: 0
type: Answer
has body: Avinash Raj pointed to the most important mistake: the + multiplier after positive lookbehind expression. Using nested marking groups is another mistake. The outer parentheses are useless here and should be removed to reduce complexity. And backslashes in strings must be escaped with backslashes. As I think that \r and \n should be passed to the regular expression engine and not the characters with code value 13 and 10, the string to use is "(?&lt;==)(\"[^\"]+\"|[^,=+&lt;&gt;#;\\r\\n]+)"
answers question: http://stackoverflow.com/q/24444305

http://stackoverflow.com/q/24498662
possible better answer: http://stackoverflow.com/a/33115523
downvote count: 0
has title: HOWTO handle 404 exceptions globally using Spring MVC configured using Java based Annotations
has comment: http://stackoverflow.com/comment/37991220
has answer: http://stackoverflow.com/a/33115523
has comment: http://stackoverflow.com/comment/57266950
has body: I am building a Spring 4 MVC app. And it is completely configured using Java Annotations. There is no web.xml. The app is configured by using instance of AbstractAnnotationConfigDispatcherServletInitializer and WebMvcConfigurerAdapter like so, @Configuration @EnableWebMvc @ComponentScan(basePackages = {"com.example.*"}) @EnableTransactionManagement @PropertySource("/WEB-INF/properties/application.properties") public class WebAppConfig extends WebMvcConfigurerAdapter { ... } and public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { ... } I am now trying to add a global/catch-all exception handler for 404 pages i.e. HttpStatus.NOT_FOUND but no success. Below are some of the ways I tried. import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; @ControllerAdvice public class GlobalExceptionHandlerController { @ExceptionHandler @ResponseStatus(HttpStatus.NOT_FOUND) public ModelAndView handleException (NoSuchRequestHandlingMethodException ex) { ModelAndView mav = new ModelAndView(); return mav; } @ExceptionHandler @ResponseStatus(HttpStatus.NOT_FOUND) public ModelAndView handleExceptiond (NoHandlerFoundException ex) { ModelAndView mav = new ModelAndView(); return mav; } @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(NoHandlerFoundException.class) public void handleConflict() { } @ResponseStatus(HttpStatus.NOT_FOUND) @ExceptionHandler(NoSuchRequestHandlingMethodException.class) public void handlesdConflict() { } } None of these methods get executed. I am at a loss as to how to handle this. I do not want to use web.xml becasue then I would ha…
has answer: http://stackoverflow.com/a/43461205
upvote count: 11
favorite count: 0
accepted answer: http://stackoverflow.com/a/24499023
tagged with: web.xml
answer count: 5
score: 11
tagged with: spring
tagged with: http-status-code-404
has answer: http://stackoverflow.com/a/44844106
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/34760968
has answer: http://stackoverflow.com/a/24499023

http://stackoverflow.com/comment/37885223
type: AnswerComment
score: 0
type: Comment
has text: Is it? ok forgot about that lukily there are other good answers here.
comment on: http://stackoverflow.com/a/24451730

http://stackoverflow.com/q/24541672
accepted answer: http://stackoverflow.com/a/24874433
tagged with: multithreading
has body: Why ABQ has not been implemented using the way LinkedBlockingQueue. We can use AtomicInteger to keep Track count in ABQ also the same way LBQ does. We can use the Two Locks for ABQ too. I stumble upon the similar question on SO. ArrayBlockingQueue uses a single lock for insertion and removal but LinkedBlockingQueue uses 2 separate locks But I couldn't understand the answer for that question. I need help in understanding that problem which would arise if we implement ABQ using two locks. If would be very nice if somebody can give example of a race condition where it might fail. This question can be marked as a duplicate, but am really looking for a more descriptive answer. That would be a great help. I have pasted a code here http://pastebin.com/ZD1uFy7S . can anyone show whether there could be a possible race condition in the code pasted.
has comment: http://stackoverflow.com/comment/38006040
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38006128
tagged with: java
tagged with: concurrency
tagged with: java.util.concurrent
type: Question
has comment: http://stackoverflow.com/comment/38005979
has comment: http://stackoverflow.com/comment/38006346
tagged with: blockingqueue
has title: ArrayBlockingQueue: concurrent put and take
has comment: http://stackoverflow.com/comment/38006039
has comment: http://stackoverflow.com/comment/38006321
has comment: http://stackoverflow.com/comment/38006089
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24874433
has comment: http://stackoverflow.com/comment/38006087
possible better answer: http://stackoverflow.com/a/24542089
linked to: http://stackoverflow.com/q/11015571
has answer: http://stackoverflow.com/a/24542089
has comment: http://stackoverflow.com/comment/38006266

http://stackoverflow.com/q/24455672
answer count: 2
tagged with: email-attachments
has body: I'm trying to display email messages gotten from the server. Prior to letting you know my issue, take a look at my code: public FileMailExtended getSingleMessage(Integer fileMailId) throws MailSystemException, IOException, MessagingException, BOServiceException { FileMail email = retrieve(fileMailId.intValue()); MailerScopeDef scope = email.getType(); boolean outbound = email.getDirection() == EmailConstants.DIRECTION_SENT; Long uId = Long.valueOf(email.getUId()); String folder = null; if (outbound) { folder = ConfigurationService.getSentFolder(scope); } else { folder = ConfigurationService.getReadFolder(scope); } FileMailConfig fileMailConfig = getFileMailConfig(folder); long uidValidity = 0; if (fileMailConfig != null) { uidValidity = fileMailConfig.getVersionId(); } ImapFolderManager ifm; if (outbound) { ifm = ((ImapSender) ConfigurationService.getMailSender(scope)).getImapFolderMger(); } else { ifm = ConfigurationService.getImapFolderManagerReader(scope); } FileMailExtended emailExtended = new FileMailExtended(); mapFileMailToFileMailExtended(email, emailExtended); try { IMAPMessage message = (IMAPMessage) ifm.getMessage(uId, uidValidity); if (message == null) { LOGGER.error("Could not read message with uId:" + uId + " from the server."); return null; } InternetAddress intAdress = (InternetAddress) message.getSender(); String unicodeString = intAdress.toUnicodeString().replace("\"", ""); emailExtended.setFrom(unicodeString); emailExtended.setTo(appendAddresses(message.getRecipients(RecipientType.TO))); emailExtended.setCc(appendAddresses(message.getRecipients(RecipientType.CC))); emailExtended.setCci(appendAddresses(message.getRecipients(RecipientType.BCC))); emailExtended.setSubject(message.getSubject()); String content = ""; if (message.getContent() instanceof String) { content += (String) message.getContent(); } else if (message.getContent() instanceof Multipart) { Multipart multipart = (Multipart) message.getContent(); StringBuffer buf = new StringBuffer(); …
score: 0
tagged with: jakarta-mail
tagged with: mime
has answer: http://stackoverflow.com/a/58931809
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5134959
has answer: http://stackoverflow.com/a/24459416
tagged with: java
tagged with: content-type
type: Question
has title: Convert content-type from text/plain to text/html in an email with attachment

tabs
type: Tag
tag name: tabs
tags question: http://stackoverflow.com/q/24479110

http://stackoverflow.com/comment/37949179
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24511817
has text: What interpolation method are you planning to use? What values are pre-determined? Gradients? second gradients?

http://stackoverflow.com/comment/38030807
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24555289
has text: The table is repainted every time when some modification occurs. Then you need to save all the cells you want to change the color.

http://stackoverflow.com/comment/37967255
type: QuestionComment
comment on: http://stackoverflow.com/q/24496691
has text: I would suggest that if you found a solution you put it in the answer section instead of in your question, as you were told earlier. If you won't do so I'd be happy to make a community wiki answer out of it.
score: 0
type: Comment

http://stackoverflow.com/a/24512199
score: 1
has comment: http://stackoverflow.com/comment/37959015
upvote count: 1
has comment: http://stackoverflow.com/comment/37954053
accepted answer of: http://stackoverflow.com/q/24462757
has comment: http://stackoverflow.com/comment/37953927
has body: The biggest feature of JTA is that you can compose several transactional stores in one application and run transactions that span across these independent stores. For instance, you can have a DB, a distributed transactional key-value store and your simple FileWriter and have a transaction that performs operations on all of these and commit all the changes in all the stores at once. Take a look at infinispan. That's a transactional data grid, it uses JTA and can be used in combination with other JTA transactional services. Edit: Basically JTA is connected to the X/Open XA standard and it provides means to interact with X/Open XA resources directly in Java code. You can use alredy existing data-stores which hold X/Open XA compliant resources, such as databases, distributed data-grids and so on. Or you can define your own resources by implementing javax.transaction.xa.XAResource. Then, when your User transaction uses these resources, the transaction manager will orchestrate everything for you, no matter where the resources are located, in which data-store. The whole bussiness is managed by the transaction manager which is responsible for synchronizing independent data-stores. JTA doesn't come with a transaction manager. JTA is just an API. You could write your own if you wish to (javax.transaction.TransactionManager), but obviously that's a difficult task. Instead what you want is to use some already implemented JTA service/library which features a transaction manager. For instance, if you use infinispan in your application you can use its transaction manager to allow your transactions to interact with different data-stores as well. It's best to seek further information on how to accomplish this from the implementators of JTA interface. You can find full JTA API documentation here, though it's pretty long. There are also some tutorials available that talk about how to use Java EE Transaction Manager and update multiple data-stores but it is pretty obscure and doesn't p…
has comment: http://stackoverflow.com/comment/37967549
has comment: http://stackoverflow.com/comment/37964110
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37953985
answers question: http://stackoverflow.com/q/24462757
has comment: http://stackoverflow.com/comment/37951570
type: Answer
has comment: http://stackoverflow.com/comment/37967370

http://stackoverflow.com/comment/37930402
comment on: http://stackoverflow.com/a/24499893
type: Comment
has text: i think things are starting to clear up…in your example, the main method would print: Slide 3 times! Step 3 times! Twist 3 times! correct?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37832019
type: QuestionComment
has text: What is the content of the `title` element in the JNLP?
comment on: http://stackoverflow.com/q/24441461
score: 0
type: Comment

http://stackoverflow.com/comment/38008545
comment on: http://stackoverflow.com/a/24540201
type: Comment
has text: onResume() will be called before the fragment is active: http://developer.android.com/guide/components/fragments.html My concern is to move non-UI essential work off of the UI thread, so in an overall sense, the UI thread's perceived performance can be improved, but since onResume() is guaranteed to be called by Android on the UI thread, it should not have any heavy work inside it.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24438821
has body: Even simpler: String s = Stream.of(21,22,32,42,52) .collect(Collectors.joining(" "));
score: 7
has comment: http://stackoverflow.com/comment/37831808
downvote count: 0
answers question: http://stackoverflow.com/q/24437954
type: Answer
has comment: http://stackoverflow.com/comment/37825606
has comment: http://stackoverflow.com/comment/37825559
upvote count: 7

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/24509941
tag name: nosuchmethoderror

http://stackoverflow.com/a/58158847
answers question: http://stackoverflow.com/q/24543062
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: I faced same problem. Then I turned on my "Touch on vibration" option from my phone settings(sound settings) and it started working nicely.

http://stackoverflow.com/q/24539437
type: Question
has comment: http://stackoverflow.com/comment/38004683
tagged with: android-manifest
has answer: http://stackoverflow.com/a/24547693
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24540883
has title: In Android Studio (IntelliJ), how do I access the Android Manifest as it displays in Eclipse?
has answer: http://stackoverflow.com/a/24539608
has comment: http://stackoverflow.com/comment/38004148
possible better answer: http://stackoverflow.com/a/24539608
has body: I am trying to display this, but I can only find this. I am running the latest updates for the SDK and ADT. I would like to access the Manifest, Application, Permissions, Instrumentation, and AndroidManifest.xml tabs so I can more easily edit the Manifest but seem to only find these tabs in eclipse. Surely IntelliJ has a similar option?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24540883
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-studio

http://stackoverflow.com/q/24575632
possible better answer: http://stackoverflow.com/a/24575792
has title: Java first time using keybindings, Keybinding events arent being registered on the JPanel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24575836
has body: As the title states this is the first time i am using keybinds in an Java application, in fact this is the first time i have heard of them. I can get my game to work using KeyListener but when i use a CardLayout to switch from my menu to the game i ran into all sorts of focusing problem. Here is the code i have so far: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; public class GameFrame extends JFrame { private final String RENDER = "render"; public GameFrame(){ this.setTitle("Snake By Chris Edwards"); this.setVisible(true); this.setSize(805, 700); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel render = new JPanel(); render.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.VK_LEFT), "left"); render.getActionMap().put("left", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); } }); render.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.VK_UP), "up"); render.getActionMap().put("up", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); } }); render.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.VK_RIGHT), "right"); render.getActionMap().put("right", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); } }); render.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.VK_DOWN), "down"); render.getActionMap().put("down", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("test"); } }); this.add(render); } public static void main(String[] args){ new GameFrame(); } } The Rende…
tagged with: java
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/24575836
has comment: http://stackoverflow.com/comment/38068428
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/38068624
has answer: http://stackoverflow.com/a/24575792

http://stackoverflow.com/comment/37937856
comment on: http://stackoverflow.com/q/24504193
score: 0
has text: No. It shows the files in his window. But when I try to do something with this files the application doesn't respond.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/38035140
comment on: http://stackoverflow.com/q/24552246
type: QuestionComment
has text: 50 jars... and the world's longest classpath. Are you sure you want to do this? Will your client really be picking and choosing actions to deploy on this basis?
score: 0
type: Comment

http://stackoverflow.com/comment/37810543
score: 2
has text: Thanks alot! Fixed it completely
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24436846

http://stackoverflow.com/a/24518047
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24517967
has comment: http://stackoverflow.com/comment/37961636
score: 3
has comment: http://stackoverflow.com/comment/37962213
has body: A dependency is marked as provided when the app server or container already has it, and you don't have to put it in the war. This is the case i.e. for the servlets jar, but not for the spring-context. I think the better solution would be to mark this dependencies as "compile" instead of "provided".
downvote count: 0
has comment: http://stackoverflow.com/comment/37964529

http://stackoverflow.com/comment/38017471
comment on: http://stackoverflow.com/q/24530299
score: 0
type: QuestionComment
has text: @BasilBourque On the contrary, perhaps you should read the question and comments fully before suggesting that I have given misinformation. My question is clear but somehow you have completely failed to grasp it, so please **be much more careful when posting**.
type: Comment

http://stackoverflow.com/comment/37961979
has text: It still crashes when I check for videos being null or projects.videos.size()==null is wrong syntax.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24518518

http://stackoverflow.com/q/24539164
type: Question
accepted answer: http://stackoverflow.com/a/24540839
answer count: 2
downvote count: 0
tagged with: inverse
favorite count: 0
has title: Reconstructing a string manipulated with bitwise operations
has body: Suppose I have a Java string of length 32, e.g. String s = "Y7yEdfjQ2qmpGZbPYswKIdxYVo6KnR9M"; I'm looking for the string t with the following property: If the following loop is performed on t, the resulting string is s: char[] tArr = t.toCharArray(); for (int i = 1; i &lt; 32; i++) { tArr[i] = (char) (tArr[i] ^ tArr[i * 123456 % 31] &amp; 31); } Note that in Java the array operator [] has highest precedence and bitwise AND is evaluated before bitwise XOR. In order to obtain t the reverse operation must be applied to s. The inverse operation of XOR is XOR, however the logical AND obviously has no inverse operation. Can the string t be recovered short of bruteforcing?
has answer: http://stackoverflow.com/a/24540839
tagged with: bitwise-and
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/24539283
tagged with: bitwise-operators
has answer: http://stackoverflow.com/a/24539283

spring-4
tags question: http://stackoverflow.com/q/24446783
tag name: spring-4
type: Tag

http://stackoverflow.com/comment/37927631
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24499620
has text: You should simply be able to use a OR constraint in your query...
score: 1

http://stackoverflow.com/comment/38781650
comment on: http://stackoverflow.com/a/24632594
type: AnswerComment
type: Comment
score: 0
has text: Ok, thanks! Running only step 4 worked fine for what I wanted to do. The other examples and parts of Californium still have some troubles, though.

http://stackoverflow.com/q/24437586
score: 0
has body: How can I import a team project set in Eclipse programmatically without using the wizard? I would like to do it programmatically in Java. Thanks
type: UnansweredQuestion
has title: Import Team Project Set in Java
type: Question
has answer: http://stackoverflow.com/a/24438217
tagged with: java
tagged with: eclipse
answer count: 1

http://stackoverflow.com/q/24482950
has body: I am trying to make scalable triangle out of asterisks and I've got this code which is completely functional and all and resizes the right way but it doesn't output the 3rd side of the triangle. Any suggestions are welcome. import java.util.Scanner; class Triangle { public static void main(String[] args){ Scanner a; a = new Scanner(System.in); System.out.println("Welcome to the Scalable Triangle program!"); System.out.print("What size triangle do you want?"); int size = a.nextInt(); for (int j = 0; j &lt; (size - 1); j++) System.out.print(" "); System.out.println("*"); //top line for (int j = 1; j &lt; (size - 1); j++) { for (int k = 0; k &lt; (size - 1 - j); k++) System.out.print(" "); System.out.println("*"); } for (int j = 0; j &lt; size ; j++) System.out.print("* "); System.out.println(" "); //bottom line } } I would like it to output this if I answer the question with, for example, a 7: * * * * * * * * * * * * * * * * * * Right now it would output this: * * * * * * * * * * * * *
upvote count: 1
has comment: http://stackoverflow.com/comment/37896948
has answer: http://stackoverflow.com/a/24483970
has answer: http://stackoverflow.com/a/24483774
has answer: http://stackoverflow.com/a/24483171
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/37896823
downvote count: 4
tagged with: for-loop
score: -3
has comment: http://stackoverflow.com/comment/37896942
answer count: 3
has title: Triangle in asterisks in Java
favorite count: 0
tagged with: geometry
type: UnansweredQuestion

http://stackoverflow.com/comment/37996122
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24536388
has text: When/Where exactly do you press Alt + Enter?
score: 0

http://stackoverflow.com/q/24446194
favorite count: 0
tagged with: xmlbeans
has body: I am using XmlBeans 2.6.0 to compile some XSD files that contain an enumeration of Greek words: &lt;xs:simpleType name="t_series_report"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="Γενική"/&gt; &lt;xs:enumeration value="Ειδική"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; The compilation is performed using the Ant task included in the xbean.jar of the ZIP binary distribution of XmlBeans. The XSD files are saved as utf-8 and this is also correctly stated in the header java files &lt;?xml version="1.0" encoding="UTF-8"?&gt; The problem is that the Java files generated by XmlBeans seem to be saved in ANSI character set and during compilation I get errors like: [xmlbean] C:\projects\myproject\workspace\prj\build\xmlbeans\test\src\com\company\project\schema\myschematype\cl\cle\ext\TMyType.java:61: illegal character: \8220 [xmlbean] static final int INT_ΓΕ�?ΙΚΉ = 1; [xmlbean] Is there any way to force XmlBeans to save the generated Java files as UTF-8 instead of ANSI?
has comment: http://stackoverflow.com/comment/37827918
upvote count: 1
has title: XmlBeans generates Java source files with ANSI encoding
tagged with: xsd
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37827950
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24446591
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24446591
tagged with: utf-8

http://stackoverflow.com/a/24512402
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37952932
type: AcceptedAnswer
downvote count: 0
has body: ASM 5 adds support for Java 8 bytecode format which allows static methods in interfaces, so at least invokestatic is now possible on interface methods.
accepted answer of: http://stackoverflow.com/q/24510785
type: Answer
answers question: http://stackoverflow.com/q/24510785

http://stackoverflow.com/q/24526006
has comment: http://stackoverflow.com/comment/37975688
tagged with: jdbc
tagged with: uuid
has comment: http://stackoverflow.com/comment/37976173
tagged with: mysql
has answer: http://stackoverflow.com/a/24526051
has comment: http://stackoverflow.com/comment/37975622
has comment: http://stackoverflow.com/comment/37975640
has comment: http://stackoverflow.com/comment/37975629
type: AnsweredQuestion
tagged with: java
score: 4
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24526051
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37975699
favorite count: 0
has body: I am facing a peculiar problem while storing UUID to mysql table. I have a table with a column declaration : expenseUUID varchar(32) primary key , in this column I wish to save UUID. I have generated UUID as follows: String expenseUUID = UUID.randomUUID().toString(); expenseUUID.replaceAll("-", ""); But when I try to insert expenseUUID using JDBC , I get an error saying : Data truncation: Data too long for column 'expenseUUID' What should I do resolve this issue? I am stuck. I am not able to figure out what is going wrong.
has title: storing UUID in mysql database table

http://stackoverflow.com/a/24568689
has comment: http://stackoverflow.com/comment/38056990
downvote count: 0
has body: I'd suggest the use of a ProgessDialog. Declare a ProgressDialog as an instance variable. Something like : ProgressDialog pDialog; then inside onCreate() : pDialog = new ProgressDialog(this); //The next two methods will ensure that the user is unable to //cancel the Progress Dialog unless you explicitly //do so by calling `pDialog.dismiss();` pDialog.setCancelable(false); pDialog.setCanceledOnTouchOutside(false); Modify AsyncTask somewhat like this : private class LoadDataTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { pDialog.setMessage("Loading Data.. Please Wait."); pDialog.show(); } @Override protected Void doInBackground(Void... params) { doVeryMuchWork(); } @Override protected void onPostExecute() { pDialog.dismiss(); } }
accepted answer of: http://stackoverflow.com/q/24568477
has comment: http://stackoverflow.com/comment/38056534
answers question: http://stackoverflow.com/q/24568477
has comment: http://stackoverflow.com/comment/38056593
score: 1
has comment: http://stackoverflow.com/comment/38056917
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38056960
type: Answer

http://stackoverflow.com/a/24467238
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24465349
has body: I would go with @shekhar suman's example, but i would change last class and main: class A&lt;T extends X &amp; Y&gt; { public void display(T t){ t.eat(); t.drink(); System.out.println("Type of T is "+t.getClass().getName()); } } public static void main(String[] args) { A&lt;XYZ&gt; a=new A&lt;&gt;(); a.display(new XYZ()); }
type: Answer
score: 1

http://stackoverflow.com/comment/37963165
has text: Also my foreach loops etc are being rendered literally, for example `#foreach($foo in $fooList) ... #end` is coming out literally as such. What should I do?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24503225
score: 0

http://stackoverflow.com/q/24475194
tagged with: java
type: Question
tagged with: eclipse
score: 0
tagged with: sql
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/24475258
accepted answer: http://stackoverflow.com/a/24475258
has body: how can I insert every 10th row in an array list to ? This is my Code: openDB(); Cursor c = myDb.getSpalte(); List&lt;Integer&gt; valueList = new ArrayList&lt;Integer&gt;(c.getCount()); while (c.moveToNext()) { valueList.add(c.getInt(1)); } c.close(); closeDB();
tagged with: android
has title: How can I insert every 10th row in an array list to?
type: AnsweredQuestion

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/24559849
type: Tag

http://stackoverflow.com/comment/37937054
has text: I use Play 2.3.0, `play debug` doesn't exist anymore.
type: AnswerComment
comment on: http://stackoverflow.com/a/24493732
score: 0
type: Comment

http://stackoverflow.com/comment/37930241
score: 1
has text: For that part, Ricky's answer below is close (one layer of `List<>` needs to be taken off). You're supposed to be getting closer to `String`, not further away from it!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24500962

http://stackoverflow.com/q/24557708
score: 0
has body: I'd like to format and display BigDecimal numbers with always to fractions. No other separators should ever be displayed. How could I achieve it? The following does not work. NumberFormat formatter = NumberFormat.getNumberInstance(Locale.GERMANY); formatter.setMaximumFractionDigits(2); formatter.setMinimumIntegerDigits(2); Sysout(formatter.format(new BigDecimal(100))); //would expect "100,00", but printout is "100"
has answer: http://stackoverflow.com/a/24557788
tagged with: currency
accepted answer: http://stackoverflow.com/a/24557792
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24557802
has answer: http://stackoverflow.com/a/24557895
tagged with: java
possible better answer: http://stackoverflow.com/a/24557802
type: Question
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/24557792
has title: How to format BigDecimal with 2 fractions?

http://stackoverflow.com/comment/38037045
type: AnswerComment
type: Comment
has text: I can not find the setConfig method, it may be possible that this method has changed?
comment on: http://stackoverflow.com/a/24545347
score: 0

http://stackoverflow.com/comment/37943787
has text: You can provide the same than Executor framework. <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/> <task:executor id="myExecutor" pool-size="5"/> <task:scheduler id="myScheduler" pool-size="10"/>} Read the documentation
comment on: http://stackoverflow.com/a/24508802
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24470769
type: Answer
has body: The values would be gone, because you're creating a new instance of the Class Object. You should create a Bundle and use its value. Intent i = new Intent(this, ActivityTwo.class); String data = "Love for all, Hatred for none!"; //Create the bundle Bundle bundle = new Bundle(); //Add your data to bundle bundle.putString("something", data); //Add the bundle to the intent i.putExtras(bundle); We have: Intent.putExtra(String,Bundle) vs Intent.putExtra(Bundle) and http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String, android.os.Bundle) to help you get started To Save data even after .onDestroy() To save the data after the app is destoryed or closed totally, you need to save the Application state or data in the System. You can use SQLite database provided by the Android OS. Once the application is closed, the onCreate() method would always create new objects. It doesn't save any objects in itself. You would be required to save the data in the File System, using a .txt file as you're saying. Or by saving the UserName and Password encrypted inside the SQLite databases.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24470714
has comment: http://stackoverflow.com/comment/37873695
has comment: http://stackoverflow.com/comment/37873571
upvote count: 1
has comment: http://stackoverflow.com/comment/37873629
has comment: http://stackoverflow.com/comment/37873766

http://stackoverflow.com/comment/37852484
comment on: http://stackoverflow.com/a/24459327
has text: sure it is in the question now
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/37967242
comment on: http://stackoverflow.com/q/24470164
score: 0
type: QuestionComment
type: Comment
has text: Text components are a different best, they are likely using a `KeyListener` to perform the majority of their work, things like HOME, END, PAGE-UP/DOWN etc are bound via key bindings

http://stackoverflow.com/q/24496757
has body: I have an application written in Java that connects to a Postgresql 9.3 database. The database I'm connecting to is created with UTF-8 enconding. The locale for the server where the database is installed is es-uy.UTF-8. All the information submitted from the application (web app running in Tomcat 7) is also in UTF-8. Everything works according to the encoding settings except the JDBC exception messages. If I try to connect to the database with a wrong password I get: org.postgresql.util.PSQLException: FATAL: la autentificaci��n password fall�� para el usuario ��postgres�� If I try the same from psql or pgadmin I get the message with the correct encoding: psql: FATAL: la autentificación password falló para el usuario «postgres» What is wrong here?
downvote count: 0
favorite count: 0
tagged with: postgresql
possible better answer: http://stackoverflow.com/a/68799164
tagged with: jdbc
has answer: http://stackoverflow.com/a/68799164
has answer: http://stackoverflow.com/a/24501509
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37922458
upvote count: 3
tagged with: java
type: Question
answer count: 2
tagged with: encoding
has comment: http://stackoverflow.com/comment/37963745
accepted answer: http://stackoverflow.com/a/24501509
has title: Wrong encoding for Postgresql messages in JDBC

http://stackoverflow.com/q/24505847
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/37940427
has comment: http://stackoverflow.com/comment/37941849
type: Question
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37972662
has title: Struts2 with Tomcat keep getting java.lang.OutOfMemoryError PermGen space
downvote count: 0
has body: I'm using Netbeans and Java 1.7 and trying to develop a web application with Struts2, Hibernate and JasperReport. I'm using these simple coding and database which is only have less than 10 records, but after I'm redeploying and running the application many times in my NetBeans, I get java.lang.OutOfMemoryError PermGen space. Everything back to normal after I reset Tomcat, but it's happen again after I redeploy and run it. I've tried many solution in SO and other website including increase PremGen memory, but it won't help. Is there something wrong in my code below ? Admin.java (for getting data from database and show it into JSP file) public class Admin extends ActionSupport { @Override public String execute() throws Exception { try { Session s = HibUtil.getSessionFactory().openSession(); s.beginTransaction(); this.setClient(s.createQuery("FROM Client").list()); s.getTransaction().commit(); s.close(); return super.SUCCESS; } catch(HibernateException he) { he.printStackTrace(); return super.ERROR; } } // Some setter and getter method } Admin.java (Try to use plain JDBC because using Hibernate is getting OOM error) public class Admin extends ActionSupport { @Override public String execute() throws Exception { Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); try (Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","USER", "user")) { PreparedStatement ps = conn.prepareStatement("SELECT * FROM USER.CLIENT"); ResultSet rs = ps.executeQuery(); client = new ArrayList&lt;&gt;(); while(rs.next()) { Client c = new Client(); c.setIndex(rs.getBigDecimal("INDEX")); c.setUserName(rs.getString("USER_NAME")); c.setClientName(rs.getString("CLIENT_NAME")); client.add(c); } return super.SUCCESS; } } // Some setter and getter method } PrintReport.java (To Print report using JasperReport) public class PrintReport extends ActionSupport { public PrintReport() { } public String printUser() throws Exception { String reportSourceFile = "/report…
linked to: http://stackoverflow.com/q/14763079
has comment: http://stackoverflow.com/comment/37939698
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37950821
favorite count: 0
has comment: http://stackoverflow.com/comment/37970297
has comment: http://stackoverflow.com/comment/37950311
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/48603417

http://stackoverflow.com/q/24550092
has body: I have a String like that: ECLONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS ECLONG_TEXT_INSIDE_THIS2|LONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS ECLONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS ECLONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS|LONG_TEXT_INSIDE_THIS I need all the words between EC and the first |. This does not work for me: lAllText = lData.split("EC(.*?)|"); what I have to change do manage that issue? Thanks for your help Stefan
score: 0
answer count: 3
has title: java regex to get all matches between a String and the next pipe
has answer: http://stackoverflow.com/a/24550113
has answer: http://stackoverflow.com/a/24550172
tagged with: regex
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24550113
has answer: http://stackoverflow.com/a/24550140
accepted answer: http://stackoverflow.com/a/24550140
has comment: http://stackoverflow.com/comment/38020820

http://stackoverflow.com/comment/37881079
type: Comment
has text: This seems to be a little backwards, why is the parent looking for a property of its child?
comment on: http://stackoverflow.com/q/24474772
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37898530
comment on: http://stackoverflow.com/q/24483668
type: Comment
type: QuestionComment
has text: possible duplicate of [PBKDF2 with SHA256 on android](http://stackoverflow.com/questions/11628256/pbkdf2-with-sha256-on-android)
score: 0

http://stackoverflow.com/q/24504013
has answer: http://stackoverflow.com/a/73438367
has body: I have a two Buttons in my program JButton button1 = new JButton(); button1.setText("First Button"); JButton button2 = new JButton("Second Button"); I have tried to change the LaF of the button, I am able to change the button background color using the following code UIManager.put(Button.background new color(134,201,236)); But when i tried to change the other key values like "Button.disabled", "Button[Default+Focused+Pressed].backgroundPainter" the code did not work for me. Could someone help me how to change the default key values which uses Painter?
accepted answer: http://stackoverflow.com/a/24504387
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24504387
favorite count: 0
possible better answer: http://stackoverflow.com/a/73438367
tagged with: nimbus
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Changing the defauls key values for JButton in Nimbus LaF
tagged with: look-and-feel
tagged with: swing
tagged with: jbutton
type: Question

http://stackoverflow.com/comment/37820914
has text: I do reset overSleepTime (in my good application)... Like I said I just whipped this up to demonstrate my problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24442237

http://stackoverflow.com/q/24496947
tagged with: keyword
score: 2
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/7099828
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24496965
downvote count: 0
has title: Why am I getting <identifier> expected error?
answer count: 1
favorite count: 0
tagged with: compiler-errors
accepted answer: http://stackoverflow.com/a/24496965
upvote count: 2
has body: class return{ public static void main(String args[]){ boolean t = true; System.out.println(" this is before"); if (t) return; System.out.println(" this is not going to be printed on the screen"); } } Here is my code and my command line brings identifier expected error Who can explain where the problem lies?

http://stackoverflow.com/q/24455592
has body: I'm trying to create my first Android app using Facebook SDK. I've been following tutorials at http://www.youtube.com/watch?v=SrJsLFAYITI. Originally everything was working fine at set up/downloading Facebook SDK and it was not giving me any errors when I was writing the application. Then I tried to run the application on the emulator and I didn't see anything on it. Then, when I tried to fix this, I started to get several errors not seen in the tutorial. The current errors I'm getting are "Your project contains error(s), please fix them before running your application" and "R.java was modified manually! Reverting to generated version!" I've seen the second error before and gotten it to go away by deleting R.java and having it be rebuilt and then cleaning my projects, but that doesn't work now. Looking in my libraries folder for the project it looks like the problem is that my Android Dependencies library is missing the facebooksdk.jar from its bin folder. I've tried redownloading from the Facebook developers site and github (and even tried to do this on another computer) but it always seems to be missing. I downloaded another facebook-sdk.jar and added it as an external jar to my project but that doesn't seem to help. (Also, it will not allow me to manually modify the Android Dependencies library, so I can't do anything there.) I saw several posts with similar questions related to a missing facebooksdk.jar and tried out all their solutions but nothing has worked for me. I've tried: cleaning/rebuilding, reconfiguring build path, changing compiler compliance, etc. Does anyone have suggestions? Thank you so much!!! (Also, I've noticed my FBAndroid-7.0.0.apk is also missing from bin (and my whole computer).)
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37846610
has answer: http://stackoverflow.com/a/28281623
answer count: 2
has answer: http://stackoverflow.com/a/25657378
tagged with: facebook-sdk-4.0
downvote count: 0
tagged with: android
favorite count: 0
type: UnansweredQuestion
has title: facebooksdk.jar missing from Android Dependencies library
tagged with: facebook

http://stackoverflow.com/a/24533886
type: AcceptedAnswer
has body: There are some methods in the ActionBar class that may help you: The following call will set the Home button icon to the "back" icon. getActionBar().setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP); Because the MenuItem's action is defined by onOptionsItemSelected() method, so you have to override it too, and check whether you click the home button or not. Actually, the navigation drawer will draw again so you will want to return true from that method to prevent the drawer to draw again. @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getId() == android.R.id.home) { // do what you want here return true; // prevent the drawer to draw again; } return super.onOptionsItemSelected(item); } To turn the home button back to its default "behavior", use the following call: getActionBar().setDisplayShowHomeEnabled(true); The last step is to check if your current fragment is the FragmentA (which will active the drawer draw the navigation fragment) or the FragmentB (which does not). You may want to add a global boolean variable to do them, and check the position of the navigation item. I have included an example here, please check out: Navigation Drawer example Hope this help.
answers question: http://stackoverflow.com/q/24530383
type: Answer
accepted answer of: http://stackoverflow.com/q/24530383
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/37903570
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24486638
type: Comment
has text: First paste your whole query generated by hibernate

http://stackoverflow.com/comment/38060744
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24571354
type: Comment
has text: What are those hash tables? My guess is that the list of hash tables should be encapsulated into a class.

http://stackoverflow.com/a/25307903
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24471561
answers question: http://stackoverflow.com/q/24471561
has body: A Java solution for Bug 2197 is available now, through this pull request: Other improvements to Decision Trees for easy-of-use with Java: * impurity classes: Added instance() methods to help with Java interface. * Strategy: Added Java-friendly constructor --> Note: I removed quantileCalculationStrategy from the Java-friendly constructor since (a) it is a special class and (b) there is only 1 option currently. I suspect we will redo the API before the other options are included. You can see a full example, that is going ahead your problem using intance() method of Gini impurity here Strategy strategy = new Strategy(Algo.Classification(), Gini.instance(), maxDepth, numClasses,maxBins, categoricalFeaturesInfo); DecisionTreeModel model = DecisionTree$.MODULE$.train(rdd.rdd(), strategy);

http://stackoverflow.com/a/24430466
answers question: http://stackoverflow.com/q/24430308
type: AcceptedAnswer
downvote count: 0
has body: Yes. It's a horrible way to code. interrupt() will for instance throw an Exception if the Thread is blocked in I/O and is not made to be used like this. Instead, use notify/wait which is made for this. Something like this in run(): synchronized (this) { while (conditionForWaiting) { try { wait(); } catch (InterruptedException ex) {} } performWork(); And to notify the thread that conditionForWaiting is changed: synchronized (threadInstance) { threadInstance.notify(); }
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/37798909
has comment: http://stackoverflow.com/comment/37798837
has comment: http://stackoverflow.com/comment/37798565
accepted answer of: http://stackoverflow.com/q/24430308
score: 2

http://stackoverflow.com/comment/37804461
comment on: http://stackoverflow.com/q/24433206
score: 0
type: Comment
type: QuestionComment
has text: It's explained in full above. I need a general way of saying "if you have [blabla]Gar_1 [blabla]noGar [bleble]Gar_1 [bleble]Gar_1, replace the Gar_1 of [blabla] with noGar leaving the Gar_1 of [bleble] unchanged". How can I make this selection?

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

http://stackoverflow.com/a/30767002
upvote count: 17
answers question: http://stackoverflow.com/q/24577400
score: 17
downvote count: 0
has body: To change the base URI, you can also just add this to application.properties: spring.data.rest.base-path=/my/base/uri
type: Answer

http://stackoverflow.com/q/24451542
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24681504
accepted answer: http://stackoverflow.com/a/24681504
has title: How do you access related entries co-located with data affinity in Hazelcast?
tagged with: hazelcast
favorite count: 0
has body: I am trying to use Hazelcast's map-reduce feature to perform an aggregate operation, which needs to access the co-located entries. The co-location is controlled using data-affinity. Imagine the classic customer/order model as used in the Hazelcast documentation on data-affinity. In my example I want to return a customer summary that has the customer and the sum of all their orders, for example, given this data set: customer_id | name ------------------ 1 | Dave 2 | Kate order_id | customer_id | value ------------------------------ 1 | 1 | 5 2 | 1 | 10 3 | 2 | 12 I want to return: customer_id | name | value -------------------------- 1 | Dave | 15 2 | Kate | 12 This is simple enough, however the reason for using data-affinity is to be able to perform the summing logic within the respective partition holding the data by simply getting all the orders within that partition and therefore avoiding any cross JVM communication. And so my question, from within a Mapper or similar, how do you get the co-located entries in another cache? EDIT: After @noctarius' answer and comments, here's some code (I've tried to make it as brief as possible) that highlights the point at which I only want the orders from the current partition. The order key class looks like this: public class OrderKey implements PartitionAware&lt;CustomerIdentity&gt; { ... @Override public CustomerIdentity getPartitionKey() { return this.customerIdentity; } ... } And the Mapper like this: public class OrderSumMapper implements Mapper&lt;CustomerKey, Customer, CustomerKey, CustomerOrderTotal&gt;, HazelcastInstanceAware { ... @Override public void map(CustomerKey customerKey, Customer customer, Context&lt;CustomerKey, CustomerOrderTotal&gt; context) { Predicate ordersForCustomer = new OrdersForCustomerPredicate(customerKey); int totalValue = 0; //****************************************************************** // // Given orders are co-located with the customer, how do you ensure // this call to get the orders…
has comment: http://stackoverflow.com/comment/37837387
downvote count: 0
possible better answer: http://stackoverflow.com/a/24593793
has answer: http://stackoverflow.com/a/24593793
type: AnsweredQuestion

http://stackoverflow.com/comment/37906842
type: Comment
score: 1
has text: Hi, these workaround does not work for me. Still get the same error
type: AnswerComment
comment on: http://stackoverflow.com/a/24456942

httpresponse
tags question: http://stackoverflow.com/q/24452318
type: Tag
tag name: httpresponse

http://stackoverflow.com/comment/37928207
score: 0
comment on: http://stackoverflow.com/q/24499690
type: Comment
type: QuestionComment
has text: Maps are not iterable. Why worry about someone implementing both interfaces on a class? If they are silly enough to do that, let them cast it as they wish - don't pollute your API based on what-ifs

http://stackoverflow.com/q/24582468
downvote count: 1
type: AnsweredQuestion
tagged with: if-statement
has comment: http://stackoverflow.com/comment/38081314
tagged with: java
score: -1
duplicate of: http://stackoverflow.com/q/9206618
has comment: http://stackoverflow.com/comment/38081379
has answer: http://stackoverflow.com/a/24582476
type: Question
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/9206618
has body: I had a fellow student ask me this question and I have no idea how to answer it. The following code works fine. int x = 40; int y = 35; if (x &gt; y) { int ans = x + y; } However, the code below gives an error saying that the variable declaration isn't allowed where it is. Why isn't it allowed there? NetBeans throws the following exception: Uncompilable source code - Erroneous tree type: int x = 40; int y = 35; if (x &gt; y) int ans = x + y; We are using NetBeans 8.0 Beta if it matters.
tagged with: variables
has comment: http://stackoverflow.com/comment/38081329
favorite count: 0
has comment: http://stackoverflow.com/comment/38081352
has title: Java Declaring a variable in an if-statement
accepted answer: http://stackoverflow.com/a/24582483
has comment: http://stackoverflow.com/comment/38081331
possible better answer: http://stackoverflow.com/a/24582476
tagged with: declaration
has answer: http://stackoverflow.com/a/24582483

http://stackoverflow.com/comment/37821842
has text: Ahh I just thought about doing that, I used the alternative for loop three different times for each of my arraylists and it ended up working. Thanks so much for your help!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24442256

http://stackoverflow.com/a/24472647
has comment: http://stackoverflow.com/comment/37976368
has comment: http://stackoverflow.com/comment/37972075
has body: There is Many Different Way I will mention one of them: -Start by have a Layout of EditText and a button. For Size of family Question -Layout with only a ViewPager -Layout for Fragement, How u want the form to look like For example 2 EditText (Age and Gender) and 1 Button -Create a Fragment.Java class and inflate the Fragment layout inside it Now on you main activity set the first layout with the size of family layout. for Example he enters 4. now open a new activity with the ViewPager layout as its Content. int size = 4; ArrayList&lt;Fragments&gt; lf = new ArrayList&lt;Fragment&gt;(); Create the fragments with a loop for(int count;0 count&lt;size; count ++){ Fragment f = new Fragment(); lf.add(f); } Now create the PagerAdapter passing the "lf" to it you can set Text for every button accordingly String Text; if(pagenumber == size-1) //means last page text= "finish"; else text = "next"; then button.setText(text); UPDATE FOR CLARIFICATION FirstFragment.xml should have what you want in the form (2 EditTexts and 1 Button) main_pager.xml has only ViewPager Create Your mainActivity.java Class with setContentView(R.layout.main_Pager); In your onCreate() You find your viewPager and give to a ViewPager Instance. After that do the above loop as i explained according to size of family now call setAdapter on the ViewPager . ex: vPager.setAdapter(new FragmentAdapter(getFragmentManager(), lf)); Here is your FragmentAdapter Class. public class FragmentAdapter extends FragmentPagerAdapter{ private List&lt;Fragment&gt; fragments; public FragmentAdapter (FragmentManager fm, List&lt;Fragment&gt; fragments) { super(fm); this.fragments = fragments; } @Override public Fragment getItem(int position) { return this.fragments.get(position); } @Override public void destroyItem (ViewGroup container, int position, Object object) { super.destroyItem(container, position, object); } @Override public int getCount() { return this.fragments.size(); } }
has comment: http://stackoverflow.com/comment/37966442
has comment: http://stackoverflow.com/comment/37966508
has comment: http://stackoverflow.com/comment/38014046
has comment: http://stackoverflow.com/comment/38030668
has comment: http://stackoverflow.com/comment/37966498
has comment: http://stackoverflow.com/comment/38011577
accepted answer of: http://stackoverflow.com/q/24472255
score: 0
has comment: http://stackoverflow.com/comment/37977252
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37929889
has comment: http://stackoverflow.com/comment/37966571
has comment: http://stackoverflow.com/comment/37974327
has comment: http://stackoverflow.com/comment/37931812
has comment: http://stackoverflow.com/comment/37998848
type: Answer
has comment: http://stackoverflow.com/comment/37902360
answers question: http://stackoverflow.com/q/24472255

http://stackoverflow.com/a/24568123
score: 0
has body: You can store that values on array. And you can have a random condition also for having a new pair of number or pick randomly on your array.
type: Answer
answers question: http://stackoverflow.com/q/24568073

http://stackoverflow.com/a/24583596
upvote count: 3
has body: You shouldn't be setting size or calling setSize(...) or setBounds(...) as that's setting you up for similar problems in the future, or worse problems when you try to show your GUI on a different platform. Instead let the preferredSizes of your components and the layout managers do this work for you. If you absolutely must set the size of a component, then override getPreferredSize() and return a Dimension that is calculated to work for you. And yes, as per javajon, you should call pack() on the JFrame before displaying it. For more discussions on the null layout, please read what one of the best Swing experts on this site, MadProgrammer, has to say in his answer here.
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/24583305

http://stackoverflow.com/q/24468994
type: Question
has title: Decompress file from assets folder and use it from phonepag application and protect it
has comment: http://stackoverflow.com/comment/37870326
score: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37870256
tagged with: cordova
has body: My idea is to have a file with password and decompress to a folder where i can use them in a phonegap application . Use html files in a new location. I think that is my way to protect phonegap application from decompile. any idea how to do that ? thanks
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37870348
answer count: 0
tagged with: java

http://stackoverflow.com/a/24429527
has comment: http://stackoverflow.com/comment/37796810
downvote count: 1
has comment: http://stackoverflow.com/comment/37796704
upvote count: 0
score: -1
accepted answer of: http://stackoverflow.com/q/24429471
has body: I would just init the singleton instance on creation and not lazily - then, when resetting, you can simple replace INSTANCE with a new object. public static synchronized void reset(){ INSTANCE = new SEManager(); }
answers question: http://stackoverflow.com/q/24429471
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37796808
has comment: http://stackoverflow.com/comment/37799588
has comment: http://stackoverflow.com/comment/37798055
type: Answer

http://stackoverflow.com/comment/39964706
type: QuestionComment
comment on: http://stackoverflow.com/q/24564554
has text: Please consider posting the resolution as an answer so you can mark it as accepted; this question is currently appearing in the list of unanswered questions and that isn't really appropriate.
score: 0
type: Comment

http://stackoverflow.com/q/24437535
score: 2
has answer: http://stackoverflow.com/a/33903029
has title: Specify indexName and type of index in elasticsearch in a properties file
has body: I'm using elasticsearch and spring in my application. For each index type, I have a document mapping. Using @Document annotation I have specified the indexName and type of index. For eg: @Document(indexName = "myproject", type = "user"). But for writing unit tests, I would want to create indexes with a different indexName. Hence I want the indexName to be read from a properties file. How to do this in spring?
tagged with: elasticsearch
tagged with: spring-data-elasticsearch
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38050869
tagged with: spring
linked to: http://stackoverflow.com/q/33069670
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/67826783

paint
tags question: http://stackoverflow.com/q/24446984
tags question: http://stackoverflow.com/q/24481823
tag name: paint
type: Tag

http://stackoverflow.com/q/24445923
score: 0
tagged with: file-io
answer count: 1
has comment: http://stackoverflow.com/comment/37827739
has body: I'm trying to get data from a text file, that was generated by ArcGIS, to clean it up using regex. When I launch application by using RUN PROJECT, everything works, but when I launch the .jar file, it adds "Ā" symbol into the data. Using NetBeans, JDK7, project encoding is set to UTF-8. Here's the original string: 0,RIX_P_1,AREA,2,LGS,WGS84,TREE,32.3, , , ,25,0.61,M,90%,0.01, ,0.15,90%,0.1,EGM96,ESSENTIAL,08.11.2013,M, , ,NIL,NIL,METRUM,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0,0,0,0,0,0,1,0,0, , , , , , , , , , , ,tree,**"23° 57' 51,805"" E","56° 53' 30,142"" N" The program reads it like this (I replaced the middle part of the string with (===), it is unchanged): 0,RIX_P_1,AREA,2,(===),"23Ā° 57' 51,805"" E","56Ā° 53' 30,142"" N" Here's the button code that does the reading job. It is partially taken from a tutorial: private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { int returnVal = fileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { FileInputStream fis = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); jTextArea1.read( br, null ); } catch (IOException ex) { System.out.println("problem accessing file"+file.getAbsolutePath()); } } else { System.out.println("File access cancelled by user."); } } I found some information on the WEB it seems that problem is in encoding, but I cannot figure out, how to setup things correctly. P.S. I'm a novice in programming, so excuse me for stupid questions :)
duplicate of: http://stackoverflow.com/q/4964640
has comment: http://stackoverflow.com/comment/37827700
type: AnsweredQuestion
tagged with: java
has title: java unwanted symbols after reading from file
type: Question
linked to: http://stackoverflow.com/q/4964640
has answer: http://stackoverflow.com/a/24446375
accepted answer: http://stackoverflow.com/a/24446375

http://stackoverflow.com/comment/37933327
has text: The vast majority of them do not. Interfaces are meant for callbacks and for behavior with multiple implementations. For example, List, which has ArrayList and LinkedList for different implementations.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24473283